How to save layered images

6 views (last 30 days)
David
David on 1 Nov 2013
Commented: Image Analyst on 1 Nov 2013
Hi,
I'm currently working with gaze data and showing the results of the gaze data as a heat map superimposed on a visual stimulus.
I first show the stimulus in the background and then add the heatmap layer on top of it with the transparency data. handles.background is an m-by-n-by-3 truecolor matrix of double class. filtered is the heatmap data.
imH = imshow(handles.background);
hold on;
h = imshow(filtered, 'Colormap', jet);
hold off;
set(h, 'AlphaData', alphaMap);
The problem I have is saving the resulting layered image. I've tried using getframe(gca) , but it only returns the stimulus without the heatmap, and using getimage(gca) returns the heatmap values without the stimulus. Is there a direct way of obtaining the layered image?
  1 Comment
David
David on 1 Nov 2013
I'm aware that one can use print() to do this, but it saves the whole figure, which means that it also includes the UI components of my figure when I just want the resulting image itself.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 1 Nov 2013
Try calling imwrite() with your original image and the overlay image and saving it as a PNG image.

Community Treasure Hunt

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

Start Hunting!