0

在这段代码中,我尝试打开相机,但我得到can't open cameraGStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed

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

using namespace std;

int main() {
    cv::Mat frame;
    cv::VideoCapture cap(0);
    if (!cap.isOpened()){
        cout << "can't open camera" << endl;
    }
}

但是当我尝试时在python中

import cv2 as cv
cap = cv.VideoCapture(0)
cap.read()

我成功打开了相框和相机!!!我应该怎么办?c++有什么问题?

4

0 回答 0