Results 1 to 2 of 2

Thread: How to use the webcam available on my laptop in my application?

  1. #1
    Join Date
    Jul 2013
    Posts
    1

    Default How to use the webcam available on my laptop in my application?

    I'm trying to use my webcam (in Qt) using OpenCv library. I get an error for this code:

    #include "mainwindow.h"
    #include <QApplication>
    #include <QLabel>
    #include <opencv2/opencv.hpp>
    #include <opencv/cv.h>
    #include <QtWidgets>
    #include <QImage>

    int main(int argc, char *argv[])
    {
    cv::VideoCapture camera;
    camera.open(1);
    }

    saying

    /home/darshan/AindraDesktopApp/main.cpp:27: error: undefined reference to `cv::VideoCapture::VideoCapture()'
    /home/darshan/AindraDesktopApp/main.cpp:28: error: undefined reference to `cv::VideoCapture:pen(int)'
    /home/darshan/AindraDesktopApp/main.cpp:30: error: undefined reference to `cv::VideoCapture::~VideoCapture()'
    /home/darshan/AindraDesktopApp/main.cpp:30: error: undefined reference to `cv::VideoCapture::~VideoCapture()'
    collect2: error: collect2: error: ld returned 1 exit status

    What should I do? Or rather, how do I make use use of my laptop's webcam?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to use the webcam available on my laptop in my application?

    Link the correct OpenCV libraries into your application and these linker errors will go away. This has very little to do with Qt.

Similar Threads

  1. UI file showing different in desktop and laptop ..
    By riarioriu3 in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2012, 10:44
  2. Application is fully functional ONLY on my laptop
    By juracist in forum Installation and Deployment
    Replies: 17
    Last Post: 24th June 2012, 23:58
  3. installing and configuring Qt on a laptop running Ubuntu 12.04
    By modoMojo in forum Installation and Deployment
    Replies: 5
    Last Post: 20th June 2012, 09:29
  4. problem using qt mobility with my laptop camera
    By eyaler in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 27th May 2012, 18:40
  5. Replies: 0
    Last Post: 31st March 2011, 18:50

Tags for this Thread

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.