#include
using namespace cv;
int main()
{
VideoCapture capture(0);
while(1)
{
Mat frame;
capture >> frame;
imshow("读取视频帧",frame);
waitKey(30);
}
system("pause");
return 0;
}
出现的报错:[ WARN:0@10.284] global /home/lzx/图片/opencv-4.5.5/opencv-4.5.5/modules/videoio/src/cap_v4l.cpp (1000) tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.5.5) /home/lzx/图片/opencv-4.5.5/opencv-4.5.5/modules/core/src/array.cpp:2494: error: (-206:Bad flag (parameter or structure field)) Unrecognized or unsupported array type in function 'cvGetMat'
请问这是为什么呢?
这个错误消息表明在函数 cvGetMat 中遇到了无法识别或不支持的数组类型。这可能是因为数组的类型与函数不兼容,或者数组的类型在当前环境中没有被定义。如果您知道数组的类型是什么,则可能需要将其与 cvGetMat 函数进行比较,以确定是否存在不兼容之处。此外,您可能需要确保您的环境中定义了所有必需的数组类型。