【问题标题】:Opencv video frames. I can see only last frameOpencv 视频帧。我只能看到最后一帧
【发布时间】:2016-06-12 09:14:07
【问题描述】:
我想将视频保存在帧数组中。
我的视频有 250 帧。我正在尝试保存视频:
Mat array[250];
Mat frame;
VideoCapture inputVideo(filename);
int index=0;
while(inputVideo.read(frame))
{
array[index] = frame;
index++;
}
但这不起作用。
然后我尝试在计时器内播放我的视频,我只能看到视频的最后一帧。
array[250] 的任何元素都包含最后一帧。
【问题讨论】:
标签:
c++
opencv
video
timer
【解决方案1】:
你可以得到想要的结果
Mat array[250];
VideoCapture inputVideo(filename);
int index=0;
while(inputVideo.read( array[index] ))
{
index++;
}
或
Mat array[250];
Mat frame;
VideoCapture inputVideo(filename);
int index=0;
while(inputVideo.read(frame))
{
array[index] = frame.clone();
index++;
}