# Display grayscale image as 3d plot

How to build 3d plot of grayscale image where x,y - pixel coordinates, z - pixel intensity? I tried ListPlot3D[ImageData[image]], but ImageData gives just intensities. I suppose a possible solution would be transorming image to (x-coord, y-coord, intensity) and passing this as an agrument to ListPlot3D.

pic = Import @ "http://i.stack.imgur.com/RJs60.png"


ListPlot3D can work with an array of values too. The problem is that you have quadruplets there, RGB and alpha channel. Convert it:

ListPlot3D[
Reverse @ ImageData @ RemoveAlphaChannel @ ColorConvert[pic, "Grayscale"],
AxesLabel -> {"x", "y", "z"}
] Another nice 3D-ish plotting command is ReliefPlot. Modelling the preprocessing after Kuba's answer, this would be:

pic = Import@"http://i.stack.imgur.com/RJs60.png";
imdData = Reverse@ImageData@ RemoveAlphaChannel@ColorConvert[pic, "Grayscale"];
ReliefPlot[imdData] For smaller images I like the ListPlot3D with the option InterpolationOrder -> 0. Every pixel is then a nice flat tile which you can give a color with an appropriate ColorFunction.

t = Table[Exp[-(Sqrt[x^2 + y^2]/5)] Cos[Sqrt[x^2 + y^2]/2], {x, -10, 10,
0.5}, {y, -10, 10, 0.5}]; 