Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to correctly add an OpenCV build to a QT application
Forum Updated to NodeBB v4.3 + New Features

How to correctly add an OpenCV build to a QT application

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 415 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikeitexpert
    wrote on last edited by mikeitexpert
    #1

    I am compiling a Qt Quick QML project with opencv 4.0 used in it on Unbuntu 18.

    I build the opencv 4 from source.

    I also have an OpenCv 3.2 installed from ubuntu's repository.

    To ensure it is actually using Opencv 4.0 I created an opencv.pri file as below:

    INCLUDEPATH += -I/home/mike/opencv-4.0.1/
    LIBS += -L/home/mike/opencv-4.0.1/build -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_videoio -lopencv_video
    

    But if I remove "-L/home/mike/opencv-4.0.1/build" from above the code still compiles.

    Does that mean it is using OpenCv 4 headers/includes and libraries from Opencv 3.2.

    How else QT looks for libraries directory?

    Thank you

    aha_1980A 1 Reply Last reply
    0
    • M mikeitexpert

      I am compiling a Qt Quick QML project with opencv 4.0 used in it on Unbuntu 18.

      I build the opencv 4 from source.

      I also have an OpenCv 3.2 installed from ubuntu's repository.

      To ensure it is actually using Opencv 4.0 I created an opencv.pri file as below:

      INCLUDEPATH += -I/home/mike/opencv-4.0.1/
      LIBS += -L/home/mike/opencv-4.0.1/build -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_videoio -lopencv_video
      

      But if I remove "-L/home/mike/opencv-4.0.1/build" from above the code still compiles.

      Does that mean it is using OpenCv 4 headers/includes and libraries from Opencv 3.2.

      How else QT looks for libraries directory?

      Thank you

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by aha_1980
      #2

      hi @mikeitexpert,

      How else QT looks for libraries directory?

      Qt (and not QT, that is QuickTime) doesn't look for directories. It's the Linker doing that, and linking on Linux is complicated.*) You can google that up, there are multiple fallbacks taken in account when doing that.

      Does that mean it is using OpenCv 4 headers/includes and libraries from Opencv 3.2.

      Most likely, yes.

      Regards

      *) Well, on Windows it's not better, hence called the DLL hell. Good libraries are therefore versioned (like Qt)

      Qt has to stay free or it will die.

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved