#include "mainwindow.h" #include #include #include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); //jMainWindow w; //w.show(); cv::Mat frame; //--- INITIALIZE VIDEOCAPTURE cv::VideoCapture cap; // open the default camera using default API // cap.open(0); // OR advance usage: select any API backend int deviceID = 0; // 0 = open default camera int apiID = cv::CAP_ANY; // 0 = autodetect default API // open selected camera using selected API cap.open(deviceID, apiID); // check if we succeeded if (!cap.isOpened()) { qDebug() << "ERROR! Unable to open camera"; return a.exec(); } qDebug() << "Camera Open !"; //--- GRAB AND WRITE LOOP qDebug() << "Start grabbing"; qDebug() << "Press any key to terminate"; //for (;;) //{ // wait for a new frame from camera and store it into 'frame' cap.read(frame); // check if we succeeded if (frame.empty()) { qDebug() << "ERROR! blank frame grabbed\n"; //break; } else { // show live and wait for a key with timeout long enough to show images imshow("Live", frame); // if (cv::waitKey(5) > = 0) //b break; qDebug() << "FLUX !!\n"; } // } // the camera will be deinitialized automatically in VideoCapture destructor return a.exec(); }