Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
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 comentarios
Walter Roberson
Walter Roberson el 14 de Dic. de 2015
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 el 14 de Dic. de 2015
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?

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by