How to plot many images in a loop

조회 수: 13(최근 30일)
Tsitsos Dimitris
Tsitsos Dimitris 2021년 3월 17일
댓글: Rik 2021년 3월 18일
I am working with a Matlab code where I want to run a loop. In each loop, I will do some processing and then show an image based on the processed data. When I go to the next loop, I want the previously stored image to be closed and generate a new image based on the latest data.
A sum up from my code is this :
for ww= 0.4:0.2:2.6
**********************image processing code*********************************
t1=1-ww*(dark_channel1/A); % part that connect ww with the image processing code
**********************image processing code*********************************
out = pic;
imshow (out)
What I expect is many different images depend on the "ww", but the output that I take looks like in each iteration each image sticks to the previous one.
I think that somehow I can’t separate the output (image), and after each iteration I don't reset my loop. As a result I display a new image but stack on the previous. It is like in each iteration the new image sticks to the previous.
Any suggestions??
Thank you in advance

채택된 답변

ANKUR KUMAR 2021년 3월 17일
for i=1:5
  댓글 수: 10
Rik 2021년 3월 18일
Regarding your email:
There must be a way to reproduce this problem. Try removing code line by line to see what happens when.
As an example:
for i=1:h
for j=1:w
This sets some values to dark_I. Assuming img contains integers 0-255, you can replace this loop with this:
It is also possible to create a mat file containing dark_I wrapped in a cell with the values for the first 3 iterations. That should also be enough to replicate the result.
I don't do private consulting, there are other people you can hire for that. You need to find a way to reproduce your issue in fewer lines of code than you posted above. Unless there is a bug caused by a very specific condition (making it hard/impossible to reproduce on my end anyway), it is almost always possible to reduce the cause of such behavior down to code that fits on one screen.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by