Results 1 to 6 of 6

Thread: How to capture Video with OpenCV

  1. #1
    Join Date
    Apr 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question How to capture Video with OpenCV

    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?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,391
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to capture Video with OpenCV

    Did you look into the source code - line 13 in file ..\QtOpenCV\main.cpp ?

  3. #3
    Join Date
    Apr 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to capture Video with OpenCV

    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.

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,391
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to capture Video with OpenCV

    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 ?

  5. #5
    Join Date
    Mar 2011
    Posts
    118
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to capture Video with OpenCV

    Why are you want to use OpenCV (for capturing image or video)?
    If you want to capture image

    Qt Code:
    1. CvCapture *capture = 0;
    2. IplImage *frame = 0;
    3. capture = cvCaptureFromCAM( 0 );
    4. frame = cvQueryFrame( capture );
    To copy to clipboard, switch view to plain text mode 

    In frame you get all the data of image.

  6. #6
    Join Date
    Nov 2009
    Posts
    29
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to capture Video with OpenCV

    Hi,

    Make sure your webcam is connected and working.

    I made it work using

    Qt Code:
    1. CvCapture * camera = cvCreateCameraCapture(0);
    To copy to clipboard, switch view to plain text mode 

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

Similar Threads

  1. Webcam Video Capture
    By bajoelkid12 in forum Qt Programming
    Replies: 28
    Last Post: 25th December 2011, 03:28
  2. Qt Gui with OpenCV video and buttons
    By marcusbarnet in forum Qt Programming
    Replies: 3
    Last Post: 20th May 2011, 08:48
  3. v4l2 video capture input in Phonon
    By abbot in forum Qt Programming
    Replies: 6
    Last Post: 16th February 2011, 10:31
  4. capture video from DV camera
    By ekkondela in forum Newbie
    Replies: 1
    Last Post: 7th March 2010, 09:38
  5. Replies: 3
    Last Post: 5th July 2009, 17:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.