繁体   English   中英

在 Visual Studio 平台上使用 OpenCV C++ 时播放视频时出错

[英]Error playing video when using OpenCV C++ on a Visual Studio platform

我试图让它运行,但它没有做任何事情,没有显示错误并自动终止了程序。

#include"opencv2/core/core.hpp"
#include"opencv2/highgui/highgui.hpp"
#include"opencv2/imgproc/imgproc.hpp"
#include<stdio.h>
int main(int argc, char* argv)
{
    cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
    CvCapture* capture = cvCreateFileCapture("C:/Users/Nam/Pictures/YALQ6371.MP4");
    IplImage* frame;
    while (1){
        frame = cvQueryFrame(capture);
        if (!frame) break;
        cvShowImage("Example2", frame);
        char c = cvWaitKey(33);
        if (c == 27) break;
    }
    cvReleaseCapture(&capture);
    cvDestroyWindow("Example2");
    return 0;
}

尝试使用imshow而不是cvShowImage ,但不要忘记添加using namespace cv; 一开始。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM