Difference between imshow and mesh/surf
显示 更早的评论
I am trying to understand why the result from imshow and mesh looks different. It seems that surf flips the row and column of the matrix I am trying to plot. However, plotting the transpose of the matrix doesn't seem to give me the correct result as well. Since my matrix is a image file, I can see that imshow is correct while mesh flips one of the axis.

Is there any way to plot with mesh function that gives the correct row and column? Why transposing doesn't work?
采纳的回答
更多回答(1 个)
Image Analyst
2022-11-18
0 个投票
Surf is a surface rendering of the image where is maps the image intensity into a height above a plane. So surf is like a topographic 2.5-D rendering of a 3-D surface onto the flat 2-D plane of your monitor's screen.
imshow is just like looking at a flat photograph of your scene, not a 2.5-D rendering of it.
Plus surf and imagesc apply some weird, usually unwanted, colormap to pseudocolor the image.
3 个评论
Jiayun Liu
2022-11-18
Image Analyst
2022-11-18
That's just the convention. With things plotted like x-y, the origin is at the lower left. This is the way it's been done for centuries. With images, it's an array/matrix. With matrixes the origin (row 1, column 1) is at the upper left. Again it's been done that way for centuries. And surf uses the x-y convention and images use the "row/line 1 at top" convention. You can switch between them after you display the data with axis ij or xy
axis ij; % Origin at upper left
axis xy; % Origin at lower left
Jiayun Liu
2022-11-21
类别
在 帮助中心 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

