</pre><pre name="code" class="cpp">void MainWindow::opencamera() { QCamera *cam = new QCamera(this); if(!cam->isAvailable()){ QMessageBox::warning(this,"Warning","Cameras are not found."); return; } cam_1 = cvCreateCameraCapture(0); cam_2 = cvCreateCameraCapture(1); cameraWidth = cvGetCaptureProperty(cam_1,3); cameraHeight = cvGetCaptureProperty(cam_1,4); timer->start(30); if(cam_1&&cam_2){ cameraOpened = true; } else cameraOpened = false; } void MainWindow::readfarme() { frame_1 = cvQueryFrame(cam_1); frame_2 = cvQueryFrame(cam_2); QImage image_1 = QImage((const uchar*)frame_1->imageData, frame_1->width, frame_1->height, QImage::Format_RGB888).rgbSwapped(); QImage image_2 = QImage((const uchar*)frame
Qt环境下利用OpenCV采集摄像头图像并保存
最新推荐文章于 2023-07-06 17:23:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)