![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174683/image.png)
How detect, crop and straighten a particular shape
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
riccardo isi
il 12 Lug 2016
Commentato: riccardo isi
il 15 Lug 2016
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154808/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154809/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154810/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154811/image.jpeg)
I have already tried with common methods like is shown in these posts without any useful result:
Any suggestion?
0 Commenti
Risposta accettata
Più risposte (1)
Image Analyst
il 12 Lug 2016
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.
1 Commento
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!