How can I process an image 100 times as explained below?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Javad
am 14 Mär. 2018
Beantwortet: Image Analyst
am 15 Mär. 2018
I want to process an image 100 times so that in each step the processed image of the previous step is introduced to the algorithm. For example, an image is read from and processed (the second image). In the next step, the second image is processed by the algorithm and the third image is generated. Then the third image should be processed in the same algorithm. This cycle should be continued 100 times. Finally, I have 100 images each of which generated from the previous ones.
I know that a “for loop” can do it but I do not know how can I introduce the processed image to the algorithm for the next step. Input image → processed by the algorithm → second image → processed by the algorithm → third image → … → 99th image → processed by the algorithm → 100th image.
I appreciate any help.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 15 Mär. 2018
Very very simple. Try this:
nextImage = imread('first image.png'); % or whatever your first image is...
for k = 1 : 100
fprintf('Processing image time #%d.\n', k);
nextImage = ProcessImage(nextImage);
end
If you want to display the image, you can add this to the end of the loop
imshow(nextImage);
caption = sprintf('Iteration #%d', k);
title(caption, 'FontSize', 15);
drawnow;
The image "nextImage" goes into your processing function (whatever it is) and returns the "answer/result" in the same variable, so it is ready to use on the next iteration.
0 Kommentare
Weitere Antworten (1)
KSSV
am 15 Mär. 2018
Let I be your image.
iwant = cell(100,1) ;
% do first process and save, let I1 be the precessed image
iwant{i} = I1 ;
for i = 2:100
% do process on iwant{i-1} and save in iwant{i} ;
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Read, Write, and Modify Image 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!