C++ native code used with QT hangs at capture.grab()

asked 2014-09-01 12:42:42 -0500

sumitsrv gravatar image

Hi,

Created an Android app using OpenCV and QT. The call of method "grab" or "read" of VideoCapture object freezes the further execution of code. Nothing happens after that.

Note: Consider all required header files included. The code works perfectly on Desktop (Linux)

int main(int argc, char *argv[]) {

QApplication app(argc,argv);
qDebug() << "CP 1";
Ptr<VideoCapture> capture;
capture = new VideoCapture(CV_CAP_ANDROID_FRONT);
if(capture->isOpened())
    qDebug() << "CP 1.11";
Mat img;
capture->read(img); // **code doesn't moves ahead of this point**
Mat gray;
Mat prev;
Mat diff;
cvtColor(img, prev, CV_BGR2GRAY);

}

edit retag flag offensive close merge delete