Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
Ellis Berry
Ellis Berry am 16 Mai 2016
Beantwortet: Image Analyst am 16 Mai 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

Antworten (2)

Walter Roberson
Walter Roberson am 16 Mai 2016

Image Analyst
Image Analyst am 16 Mai 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.

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by