Results 1 to 3 of 3

Thread: OpenCV 2.3.1 Integration

  1. #1
    Join Date
    Feb 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default OpenCV 2.3.1 Integration

    Followed these directions to integrate the new OpenCV:
    http://www.barbato.us/2011/12/20/ope...eator-windows/

    However, i'm getting errors
    error.jpg


    Qt Code:
    1. #include <iostream>
    2. #include <opencv2/opencv.hpp>
    3. //#include <opencv2/highgui/highgui.hpp>
    4. //#include <opencv2/core/core.hpp>
    5. #include <opencv/cv.h>
    6. #include <opencv/highgui.h>
    7.  
    8. using namespace cv;
    9.  
    10. int main(int, char**)
    11. {
    12. VideoCapture cap(0); // open the default camera
    13. if(!cap.isOpened()) // check if we succeeded
    14. return -1;
    15.  
    16. // the camera will be deinitialized automatically in VideoCapture destructor
    17. return 0;
    18. }
    To copy to clipboard, switch view to plain text mode 

  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: OpenCV 2.3.1 Integration

    Assuming you are using qmake (because otherwise nothing you posted here or here has anything to do with Qt) you need to fix the contents of your pro file LIBS variable to direct the linker to link the OpenCV librairy(-ies). See Declaring other libraries in the qmake manual.

  3. #3
    Join Date
    Feb 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: OpenCV 2.3.1 Integration

    I successfully got rid of all compiling errors by using this mingw include method. However, when I run any type of OpenCV example code nothing happens. I just get
    the black DOS window that says "Press <ENTER> to Closed this Window." There are also no errors in the QT Creator Application Output or the Compile Output but all the example codes just result in QT exiting with "code 0" in the output.
    Qt Code:
    1. INCLUDEPATH += C:\opencv\build\include \
    2.  
    3. LIBS += C:\opencv\build\x86\mingw\lib\libopencv_calib3d231.dll.a \
    4. C:\opencv\build\x86\mingw\lib\libopencv_contrib231.dll.a \
    5. C:\opencv\build\x86\mingw\lib\libopencv_core231.dll.a \
    6. C:\opencv\build\x86\mingw\lib\libopencv_features2d231.dll.a \
    7. C:\opencv\build\x86\mingw\lib\libopencv_flann231.dll.a \
    8. C:\opencv\build\x86\mingw\lib\libopencv_gpu231.dll.a \
    9. C:\opencv\build\x86\mingw\lib\libopencv_highgui231.dll.a \
    10. C:\opencv\build\x86\mingw\lib\libopencv_imgproc231.dll.a \
    11. C:\opencv\build\x86\mingw\lib\libopencv_legacy231.dll.a \
    12. C:\opencv\build\x86\mingw\lib\libopencv_ml231.dll.a \
    13. C:\opencv\build\x86\mingw\lib\libopencv_objdetect231.dll.a \
    14. C:\opencv\build\x86\mingw\lib\libopencv_video231.dll.a \
    To copy to clipboard, switch view to plain text mode 

    In my main.cpp file I have included these files below, however If i attempt to use Mat img = imread("file) at all I get whole bunch of CV related errors.
    snaps.jpg

    Qt Code:
    1. #include <iostream>
    2. #include <opencv2/opencv.hpp>
    3. #include <opencv/cv.h>
    4. #include <opencv/highgui.h>
    5. #include <opencv2/highgui/highgui.hpp>
    6. #include <opencv2/highgui/highgui_c.h>
    7. #include <opencv2/imgproc/imgproc.hpp>
    8. #include <iostream>
    9. #include <stdio.h>
    10. #include <stdlib.h>
    To copy to clipboard, switch view to plain text mode 
    Last edited by Aerowrx; 20th February 2012 at 11:36.

Similar Threads

  1. OpenCV integration
    By sfabel in forum Qt Programming
    Replies: 47
    Last Post: 28th January 2013, 05:19
  2. OpenCV integration with Qt creator
    By mind_freak in forum Qt Programming
    Replies: 11
    Last Post: 8th January 2013, 22:50
  3. Trying to use OpenCV
    By danilodsp in forum Newbie
    Replies: 6
    Last Post: 18th August 2011, 08:41
  4. OpenCV + QT integration
    By leoalvesmachado in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2010, 08:21
  5. Eclipse Integration sans Integration
    By ChrisW67 in forum Qt Tools
    Replies: 3
    Last Post: 17th March 2009, 07:29

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.