我尝试开发一个代码(如下所示)来显示包含jpeg图像帧的文件调用'image'中的视频。然而它的显示和停止直到最后一帧,这意味着显示窗口闪烁。如何创建一个循环,以便它可以顺畅地逐帧显示帧?
file = dir('image/*.jpg');
Numfile = size(file,1);
for I=1:Numfile
vidRead = vision.VideoFileReader(Files(I).name);
vidPlayer = vision.VideoPlayer;
while ~isDone(vidRead)
vidFrame = step(vidRead);
step(vidPlayer, vidFrame);
end
end
答案 0 :(得分:2)
file = dir('image/*.jpg');
Numfile = size(file,1);
vidPlayer = vision.VideoPlayer;
for I=1:Numfile
vidFrame = imread(file(I).name);
step(vidPlayer, vidFrame);
end