Here is an example of overlaying a binary heatmap over a color image:
%# some image I = im2double( imread('peppers.png') ); %# I create here a random mask (gaussian centered in middle of image) [r,c,~] = size(I); [XY] = meshgrid(1:r,1:c); Z = mvnpdf([X(:) Y(:)], [rc]./2, diag(15.*[rc])); Z = (Z-min(Z(:)))./range(Z(:)); Z = reshape(Z',[cr])'; %# show image and mask separately subplot(121), imshow(I) subplot(122), imshow(Z) %# show overlayed images figure, imshow(I), hold on hImg = imshow(Z); set(hImg, 'AlphaData', 0.6); %# also we can specify a colormap colormap hsv



source share