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

조회 수: 1 (최근 30일)
Javad
Javad 2018년 3월 14일
답변: Image Analyst 2018년 3월 15일
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에서 Denoising and Compression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by