How to Capture objects in big image and divided them to small images?

Illustration
warinthorn_Kiadti - 2022-08-30T09:46:45+00:00
Question: How to Capture objects in big image and divided them to small images?

Hi,   I stuck at my study now.   I have one example image.  From this image, I would like to separate these five small objects in the picture to be five small images.   How can I do this. I need your help please.   I am looking forward to hear from you. Thank you very much.

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

This code works just for this image only

 

Irgb = imread('b653er.jpg');
Igray = rgb2gray(Irgb);
Ibw = im2bw(Igray,graythresh(Igray));
Ifill = imfill(Ibw,'holes');

%clear the lines
Ihor = imopen(Ifill,strel('line',5,0));
Iver = imopen(Ihor,strel('line',5,90));

Ilabel = bwlabel(Iver);
stat = regionprops(Ilabel,'BoundingBox');
for x = 1 : numel(stat)
    bb = stat(x).BoundingBox;
    Icrop{x} = imcrop(Irgb,bb);
    subplot(numel(stat),1,x); imshow(Icrop{x});
end

objects in big image


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!