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!

