hakermania
June 2nd, 2011, 01:25 PM
That's the code, I have reading and writing permissions to the folder in which the executable is running.
I cannot figure out what I am doing wrongly.....
Please, see the 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;
}
// Get one frame
IplImage* frame = cvQueryFrame( capture );
if ( !frame ) {
cerr << "Couldn't capture!\n";
return 1;
}
cvReleaseCapture( &capture );
cvSaveImage("test.jpg" ,frame);
return 0;
}I get:
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 an instance of 'cv::Exception'
what(): /home/alex/OpenCV-2.1.0/src/cxcore/cxarray.cpp:2391: error: (-27) The image has NULL data pointer in function cvGetMat
The program has unexpectedly finished.
I cannot figure out what I am doing wrongly.....
Please, see the 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;
}
// Get one frame
IplImage* frame = cvQueryFrame( capture );
if ( !frame ) {
cerr << "Couldn't capture!\n";
return 1;
}
cvReleaseCapture( &capture );
cvSaveImage("test.jpg" ,frame);
return 0;
}I get:
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 an instance of 'cv::Exception'
what(): /home/alex/OpenCV-2.1.0/src/cxcore/cxarray.cpp:2391: error: (-27) The image has NULL data pointer in function cvGetMat
The program has unexpectedly finished.