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

1 次查看(过去 30 天)
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.

采纳的回答

Image Analyst
Image Analyst 2018-3-15
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.

更多回答(1 个)

KSSV
KSSV 2018-3-15
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

类别

Help CenterFile Exchange 中查找有关 Read, Write, and Modify Image 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by