Changing pixel figure coordinates when using imshow

조회 수: 5 (최근 30일)
James Usevitch
James Usevitch 2020년 7월 31일
댓글: James Usevitch 2020년 8월 2일
When I use imshow to plot the pixels represented by a matrix, each pixel is centered in the figure at its matrix coordinates (e.g. the pixel on row 1, column 1 is centered at figure coordinates (1,1)).
Is it possible to change this so that a specific corner of each pixel is positioned at its matrix coordinates? For example, can the pixel on row 1, column 1 be plotted with its lower right corner at figure coordinates (1,1), and so on for all the remaining pixels?

답변 (1개)

Image Analyst
Image Analyst 2020년 7월 31일
After you call it, try this:
axis xy
  • xy — Default direction. For axes in a 2-D view, the y-axis is vertical with values increasing from bottom to top.
  • ij — Reverse direction. For axes in a 2-D view, the y-axis is vertical with values increasing from top to bottom.
  댓글 수: 1
James Usevitch
James Usevitch 2020년 8월 2일
Thanks for this tip! This is much more compact than using set(gca,'Ydir','reverse').
I actually discovered that using the command image(x,y,C) answers my question--it lets you control the figure coordinates of the plotted image pixels. Sorry if the original question wasn't clear.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Display Image에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by