imshow更新的问题

mat*_*urg 3 matlab image

为什么图中的图像(用图表绘制imshow)在被另一个图像更新时会改变它的大小imshow

示范代码:

img = rand(100,100);
figure(1);
hold on;
imshow(img); % plot an image
pause(1);    % pause for demonstrational reasons
imshow(img); % update the image
Run Code Online (Sandbox Code Playgroud)

这只发生在第一次更新时.

Zer*_*ero 5

图1); 采用默认大小,然后当你按照尺寸减去相对于之前的数字(1)尺寸后,你绘制imshow(img).

更好的方法是

img = rand(100,100);
figure, imshow(img); % plot an image
hold on;
pause(1);    % pause for demonstrational reasons
imshow(img); % update the image
Run Code Online (Sandbox Code Playgroud)