How can I process an image 100 times as explained below?

1 view (last 30 days)
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.

Accepted Answer

Image Analyst
Image Analyst on 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.

More Answers (1)

KSSV
KSSV on 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

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!