Results 1 to 6 of 6

Thread: Using external dll in Qt [OpenCV]

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Location
    Warsaw,Poland
    Posts
    17
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using external dll in Qt [OpenCV]

    OpenCV DLL's are placed only in PATH environment variable, I mean:
    Qt Code:
    1. C:\Programs\OpenCV-2.4.2\mybuildmingw\install\bin
    To copy to clipboard, switch view to plain text mode 
    I added this line too:
    Qt Code:
    1. C:\Programs\OpenCV-2.4.2\mybuildmingw\install\lib
    To copy to clipboard, switch view to plain text mode 
    Where "mybuildmingw" is folder with complied OpenCV files with MinGW.

    And in *.pro file I have:
    Qt Code:
    1. INCLUDEPATH += C:/Programy/OpenCV-2.4.2/mybuildmingw/install/include
    2.  
    3. LIBS += -LC:/Programy/OpenCV-2.4.2/mybuildmingw/install/bin -llibopencv_highgui242
    4. LIBS += -LC:/Programy/OpenCV-2.4.2/mybuildmingw/install/lib -llibopencv_highgui242
    To copy to clipboard, switch view to plain text mode 

    So, that was what are you talking about?

    ================================================== =========================
    EDIT:
    I've solved the problem, but it's the most weirdest thing I've ever meet in programming... I have nothing connected with OpenCV in PATH environment variable and my *.pro file is:
    Qt Code:
    1. INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include
    2. INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include/opencv
    3.  
    4. LIBS += -LC:/Programs/OpenCV-2.4.2/mybuild/lib/Debug -lopencv_highgui242d \
    5. -lopencv_core242d
    To copy to clipboard, switch view to plain text mode 

    So: "mybuildmingw" is folder with compiled OpenCV files with MinGW and "mybuild" is folder with compiled OpenCV files with MVSC+... Include files Qt takes from MinGW build and lib's from MVSC+ build. It's so weird, but it's working!

    Qt Code:
    1. #include <opencv2/core/core.hpp>
    2. #include <opencv2/imgproc/imgproc.hpp>
    3. #include <opencv2/highgui/highgui.hpp>
    4. ...
    5. IplImage* img = cvLoadImage( "C:\\opencv.png" );
    6. cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
    7. cvShowImage("Example1", img);
    8. cvWaitKey(0);
    To copy to clipboard, switch view to plain text mode 

    ================================================== =========================
    EDIT2:

    It's not so simple as I thought. I have another linker problem:

    Qt Code:
    1. #include <opencv2/core/core.hpp>
    2. #include <opencv2/imgproc/imgproc.hpp>
    3. #include <opencv2/highgui/highgui.hpp>
    4. ...
    5. IplImage* img = cvLoadImage( "C:\\opencv.png" );
    6. cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
    7. cvShowImage("Example1", img);
    8. cvWaitKey(0);
    9.  
    10. cv::VideoCapture capture(0);
    To copy to clipboard, switch view to plain text mode 

    And *.pro:
    Qt Code:
    1. INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include
    2. INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include/opencv
    3.  
    4. LIBS += -LC:/Programs/OpenCV-2.4.2/mybuild/lib/Debug \
    5. -lopencv_calib3d242d \
    6. -lopencv_contrib242d \
    7. -lopencv_core242d \
    8. -lopencv_features2d242d \
    9. -lopencv_flann242d \
    10. -lopencv_gpu242d \
    11. -lopencv_haartraining_engined \
    12. -lopencv_highgui242d \
    13. -lopencv_imgproc242d \
    14. -lopencv_legacy242d \
    15. -lopencv_ml242d \
    16. -lopencv_nonfree242d \
    17. -lopencv_objdetect242d \
    18. -lopencv_photo242d \
    19. -lopencv_stitching242d \
    20. -lopencv_ts242d \
    21. -lopencv_video242d \
    22. -lopencv_videostab242d
    To copy to clipboard, switch view to plain text mode 

    And error occurs:
    Qt Code:
    1. (...) undefined reference to `cv::VideoCapture::VideoCapture(int)'
    2. (...) undefined reference to `cv::VideoCapture::~VideoCapture()'
    3. collect2: ld returned 1 exit status
    To copy to clipboard, switch view to plain text mode 

    Any ideas?
    Last edited by danioto; 29th October 2012 at 01:39.

Similar Threads

  1. OpenCV + QT4
    By thereisnoknife in forum Qt Programming
    Replies: 6
    Last Post: 8th March 2013, 05:19
  2. OpenCV on mac
    By sandeep_hyd123 in forum Newbie
    Replies: 1
    Last Post: 17th June 2011, 04:53
  3. opencv-qt-mac
    By ireneluis in forum Qt Programming
    Replies: 0
    Last Post: 16th March 2010, 15:24
  4. JAI vs. OpenCV vs. ITK
    By tpieciak in forum General Programming
    Replies: 0
    Last Post: 8th July 2009, 13:45
  5. OpenCv + Qt
    By Janderson Borges in forum Qt Programming
    Replies: 3
    Last Post: 2nd December 2008, 13:01

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
  •  
Qt is a trademark of The Qt Company.