用opencv人脸识别的代码,为什么在Size里面的第一个capture会报错呢

人脸识别的代码,为什么在Size里面的第一个capture会报错呢

#include<opencv2/opencv.hpp>
#include<iostream>

using namespace cv;
using namespace std;

int main()
{
    VideoCapture(0);//打开摄像头
    Size S = Size((int)capture.get(CAP_PROP_FRAME_HEIGHT),(int)capture.get(CAP_PROP_FRAME_WIDTH));
    int fps = capture.get(CAP_PROP_FPS);

    waitKey(0);
    return 0;
}

img

你的 VideoCapture(0);定义capture变量在哪里?这应该写
VideoCapture capture(0);才对吧
另外Size的参数是Size(W,H),像你这么写变成Size(H,W)了