Borrar filtros
Borrar filtros

How to let the user choose where to process on an image?

4 visualizaciones (últimos 30 días)
Ellis Berry
Ellis Berry el 16 de Mayo de 2016
Respondida: Image Analyst el 16 de Mayo de 2016
Hello everybody,
I want to create a GUI which lets the user choose on an image where the area of interest is. So I want a picture to come up on the GUI, and then the user can click four points on the image indicating the four corners of a piece of paper (area of interest)? Then my programme could record these four sets of coordinates and use then to then start the image processing? Is there a way to do this? I really can't find a way looking online.
Many thanks, Ellis

Respuestas (2)

Walter Roberson
Walter Roberson el 16 de Mayo de 2016

Image Analyst
Image Analyst el 16 de Mayo de 2016
Try imrect() or rbbox() if the edges of your ROI align with the edges of the image. If they don't, use impoly() or roipoly() or roipolyold(). Then you'll have the vertex coordinates. Then use poly2mask() to make a mask. After that, use the mask to restrict processing some way. For example, maybe you could use the mask to blacken everywhere outside the mask:
mask = poly2mask(xVector, yVector, numRows, numColumns);
maskedImage = grayImage; % Initialize
maskedImage(~mask) = 0; % Blacken outside mask.

Categorías

Más información sobre Read, Write, and Modify 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!

Translated by