フィルターのクリア

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

4 ビュー (過去 30 日間)
Ellis Berry
Ellis Berry 2016 年 5 月 16 日
回答済み: Image Analyst 2016 年 5 月 16 日
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

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 5 月 16 日

Image Analyst
Image Analyst 2016 年 5 月 16 日
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.

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by