Difference between imshow and mesh/surf
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 18 de Nov. de 2022
0 votos
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 comentarios
Jiayun Liu
el 18 de Nov. de 2022
Image Analyst
el 18 de Nov. de 2022
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
el 21 de Nov. de 2022
Categorías
Más información sobre Surface and Mesh Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

