how can i display an image row by row like if the image is loading ?

6 views (last 30 days)
displaying image

Accepted Answer

Walter Roberson
Walter Roberson on 4 Mar 2018
to_display = 0 * YourImage;
image(to_display);
drawnow();
for row = 1 : size(YourImage, 1)
to_display(row,:,:) = YourImage(row,:,:);
drawnow();
end
  3 Comments
Dynamic
Dynamic on 4 Aug 2021
Hi Analyst,
If I want to display 5 rows simultaneously, the how loop will be changed????
Expecting your response asap
Walter Roberson
Walter Roberson on 4 Aug 2021
% YourImage = imread('moon.tif'); % Grayscale image.
YourImage = imread('Peppers.png'); % RGB image.
to_display = zeros(size(YourImage), class(YourImage));
image(to_display);
colormap(gray(256));
drawnow();
rows_at_a_time = 5;
nrow = size(YourImage,1);
for row = 1 : rows_at_a_time : nrow
lastrow = min(row+rows_at_a_time-1,nrow);
thisRow = YourImage(row:lastrow, :, :);
to_display(row:lastrow,:,:) = thisRow;
image(to_display);
drawnow();
% pause(0.01); % Slowdown factor
end
fprintf('Done!\n');

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!