MATLAB: How to overlay(superimpose) contour plot(coloured) over a gray scale image

contourimage processingimages stack

I am trying to superimpose a colored contour plot on a grayscale image. I used hold on and then i tried to plot a contour plot. Also i tried using two color maps in a same figure window. But even that is not working. Pls do help me in solving this problem. Typically the contour plot occupies only the central part of the greyscale image , the rest is the greyscale image.

Best Answer

A grayscale image with a colored contour plot superimposed:
% Make some sample grayscale image
I = abs(sin((1:500)'/100)*sin((1:500)/100));
% Convert the grayscale image to RGB
Irgb = cat(3,I,I,I);
% Plot the image and some contours in color
image(Irgb)
hold all
contour(I);
0000 Screenshot.png
Related Question