Reputation: 2170
Why is the image in a figure (ploted by imshow
) changing its size when updated by another imshow
?
Demonstrational Code:
img = rand(100,100);
figure(1);
hold on;
imshow(img); % plot an image
pause(1); % pause for demonstrational reasons
imshow(img); % update the image
This is only happening at the first update.
Upvotes: 3
Views: 750
Reputation: 78
The image is not changing size. You can see this by typing:
img = rand(100,100);
figure(1);
hold on;
whos img
pause(5);
whos img
the following will be your result:
Name Size Bytes Class Attributes
img 100x100 80000 double
Name Size Bytes Class Attributes
img 100x100 80000 double
Upvotes: -2
Reputation: 76917
figure(1); takes default size and then when you plot imshow(img) after hold on size gets reduced relative previous figure(1) size.
Better approach would be
img = rand(100,100);
figure, imshow(img); % plot an image
hold on;
pause(1); % pause for demonstrational reasons
imshow(img); % update the image
Upvotes: 5