How detect, crop and straighten a particular shape
3 次查看(过去 30 天)
显示 更早的评论
Hi all, I have to detect, crop and straighten this particular rectangular shape with rounded corner from the image, in order to classify this "film" used in dosimetry application.
These are different films belonging to different class:
I have already tried with common methods like is shown in these posts without any useful result:
Any suggestion?
0 个评论
采纳的回答
更多回答(1 个)
Image Analyst
2016-7-12
Look at the outer band of the image, like a rectangular "ring" within 40 pixels (or whatever) of the image. Take the mode of those pixels in each color band to get the most common color. Create masks for each color channel and then combine them to form an overall mask. Then invert that to find blobs that are not the background color. Then fill holes with imfill() and get the convex hull. That will get you the rounded rectangle. Then call bwboundaries to get the coordinates and identify the flat parts to get the angle, then call imrotate() to rotate/fix it.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!