Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. How to install openCv in Qt

How to install openCv in Qt

Scheduled Pinned Locked Moved Solved 3rd Party Software
opencvqt 5.4.0path
16 Posts 2 Posters 6.6k 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.
  • T Offline
    T Offline
    Trav
    wrote on 15 May 2016, 22:14 last edited by
    #3

    Im using he backslashes just essentially replaced what I had above ****** LIBS += -L\usr\local\lib
    -lopencv_core
    -lopencv_imgproc
    -lopencv_features2d
    -lopencv_highgui

    But still am having difficulties is there something I'm missing here? I am using Mac OSX... and have accomplished this is Xcode but just doesn't seem to be working is there anything else to configure etc?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 16 May 2016, 20:23 last edited by
      #4

      I meant: use backslashes when marking a new line. For the paths themselves use forward slashes.

      What error are you getting ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Trav
        wrote on 17 May 2016, 04:15 last edited by
        #5

        @Trav said:

        LIBS += -L/usr/local/lib
        -lopencv_core /
        -lopencv_imgproc /
        -lopencv_features2d/
        -lopencv_highgui

        2 days ago

        sorry for the wait... all I'm getting is opencv.cpp not found... is there solid documentation somewhere on this subject? thank you

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 17 May 2016, 06:50 last edited by
          #6

          opencv.cpp not found ? Where's that file coming from ?

          Not knowing what your current error relates to I can't give you any recommendation.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Trav
            wrote on 17 May 2016, 23:09 last edited by
            #7

            The actual file itself 'openCV ' is located on my desktop... I made a file 'build' inside the folder and then 'lib' where all the files are located ; highgui etc. Is there a crucial step I missed here ? I mean I downloaded openCV installed Cmake by following a tutorial and installed this perfectly fine in Xcode.. But since moving to Qt I have not been able to get the same results.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              Trav
              wrote on 18 May 2016, 00:23 last edited by
              #8

              Could you please tell me in your case how would you do this if you were using Mac assuming we have Qt installed and openCV...

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 18 May 2016, 06:30 last edited by
                #9

                There are several possibilities.

                You can use pkg-config or do it like you do currently and provide the INCLUDEPATH and LIBS with the adequate data.

                Can you share your complete .pro file ? From the bits you've given, one time you have used the wrong line ending char and the other you are complete missing it.

                Example:

                LIBS += \
                    -L/usr/local/lib \
                    -lopencv_core \
                    -lopencv_highgui
                
                INCLUDEPATH += \
                    /usr/local/include 
                

                You should also post the exact error you are having.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  Trav
                  wrote on 19 May 2016, 04:47 last edited by
                  #10

                  Yes please see bottom for code. If it at all has changed I have been modifying it and tuning it according to different tutorials to see if it'll work etc. But essentially the end result is the same ERROR: opencv.h not found' when using ' #include <opencv.h> or something similar; highgui, core ...

                  #-------------------------------------------------

                  Project created by QtCreator 2016-05-15T23:16:25

                  #-------------------------------------------------

                  QT += core gui

                  greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                  TARGET = cam
                  TEMPLATE = app

                  // new
                  QT += core
                  QT -= gui

                  TARGET = RP_openCV_01
                  CONFIG += console
                  CONFIG -= app_bundle

                  TEMPLATE = app

                  SOURCES += main.cpp
                  mainwindow.cpp

                  LIBS += -L/opt/local/lib
                  -lopencv_highgui.3.1.0
                  -lopencv_core.3.1.0

                  INCLUDEPATH += /opt/local/include

                  HEADERS += mainwindow.h

                  FORMS += mainwindow.ui

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    Trav
                    wrote on 19 May 2016, 04:54 last edited by
                    #11

                    Only error is the error that is indicating the header files are not found " OPENCV.H not found!'

                    QT += core gui

                    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                    TARGET = cam
                    TEMPLATE = app

                    // new
                    QT += core
                    QT -= gui

                    TARGET = RP_openCV_01
                    CONFIG += console
                    CONFIG -= app_bundle

                    TEMPLATE = app

                    SOURCES += main.cpp
                    mainwindow.cpp

                    LIBS += -L/opt/local/lib
                    -lopencv_highgui.3.1.0
                    -lopencv_core.3.1.0

                    INCLUDEPATH += /opt/local/include

                    HEADERS += mainwindow.h

                    FORMS += mainwindow.ui

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 19 May 2016, 21:26 last edited by
                      #12

                      Shouldn't it be #include <opencv2/opencv.hpp> ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        Trav
                        wrote on 20 May 2016, 02:17 last edited by
                        #13

                        Sorry, yes; I have used the #include <opencv2/opencv.hpp> and the error I stated above is still valid

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 20 May 2016, 06:55 last edited by
                          #14

                          Do you mean the opencv.h not found error ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            Trav
                            wrote on 21 May 2016, 21:57 last edited by
                            #15

                            Hey, thanks for your help I actually got it and have reproduced the desired outcome... essentially what happened because I am new to Qt & OpenCV etc. It seems I have placed the code before Sources' in the project.pro file which produced the errors... I did this before as well I don't quite understand why it decides to work now but did not before? but essentially I'm good :) thanks for support

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 21 May 2016, 22:20 last edited by
                              #16

                              Good !

                              In that case, please mark the thread as solved using the "Topic Tool" button so that other forum users may know a solution has been found :)

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0

                              12/16

                              19 May 2016, 21:26

                              • Login

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