在这段用c ++的代码中,我尝试打开相机,但我得到了can't open camera
和GStreamer-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 ++有什么问题?