How to add an image to the current axes without replacing existing plots

1 vue (au cours des 30 derniers jours)
Nirodha Sampath
Nirodha Sampath le 19 Fév 2024
Commenté : Matt J le 23 Fév 2024
I have created a matrix, called "Final" and I want to plot its contour pattern on an image, in a polygon shape.
I tried "imagesc(Final,"XData",[min_x_2 max_x_2],"YData",[min_y_2 max_y_2],"AlphaData",0.5)" and was able to plot a rectangle contour map successfully. But I want to plot it on a RoI such as [1558,1798; 1790,1806; 1782,2006; 1562,2018].
(Note that the "Final" matrix's contour map might exceed the area of the polygon)
Thank you.

Réponses (2)

Matt J
Matt J le 19 Fév 2024
Modifié(e) : Matt J le 19 Fév 2024
You can use hold
fcontour(@(x,y) (x-50).^2+(y-50).^2,[20,80],'m'); hold on
imshow(imread('cameraman.tif')); hold off
h=gca; h.Children=flip(h.Children);
  2 commentaires
Nirodha Sampath
Nirodha Sampath le 22 Fév 2024
Thank you very much Matt. That was really helpfull
Matt J
Matt J le 23 Fév 2024
I'm glad, but please Accept-click whichever answer resolved the question.

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 19 Fév 2024
See my attached examples to inset images and plots into other images and plots.

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by