Friday, 15 March 2013

c++ - show a video from a file in opencv -


I am trying to open a video (.avi) from a file, read frames from frame and show them in a window. I have seen the stack overflow and I've got some interesting code, but each one of them blows up your program and I do not know why I used this code:
  Int main (int argc, const char ** argv) {cvcapture * capture = 0; String inputname = "c: \\ user \\ cristina \\ video \\ Capture_me.avi"; Capture = cvcapturframaev (InputName CIT) ()); If (! Capture) {cout & lt; & Lt; "Capture from AVI did not work" & lt; & Lt; Endl; } Else {cvNamedWindow ("Result", CV_WINDOW_AUTOSIZE); Cout & lt; & Lt; "Capture ..." & lt; & Lt; Endl; IplImage * currFrame = cvQueryFrame (Capture); IplImage * prevFrame = cvCloneImage (currFrame); While (croframe = sewTyFreme (capture)) {if (! Curryframe) break; CvShowImage ("Results", Curfew); CVCCP (CurryFam, Preframe); } Waiting (0); CvReleaseCapture (and Capture); CvReleaseImage (& amp; currFrame); CvDestroyWindow ("Result"); } Return 0; }   

While loop throws condition: 0xc0000005: 0x0000000066E538C6 (opencv_ffmpeg245_64.dll) exception under action FaceDetection.exe. Access violation reading location 0x0000000002EF1000

I have the same program also tried but with this loop:

  while (cvGrabFrame (capture)) {if (! CurrFrame) Break; CvShowImage ("Results", Curfew); CVCCP (CurryFam, Preframe); CurrFrame = cvRetrieveFrame (capture); }   

This is the second while loop throws an exception condition "currFrame = cvRetrieveFrame (capture),": 0xc0000005: 0x0000000066E538C6 (opencv_ffmpeg245_64.dll) access exception at action FaceDetection.exe violations location 0x0000000003011000 reading

Please help someone understand what I have wrong with these codes and I do them exactly how. Thanks !! After

I think it is a question. The main point is that you are having problems connecting that an unstable version of OpenCV can be used. Return to the previous version of OpenCV and check whether it works or not. Hope it helps!

No comments:

Post a Comment