How to crop an image in MATLAB

3 Ansichten (letzte 30 Tage)
Kumar Arindam Singh
Kumar Arindam Singh am 17 Mär. 2017
Beantwortet: Image Analyst am 17 Mär. 2017

I have this binary image. Now I want to crop this image in such a way that I have only the leaf part and the remaining part(which contains another angled black part) are removed. I wont use manual cropping. This should be by final image:

Thank You!

Antworten (1)

Image Analyst
Image Analyst am 17 Mär. 2017
Simply invert then call bwareaopen() and imclearborder()
mask = bwareaopen(~mask, 1000);
mask = imclearborder(mask);
% Invert again if you want black on white (usually that's not a good idea though).
mask = ~mask;

Kategorien

Mehr zu MATLAB 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