|
Re: camera / cvRetrieveFrame problem: msg#01177lib.opencv
Hi Helge, For the second problem: motion is not a copy of image. From the documentation: int origin; /* 0 - top-left origin, 1 - bottom-left origin (Windows bitmaps style) */ So setting the origin has nothing to do with copying. Use cvCopy(src, dst, mask) for copying. For the first problem I cannot help you, sorry. The code looks ok, maybe you can try providing the correct videodevice instead of -1. But I'm not sure. Regards, Marco helge.stahlmann wrote: > 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 > > Yahoo! Groups Links > > > > > > > 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: | Re: newbie running under windows xp, cxcore097.dll not found error: 01177, frank lamosa |
|---|---|
| Next by Date: | Re: Save Mutiple Faces: 01177, Marco Kunze |
| Previous by Thread: | camera / cvRetrieveFrame problemi: 01177, helge.stahlmann |
| Next by Thread: | recompile sources??: 01177, alexa2g |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |