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

1 visualización (últimos 30 días)
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.

Respuestas (2)

Matt J
Matt J el 19 de Feb. de 2024
Editada: Matt J el 19 de Feb. de 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 comentarios
Nirodha Sampath
Nirodha Sampath el 22 de Feb. de 2024
Thank you very much Matt. That was really helpfull
Matt J
Matt J el 23 de Feb. de 2024
I'm glad, but please Accept-click whichever answer resolved the question.

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 19 de Feb. de 2024
See my attached examples to inset images and plots into other images and plots.

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by