Overlaying Compass Plot on an Image
7 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Piyush Kumar
on 30 Jul 2024
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.
0 Comments
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!