필터 지우기
필터 지우기

Is there a way to force the drawing of the shape to snap to the pixels of the image when using imrect function ?

조회 수: 2 (최근 30일)
I have a lot of pictures that I need to extract a ROI. I want a picture to show and then the user to select the ROI that he/she wants. The function imrect seems to be doing that. I am trying to get the coordinate of the rectangle and the ROI selects only a whole pixel not like the imrect that enables the fractions.
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 12월 14일
I am confused about whether you are trying to enable fractions of a pixel when you extract the ROI, or if you are trying to get imrect() to only allow whole number pixels? You already found the posting about having imrect() snap to pixels after you release the button; see http://uk.mathworks.com/matlabcentral/answers/74507-imfreehand-or-imrect-snap-to-pixels-while-drawing
Image Analyst
Image Analyst 2015년 12월 14일
I don't know what you want. Do you want to know how to use imrect() to get the parameters of the box they drew? Or do you want to let the user freehand draw some region so that the ROI is not necessarily a perfect rectangle but can follow the edges of some region in the image? Or do you want to have the user draw some rough/approximate boundary and automatically have the boundary "snap" to a more accurate boundary using the activecontour() function?

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

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by