How to crop an irregular shape from the image?
Show older comments
My topic of the project is to detect and segment the optic disk. First of all, i want to remove the black background at four corners.
I have found the region of eye and labelled with red circle as shown in the figure. Now i am facing a problem which is how to crop the region?
Can someone please advise? Thank you.

Accepted Answer
More Answers (2)
Image analyst beautifully explains here
https://www.mathworks.com/matlabcentral/answers/1683749-how-to-crop-a-masked-area-polygon-shape-out-of-an-image#answer_930129
In order to create a circle mask, see this
https://www.mathworks.com/matlabcentral/fileexchange/47905-createcirclesmask-m
4 Comments
ZWY
on 19 May 2022
Walter Roberson
on 19 May 2022
https://www.mathworks.com/matlabcentral/fileexchange/47905-createcirclesmask-m
ZWY
on 20 May 2022
Image Analyst
on 19 May 2022
0 votes
You don't need to get rid of the black background. That is not the first step, nor even anything you need to do.
Your first step should be to go here:
and look at the sections:
- 20.5 Retinal Images, Analysis of Eye, etc.
- 20.5.1 Eye, Cornea, Corneal Images
- 20.5.2 Optic Disc Location, Optic Disc Detection
- 20.5.3 Retinal Images, Angiography, Blood Vessels in the Eye
- 20.5.3.1 Retinal Microaneurysms, Detection
- 20.5.4 Glaucoma Retinopathy, Retinal Analysis Application
- 20.5.5 Cataracts, Detection, Analysis, Surgery
- 20.5.6 Diabetic Retinopathy, Retinal Analysis Application
- 20.5.7 Macular Degeneration Detection, Retinal Analysis Application
- 20.5.8 Retinal Images, Optical Coherence Tomography, OCT
to see how it's done in section 20.5.2.
One simplistic approach would be to use the blue channel and threshold to find the optics disc. Then I'd use bwconvhull() to get its convex hull.
Categories
Find more on ROI-Based Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!