Filter löschen
Filter löschen

How to crop the image?

3 Ansichten (letzte 30 Tage)
peyush
peyush am 18 Jul. 2015
Kommentiert: peyush am 20 Jul. 2015
  • I have above image and I want to crop it such that the white pixels just reach the corners from all sides using Matlab code automatically not manually
how could I do this...thanks In advance

Akzeptierte Antwort

Image Analyst
Image Analyst am 18 Jul. 2015
Have you run my Image Segmentation Tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862? It goes over that.
labeledImage = bwlabel(binaryImage);
blobMeasurements = regionprops(labeledImage, 'BoundingBox');
% Find the bounding box of each blob.
thisBlobsBoundingBox = blobMeasurements.BoundingBox; % Get list of pixels in current blob.
% Extract out this blob into it's own image.
% I'm assuming just one blob. If you have multiple, see my tutorial.
subImage = imcrop(binaryImage, thisBlobsBoundingBox);
  6 Kommentare
Image Analyst
Image Analyst am 20 Jul. 2015
You should have had this done long long ago - it's not that hard. So I did it for you. See the attached demo.
peyush
peyush am 20 Jul. 2015
thank-you so so much ☺

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox 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