Я работаю с OpenCV 2.4.9 MVSC ++ 2012 и QT, код работает отлично, когда камера подключена, но если камера отключается, код застрял по адресу vcap.open (videoStreamAdress)
Вот мой код < /p>
const string videoStreamAddress="rtsp://admin:[email protected]:88/live/h264/VGA";
VideoCapture vcap;
Mat image_input;
cameraOpen=true;
//first open the graphic widget to display the camera stream
ui.graphicsView->setEnabled(TRUE);
while ((vcap.open(videoStreamAddress)==true)&&(cameraOpen==true))
{
if(vcap.read(image_input)==false)
{
//QmessageBox
QMessageBox msgBox;
msgBox.setText("probleme de connexion a la caméra");
msgBox.exec();
//close_camera_feed();
break;
}
vcap.set(CV_CAP_PROP_FPS, 1);
//vcap.read(image_input);
qimage_input = QImage((const unsigned char*)(image_input.data),
image_input.cols,image_input.rows,
QImage::Format_RGB888).rgbSwapped();
image = QPixmap::fromImage(qimage_input);
scene = new QGraphicsScene(this);
scene->addPixmap(image);
scene->setSceneRect(image.rect());
ui.graphicsView->setScene(scene);
//to
qApp->processEvents();
//thread t1(task1, "Hello");
detect_license_plate(image_input);
}
if(vcap.open(videoStreamAddress)==false)
{
QMessageBox msgBox;
msgBox.setText("La Caméra est déconnecté, vérifier l'uinstallation");
msgBox.exec();
}
< /code>
Спасибо за вашу помощь в Advanced!
Подробнее здесь: https://stackoverflow.com/questions/511 ... sconnected
VideoCapture застряла, когда IP -камера отключена ⇐ C++
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение