필터 지우기
필터 지우기

how to get image position in a figure, for annotation purpose

조회 수: 2 (최근 30일)
Jun
Jun 2011년 10월 24일
댓글: binbin cui 2016년 7월 27일
I am displaying an image with imshow in a GUI window. What I want to do is to add arrow annotations on the image at the places of mouse clicks.
The problem that I am having, is that annotation function uses normalized figure units, and I will need the position information of the image displayed in the figure to convert between the coordinates for a point in the image to the coordinates of the point in the figure.
I tried ds2nfu, but it does not work properly, because it is only taking the position info for the axes that the image is displayed in, whereas imshow displays the image with the original aspect ratio, leading to inconsistency between image coordinates and axes coordinates.
Any suggestion is appreciated

답변 (2개)

Image Analyst
Image Analyst 2011년 10월 24일
Did you try ginput()? It will return the pixel position in the image.
  댓글 수: 2
Patrick Kalita
Patrick Kalita 2011년 10월 24일
Moving Jun's reply from a separate answer to a comment in this thread: "I did use ginput, which returns to me the current cursor position in the image. But what I want to know is how I can translate this ginput position to the coordinates of the figure that the image is in."
binbin cui
binbin cui 2016년 7월 27일
By the way, how to make sure the position selected by hand is exactly accurate and precise.

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


Sean de Wolski
Sean de Wolski 2011년 10월 24일
Set the figure 'units' to 'pixels' and then ginput will correspond directly.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by