How can I process an image 100 times as explained below?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Image Analyst
il 15 Mar 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 Commenti
Più risposte (1)
KSSV
il 15 Mar 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 Commenti
Vedere anche
Categorie
Scopri di più su Read, Write, and Modify Image in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!