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 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by