【问题标题】: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++;
    }
    

    【讨论】:

    • 谢谢。惊人的。这很容易。
    猜你喜欢
    • 1970-01-01
    • 2013-05-29
    • 2012-11-27
    • 2021-12-03
    • 1970-01-01
    • 1970-01-01
    • 2019-12-31
    • 2013-05-08
    • 1970-01-01
    相关资源
    最近更新 更多