フィルターのクリア

Overlaying Compass Plot on an Image

5 ビュー (過去 30 日間)
Paulo
Paulo 2024 年 7 月 30 日
編集済み: Paulo 2024 年 7 月 30 日
I would like to overlay a compass plot on top of an image. I would need to set the specific location where I want the plot, and its size. I tried using "hold on" but it didn't work.

回答 (1 件)

Piyush Kumar
Piyush Kumar 2024 年 7 月 30 日
You can use imfuse function. It creates a composite image from two images. There are examples on this page explaining how to create overlay image.
% Generate some data for the compass plot
U = randn(1,50);
V = randn(1,50);
% Create the compass plot and save it as an image
% figure;
% Create a smaller figure for the compass plot
figure('Position', [100, 100, 150, 150]); % Adjust the size as needed
compass(U, V);
saveas(gcf, 'compass_plot.jpg');% Load or import your image
img = imread('<your-image-path>');
% Load the compass plot image
compass_img = imread('compass_plot.jpg');
% Use imfuse to overlay the compass plot image on the original image
overlay_img = imfuse(img, compass_img, 'falsecolor','Scaling','joint','ColorChannels',[1 2 0]);
% Display the overlay image
% figure;
imshow(overlay_img);
You can adjust the position of the compass plot in the figure function.

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by