PDA

View Full Version : How to capture Video with OpenCV



CCDamon
16th June 2011, 10:45
Hi everyone,

I'm newbie in Qt as well as OpenCV,
I have download the source code from
http://qt-apps.org/content/show.php/...?content=89995,
and execute this program,
it shows an " Assertion failed! "
and say:
Program:....
File: ..\QtOpenCV\main.cpp
Line:13
Expression: camera
For information on how your program can cause an assertion failure,
see the Visual C++ documentation on asserts
(Press Retry to debug the application - JIT must be enabled)

http://www.freewebtown.com/ccdamon/Fail.jpg

I don't know how to solve the problem, could you help me?

stampede
16th June 2011, 11:39
Did you look into the source code - line 13 in file ..\QtOpenCV\main.cpp ?

CCDamon
16th June 2011, 14:51
I've looking into the source code ,
In the line 13, it seems a function which called " assert " ,and has an argument ( camera ).

In addition, I found that the header file which called " assert.h " was added in include file.
The path of the header file is C:\Qt\2010.05\mingw\include.

Please help me to solve the problem.

stampede
16th June 2011, 14:54
This function "assert" causes the program to terminate if assert's argument is 0, so it looks like "camera == 0". Show the code.
Btw. do you have a working camera on your machine ?

bibhukalyana
16th June 2011, 15:03
Why are you want to use OpenCV (for capturing image or video)?
If you want to capture image



CvCapture *capture = 0;
IplImage *frame = 0;
capture = cvCaptureFromCAM( 0 );
frame = cvQueryFrame( capture );


In frame you get all the data of image.

rdelgado
17th June 2011, 14:18
Hi,

Make sure your webcam is connected and working.

I made it work using



CvCapture * camera = cvCreateCameraCapture(0);


If argument 0 does not work, try with 1, and so on.