OpenCV 2.2: bad argument in unknown function, file ..\..\..\..\ocv\opencv\modules\core\src\array.cpp
i have the 开发者_Python百科above error when I'm trying to compile my code. Its a very very very simple function and I cant figure out why I have the problem. The worst is that i cant even find where array.cpp is in the opencv folder so i cant see whats wrong. Does anyone know? pls help!
int imgreg_capture_image()
{
/*********************Try capturing an image from the camera first*************************************/
CvCapture* imgregCapture = cvCaptureFromCAM( CV_CAP_ANY );
if ( !imgregCapture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
exit(-1);
}
// Get one frame
IplImage* frame = 0;
frame = cvQueryFrame(imgregCapture);
if ( !frame ) {
fprintf( stderr, "ERROR: frame is null...\n" );
return -1;
}
//save the image into a file
cvSaveImage( CAPTURE_FILE, frame );
// Release the capture device housekeeping
cvReleaseCapture(&imgregCapture);
cvReleaseImage(&frame);
return 0;
/***************Finish Try capturing an image from the camera first*************************************/
}
It is stated in the documentation that the images returned by cvQueryFrame
don't have to be released. In your case delete
cvReleaseImage(&frame);
The de/allocation of frame
is managed internally by the capturing device.
Hope that helps!
EDIT: If you wish to further process your image, use cvCopy(frame, yourManagedImage);
, and work with yourManagedImage
instead of the original frame
.
精彩评论