imfreehand or imrect -- snap to pixels while drawing
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Is there a way to force the drawing of the shape to snap to the pixels of the image? Currently I have to use imshow with 'InitialMagnification', 100 in order to avoid non-integer pixel values for the position of the imrect.
Also, is there a way to easily acquire the area inside imfreehand? I can do it easily with imrect but with non-rectangular objects it is significantly more difficult.
Thanks in advance
1 comentario
Respuestas (2)
Sean de Wolski
el 3 de Mayo de 2013
You can do this using the setConstrainedPosition() method of the object.
How are you getting the area for the rectangle? For a freehand there are two things you could do:
- Ccreate a mask (using the creatMask method) and get the area of this using bwarea
- Use the polyarea function to get the area given the vertices.
3 comentarios
Image Analyst
el 3 de Mayo de 2013
That's after it's been drawn. I know of no way to have it "go around the edges of pixels" of a highly magnified image while you're drawing, so you're stuck with having to round the returned coordinates afterwards.
Pieter
el 26 de Oct. de 2016
Editada: Pieter
el 26 de Oct. de 2016
I know this is an old thread but very relevant to me. I would like to have a dragged imrect snap to pixels but have no clue on how to do it? Another solution would be to have the snapping when the mouse button is released after dragging the ROI. Has someone some could he/she would like to share? Thx
0 comentarios
Ver también
Categorías
Más información sobre Display Image en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!