MATLAB: How to get a 3D view of grey image

3d viewimage processing

Hi every one,
so i have a gray image and i want to have a view of the different regions in the image (steep/flat regions)
how can i display a 3D view so the x,y will represent the pixel location and z will represent the value of the pixel?
thank you!

Best Answer

You can use surf()
img = im2double(imread('pears.png'));
img_gray = rgb2gray(img);
surf(img_gray)
shading interp
img_gray:
surf():