Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How do I access the output images from this program.

1 Ansicht (letzte 30 Tage)
Ananya Panda
Ananya Panda am 23 Mär. 2018
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
A=imread('search.jpg');
figure,imshow(A); title('Original Image');
%Convert the Image to binary
B=im2bw(A);
%Fill the holes
C=imfill(B,'holes');
%Label the connected components
[Label,Total]=bwlabel(C,8);
%Rectangle containing the region
Sdata=regionprops(Label,'BoundingBox');
%Crop all the objects
for i=1:Total
Img=imcrop(A,Sdata(i).BoundingBox);
Name=strcat('Object Number:',num2str(i));
imwrite(Img,'i.jpg');
B=padarray(Img,[10 10]);
figure,imshow(B); title(Name);
end
i gets rewritten such that only the last image is accessible outside the loop. Is there any particular way to use indexing to be able to access the output images one by one

Antworten (1)

Von Duesenberg
Von Duesenberg am 23 Mär. 2018
Quick and dirty:
imwrite(Img, [num2str(i) '.jpg'])

Diese Frage ist geschlossen.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by