|
camera / cvRetrieveFrame problem: msg#01175lib.opencv
Hi, It seems there is an error in the following code example, but I don't know where to start searching. Maybe one of you could be so kind to help me finding the bug. - - - - - - - - - - - - #include <stdafx.h> #include "cv.h" #include "highgui.h" #include "cvcam.h" #include "cxcore.h" #include <time.h> #include <math.h> #include <ctype.h> int main(int argc, char* argv[]) { CvCapture* capture; int cameraSelected = -1; capture = cvCaptureFromCAM(cameraSelected); // capture = cvCaptureFromAVI("office101.avi"); cvWaitKey(0); if( capture ) { IplImage* motion = 0; cvNamedWindow( "Motion", CV_WINDOW_AUTOSIZE ); for(;;) { IplImage* image = 0; if( !cvGrabFrame( capture )) break; image = cvRetrieveFrame( capture ); if( image ) { if( !motion ) { motion = cvCreateImage(cvSize(image->width,image->height), 8, 3 ); cvZero( motion ); motion->origin = image->origin; } } cvShowImage( "Motion", image ); if( cvWaitKey(10) >= 0 ) break; } cvReleaseCapture( &capture ); cvDestroyWindow( "Motion" ); } return 0; } - - - - - - - - - - - First problem: On execution, the camera gets initialized the motion frame opens but it doesn't show any images. No exceptions, no error messages. The usb webcam works fine using cvcam (cvcamInit(), cvcamStart(),...). While stepping through the code, I found out that cvRetrieveFrame(capture) doesn't return any image, but I don't understand why. Second problem: I tried the same example with cvCaptureFromAVI instead of cvCaptureFormCAM with an example video from openAVCSR which works fine, but only if I use cvShowImage( "Motion", image ) instead of cvShowImage( "Motion", motion ). That seems strange to me as motion is just a copy of the image. Any help would be appreciated. Helge Change settings: http://www.yahoogroups.com/mygroups, select Get Emails (get all posts) Daily Digest (one summary email per day) Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCV-unsubscribe@xxxxxxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | thanks: 01175, maher ghanem |
|---|---|
| Next by Date: | Re: newbie running under windows xp, cxcore097.dll not found error: 01175, frank lamosa |
| Previous by Thread: | thanksi: 01175, maher ghanem |
| Next by Thread: | Re: camera / cvRetrieveFrame problem: 01175, Marco Kunze |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |