【发布时间】:2023-04-06 02:29:01
【问题描述】:
我正在尝试从相机读取单帧,但它挂起我的程序并使 imshow 窗口 没有响应,所以知道如何读取单帧以便我的视觉模块可以处理它 p>
这是我的代码:
cv::VideoCapture VideoCapture;
// Frame read from Camera will be stored in CamFrame MAT
cv::Mat CamFrame;
// Open camera
VideoCapture.open(0);
if(!VideoCapture.isOpened()) // Check if we succeeded
{
with for loop it not hang the imshow model
// for (;;){
// Read frame from Camera
VideoCapture.read(this->CamFrame);
// check if we succeeded
if (this->CamFrame.empty()) {
qDebug() << "ERROR! blank frame grabbed\n";
break;
}
cv::imshow("live frame ",this->CamFrame);
// }
}
【问题讨论】: