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. Problem qith OpenCV and Qt creator

Problem qith OpenCV and Qt creator

Scheduled Pinned Locked Moved General and Desktop
19 Posts 4 Posters 9.6k Views 2 Watching
  • 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.
  • A Offline
    A Offline
    AlbertoAlegria
    wrote on last edited by
    #5

    Ok, thanks, about linking wuth opencv, can you help me? thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #6

      What is the exact error you are 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
      • A Offline
        A Offline
        AlbertoAlegria
        wrote on last edited by
        #7

        I cant compile my OpenCV program in Qt, i post my OpenCV code and my .pro file. I dont know exactly waths happenned, I'm new in Qt, but in OpenCV I have a little bit more experience

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #8

          What error does your compiler give you ?

          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
          • B Offline
            B Offline
            burdos
            wrote on last edited by
            #9

            i have a problem I just downloaded the qt and also I want to use the opencv but I can't because it says
            #-------------------------------------------------

            Project created by QtCreator 2014-04-02T02:57:55

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

            QT += core gui

            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

            TARGET = JanelaOpenCv
            TEMPLATE = app
            LIBS += -lopencv_core
            -lopencv_highgui
            SOURCES += main.cpp
            mainwindow.cpp

            HEADERS += mainwindow.h

            FORMS += mainwindow.ui
            it says that they cannot find the libraries I do not know how to kink them or how to start working with it thanks

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #10

              If OpenCV is not installed in a known path, you need to tell Qt where to find it.

              Add
              @LIBS += -L/path/to/OpenCV/libraries@

              To your pro file

              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
              • B Offline
                B Offline
                burdos
                wrote on last edited by
                #11

                ok fine i did this
                #-------------------------------------------------

                Project created by QtCreator 2014-04-02T13:24:58

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

                QT += core

                QT -= gui

                TARGET = Consola
                CONFIG += console
                CONFIG -= app_bundle
                LIBS += -L/path/to/OpenCV/libraries
                TEMPLATE = app

                SOURCES += main.cp

                i have my openCv in the following path so how do i have to do set it to start using it
                the path is the following
                E:\Open Cv\opencv\build\x86\vc12\lib
                so please help me how to do it i am new on it

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  @LIBS += -LE:/OpenCV/opencv/build/x86/vc12/lib@

                  Forward slashes and avoid spaces in the path, it's known to be problematic

                  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
                  • B Offline
                    B Offline
                    burdos
                    wrote on last edited by
                    #13

                    Oh ok thanks for the help so it runs now very well so it means that all the libraries in the folder can be used right??

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #14

                      Yes it is right

                      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
                      • B Offline
                        B Offline
                        burdos
                        wrote on last edited by
                        #15

                        i am trying to do run my code in this way
                        //objectTrackingTutorial.cpp

                        //Written by Kyle Hounslow 2013

                        //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")
                        //, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
                        //and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

                        //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

                        //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
                        //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
                        //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
                        //IN THE SOFTWARE.

                        #include <sstream>
                        #include <string>
                        #include <iostream>
                        #include <opencv\highgui.h>
                        #include <opencv\cv.h>

                        using namespace cv;
                        //initial min and max HSV filter values.
                        //these will be changed using trackbars
                        int H_MIN = 0;
                        int H_MAX = 256;
                        int S_MIN = 0;
                        int S_MAX = 256;
                        int V_MIN = 0;
                        int V_MAX = 256;

                        but it says
                        E:\QT\Qt Projects\Project 2\Consola\Project_image\main.cpp:19: error: opencv\highgui.h: No such file or directory
                        #include <opencv\highgui.h>
                        ^

                        E:\QT\Qt Projects\Project 2\Consola\Project image\main.cpp

                        so please how can i solve it

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #16

                          Add the path of OpenCV's include.
                          Something like:

                          @INCLUDEPATH += E:/OpenCV/opencv/include@

                          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
                          • B Offline
                            B Offline
                            burdos
                            wrote on last edited by
                            #17

                            i just did it but ok i have this code
                            QT += core gui

                            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                            TARGET = Project_image
                            TEMPLATE = app
                            INCLUDEPATH += E:/OpenCV/opencv/include
                            LIBS += -LE:/OpenCV/opencv/build/x86/vc12/lib
                            SOURCES += main.cpp
                            mainwindow.cpp
                            ../../../project 1/objectTrackingTut.cpp
                            ../../../project 1/objectTrackingTut.cpp
                            ../../../project 1/objectTrackingTut.cpp

                            HEADERS += mainwindow.h

                            FORMS += mainwindow.ui

                            and in the main i have
                            #include <sstream>
                            #include <string>
                            #include <iostream>
                            #include <opencv\highgui.h>
                            #include <opencv\cv.h>

                            using namespace cv;
                            //initial min and max HSV filter values.
                            //these will be changed using trackbars
                            int H_MIN = 0;
                            int H_MAX = 256;
                            int S_MIN = 0;
                            int S_MAX = 256;
                            int V_MIN = 0;
                            int V_MAX = 256;
                            //default capture width and height
                            const int FRAME_WIDTH = 640;
                            const int FRAME_HEIGHT = 480;
                            //max number of objects to be detected in frame
                            const int MAX_NUM_OBJECTS=50;
                            //minimum and maximum object area
                            const int MIN_OBJECT_AREA = 2020;
                            const int MAX_OBJECT_AREA = FRAME_HEIGHT
                            FRAME_WIDTH/1.5;
                            //names that will appear at the top of each window
                            const string windowName = "Original Image";
                            const string windowName1 = "HSV Image";
                            const string windowName2 = "Thresholded Image";
                            const string windowName3 = "After Morphological Operations";
                            const string trackbarWindowName = "Trackbars";
                            void on_trackbar( int, void* )
                            {//This function gets called whenever a
                            // trackbar position is changed

                            and i still have problems it says

                            #include <opencv\highgui.h> not such a file or directory i do not know why

                            1 Reply Last reply
                            0
                            • SGaistS SGaist

                              The shadow build is where the compilation currently takes place (it avoids to pollute your source tree). Look in the project panel you'll see a QLineEdit named "Build directory", copy your image in the folder indicated there.

                              C Offline
                              C Offline
                              chfakht
                              wrote on last edited by
                              #18

                              @SGaist please where can i found the build directory in QtCreator !!

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #19

                                Look at the Projects panel, you have the "Build directory" path there

                                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

                                • Login

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