java的imshow方法_如何在循环中使用子图,imshow或图形来显示所有图像?

基本上,我想循环所有视频帧,从背景图像中减去每一帧,并使用子图或数字显示结果,即 subtractedImg .

vidObj = VideoReader('test3.mp4');

width = vidObj.Width;

height = vidObj.Height;

subtractedImg = zeros([width height 3]);

videoFrames = [];

k = 1;

while hasFrame(vidObj)

f = readFrame(vidObj);

f=uint8(f);

videoFrames = cat(numel(size(f)) + 1, videoFrames, f);

k = k+1;

end

backgroundImg = median(videoFrames,4);

i=1;

Problem here 我在这里使用的子图,在这个循环中不显示输出 . 仅显示一个 Headers 为"last one"的图形 .

while hasFrame(vidObj)

frame = readFrame(vidObj);

subtractedImg=imabsdiff(frame,backgroundImg);

figure(i); imshow(subtractedImg);

% subplot(5,5,i),imshow(subtractedImg);

%uncommenting above line does not work, subplot not shown

if(i < 20)

i= i+1;

end

end %end while

subplot(1,2,1),imshow(subtractedImg),title('last one');

如何使用子图显示每个图像?例如,使用5x5子图,如果我想显示25个减影图像,为什么 subplot(5,5,i),imshow(subtractedImg); 不起作用?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值