Skip to main content

Thread: Opencv take webcam snapshot problem!


that's code, have reading , writing permissions folder in executable running.
cannot figure out doing wrongly.....

please, see code:
code:
#include "opencv/cv.h" #include "opencv/highgui.h" #include <iostream> using namespace std;  int main() {    cvcapture* capture = cvcapturefromcam( cv_cap_any );    if ( !capture ) {      cerr << "couldn't capture!\n";      return 1;    }      // 1 frame      iplimage* frame = cvqueryframe( capture );      if ( !frame ) {         cerr << "couldn't capture!\n";         return 1;      }    cvreleasecapture( &capture );    cvsaveimage("test.jpg" ,frame);    return 0;  }
i get:
code:
opencv error: null pointer (the image has null data pointer) in cvgetmat, file /home/alex/opencv-2.1.0/src/cxcore/cxarray.cpp, line 2391  terminate called after throwing instance of 'cv::exception'    what():  /home/alex/opencv-2.1.0/src/cxcore/cxarray.cpp:2391: error: (-27) image has null data pointer in function cvgetmat    the program has unexpectedly finished.

its bump


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] Opencv take webcam snapshot problem!


Ubuntu

Comments