Results 1 to 4 of 4

Thread: opencv2.2 webcam

  1. #1
    Join Date
    Aug 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default opencv2.2 webcam

    Good day, I'm desperate.
    Initially intended to do a QT application that uses a webcam, then after a google search I found the opencv.

    But the opencv only has given me problems. Already missed 5 days this
    3 days only, to integrate in QTCREATOR, i.e. I started with the opencv 2.3 but as not managed to integrate there found a site explaining how to integrate the opencv 2.2 in qtcreator
    I used this site:

    http://www.barbato.us/2011/03/18/usi...-in-windows-2/

    Exceeded the pace of integration. I investigated using the webcam and found the following code:


    QMessageBox msgBox;
    CvCapture* capture = NULL;
    if ((capture = cvCreateCameraCapture( -1 )) == NULL)
    {
    msgBox.setText( "Cannot open initialize webcam!\n" );
    msgBox.exec();

    return ;
    }

    cvNamedWindow("mywindow", CV_WINDOW_AUTOSIZE);

    cvQueryFrame(capture); // Sometimes needed to get correct data

    while (1)
    {
    IplImage* frame = cvQueryFrame(capture); // check return
    {
    msgBox.setText( "ERROR: cvQueryFrame failed\n");
    msgBox.exec();

    break;
    }

    cvShowImage("mywindow", frame); // Do not release the frame!

    int key = cvWaitKey(10);
    if (key == 0x1b)
    break;
    }

    cvReleaseCapture(&capture);
    cvDestroyWindow("mywindow");



    The problem with the above code is that it appears only a gray screen, and has exprimentei almost everything I found on the internet. AND
    still made a guest appearance a gray screen, and the more serious is that the gray screen appears only once, that is, when I run the program for the second time gives me "cannot open initialize webcam". And the first time that work appears "ERROR: cvQueryFrame failed"


    My webcam is working well, as I experienced with SKYPE and MSN. And already tried -1. .2 in cvCreateCameraCapture (or cvCaptureFromCAM) and nothing.


    I don't know if installed correctly the opencv 2.2 in qtcreator but I think Yes, but the opencv does not work go to DIRECTSHOW .... I chose the opencv for the program can function
    on any Windows operating system regardless if it is xp, vista, 7

    I use Qt Creator 2.2.1
    Qt 4.7.4
    Opencv2.2.0
    Windows 7, but i want to work in XP AND VISTA

  2. #2
    Join Date
    Aug 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: opencv2.2 webcam

    Someone can tell me how can I configure qtcreator with DirectShow?
    I need to create a class that captures webcam and places it in a QLABEL, does anyone know how can I do this?

  3. #3
    Join Date
    Aug 2011
    Location
    Seoul, Korea
    Posts
    46
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: opencv2.2 webcam

    Quote Originally Posted by afro_cv View Post
    Someone can tell me how can I configure qtcreator with DirectShow?
    I need to create a class that captures webcam and places it in a QLABEL, does anyone know how can I do this?
    http://doc.trolltech.com/4.7/widgets-imageviewer.html
    The above shows how to make a QLabel as an image but it seems this is not the first think you need to implement. I guess as long as you can convert your image captured from webcam into some sort of Qt compatible format then you can do anything you want really. The following one was quite helpful for me. That's showing how to convert cv::Mat to OpenCV.

    http://opencv-users.1802565.n2.nabbl...td5121181.html

    It may also be helpful if you try to ask on OpenCV user group.

    Regards,
    Dong Back Kim

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

    Default Re: opencv2.2 webcam

    I need to create a class that captures webcam and places it in a QLABEL, does anyone know how can I do this?
    http://www.qtcentre.org/threads/4305...simple-example

Similar Threads

  1. Record from webcam
    By skizzik in forum General Programming
    Replies: 11
    Last Post: 1st August 2011, 11:00
  2. OpenCV2.1 and Qt 4.7.4 integration
    By nackasha in forum Newbie
    Replies: 1
    Last Post: 21st July 2011, 00:31
  3. How can I access webcam in Qt?
    By tofighi in forum Newbie
    Replies: 3
    Last Post: 17th July 2011, 21:55
  4. Replies: 0
    Last Post: 12th March 2011, 20:46
  5. use Webcam
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 21st August 2007, 08:52

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.