Azzera filtri
Azzera filtri

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

4 visualizzazioni (ultimi 30 giorni)
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

Risposte (2)

Walter Roberson
Walter Roberson il 16 Mag 2016

Image Analyst
Image Analyst il 16 Mag 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.

Categorie

Scopri di più su Read, Write, and Modify Image in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by