![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/210737/image.png)
Adding picture to imagesc
2 views (last 30 days)
Show older comments
martin martin
on 27 Mar 2019
Answered: martin martin
on 27 Mar 2019
Hello guys,
what is the best way to (or is it possible?) add a picture to imagesc? I have colour map in the top and the picture of the body and I would like add body picture over the colourmap as on bellow. Any ideas?
Best regards
![pridanitela.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/210723/pridanitela.png)
0 Comments
Accepted Answer
Image Analyst
on 27 Mar 2019
Edited: Image Analyst
on 27 Mar 2019
Try this to display one image on top of another, and adapt as needed.
% Displays an image and then displays another image over it with a small size.
handleToFigure = figure
% First display the main, large image.
rgbImage = imread('peppers.png'); % Read from disk.
imshow(rgbImage); % Display in axes.
axis('on', 'image');
ax1 = gca; % Store handle to axes 1.
hold on;
% Create smaller axes in top right, and display image in it.
% Store handle to axes 2 in ax2.
ax2 = axes('Position',[.5 .4 .3 .3])
grayImage = imread('cameraman.tif'); % Read from disk.
imshow(grayImage); % Display in axes.
axis('on', 'image');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/210737/image.png)
You could also average the two images to create a blended effect, like this (an example from my code where I overlay a heatmap over an image):
ratio = handles.sldOpacity.Value; % Get the opacity ratio from the slider, for example 0.01
combinedImage = uint8(ratio * double(rgbImage) + (1-ratio) * double(heatMapImage));
imshow(combinedImage)
0 Comments
More Answers (1)
See Also
Categories
Find more on Display Image in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!