I found something, I thought I should share here.
Like Shai and Steve , mentioned using AlphaData
images, gives a very good result in many cases. However, if you need to save the image with the original resolution (and without using getframe
, print
, saveas
, etc.), the following will help.
(I use the second example in Steve's article )
% Reading images E = imread('http://www.mathworks.com/cmsimages/63755_wm_91790v00_nn09_tips_fig3_w.jpg'); I = imread('http://www.mathworks.com/cmsimages/63756_wm_91790v00_nn09_tips_fig4_w.jpg'); % normalizing images E = double(E(:,:,1))./double(max(E(:))); I = double(I(:,:,1))./double(max(I(:)));
Here's the use of AlphaData
(opacity):
figure, imshow(E), hold on red = cat(3, ones(size(E)), zeros(size(E)), zeros(size(E))); h = imshow(red); set(h, 'AlphaData', I);
To get the same look as above, but in one matrix (which I could not achieve with imfuse
), you can use this simple code:
Comb = E; Comb(:,:,1) = (1-I).*E + I; % red Comb(:,:,2) = (1-I).*E; % green Comb(:,:,3) = (1-I).*E; % blue figure, imshow(Comb)
Hope this helps someone!