Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Opencv setup with Qt
Forum Updated to NodeBB v4.3 + New Features

Opencv setup with Qt

Scheduled Pinned Locked Moved Qt Creator and other tools
11 Posts 4 Posters 5.5k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Looks like the path to OpenCV's includes are in

    @C:/opencv-mingw/install/include@

    Also, please use the unix notation style for paths, otherwise you have to double your backslashes

    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
    • J Offline
      J Offline
      Javeria
      wrote on last edited by
      #3

      The include part works but i cant declare a simple Mat object as it gives error while building like these:
      main.obj:-1: error: LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QEAAXXZ) referenced in function "public: void __cdecl cv::Mat::release(void)" (?release@Mat@cv@@QEAAXXZ)

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

        You are missing the OpenCV core library in your list of libraries to link to

        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
        • J Offline
          J Offline
          Javeria
          wrote on last edited by
          #5

          This is the updated .pro file but its still giving same errors of unresolved externals:
          win32
          {
          INCLUDEPATH += C:/opencv-mingw/install/include
          LIBS += -LC:/opencv-mingw/install/x64/mingw/bin/libopencv_core2410.dll.a
          LIBS += -LC:/opencv-mingw/install/x64/mingw/lib/libopencv_highgui2410.dll.a
          LIBS += -LC:/opencv-mingw/install/x64/mingw/lib/libopencv_core2410.dll.a
          LIBS += -LC:/opencv-mingw/install/x64/mingw/lib/libopencv_imgproc2410.dll.a
          }

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

            Your original pro file was correct, just missing the opencv_core2410 library.
            Now you are using the wrong l, L is for giving an additionnal path to the linker to search for libraries

            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
            • J Offline
              J Offline
              Javeria
              wrote on last edited by
              #7

              I followed your instruction but now it says it can find for example "opencv_highgui.lib", is there something still missing?

              1 Reply Last reply
              0
              • J Offline
                J Offline
                Javeria
                wrote on last edited by
                #8

                So here is my finalized .pro file I have also added dll of bin too:
                win32 {
                INCLUDEPATH += "C:/opencv/build/include" \

                   LIBS += -L"C:/opencv/build/x86/vc12/lib" \
                        -lopencv_core2410d \
                        -lopencv_highgui2410d \
                        -lopencv_imgproc2410d \
                        -lopencv_features2d2410d \
                        -lopencv_calib3d2410d
                   LIBS += -L"C:/opencv/build/x86/vc12/bin" \
                        -lopencv_core2410d \
                        -lopencv_highgui2410d \
                        -lopencv_imgproc2410d \
                        -lopencv_features2d2410d \
                        -lopencv_calib3d2410d
                

                }
                It still gives unresolved external symbols error

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  boydcheung
                  wrote on last edited by
                  #9

                  So, anyone has succeeded in configuring opencv with Qt on Windows? I am using VS2013, and I found a demo for mingw, but an adjustment for vs just doesn't work well. It is always complaining about "No such file or directory" for including file:

                  C:\Users\vvv\Documents\github\OpenCV-With-QT-Quick-Demo\dialog.h:6: error: C1083: Cannot open include file: 'opencv2/core/core.hpp': No such file or directory
                  

                  So frustrating tuned a whole morning without avail. Please show a working one.

                  B 1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    LuGRU
                    wrote on last edited by
                    #10

                    Using OpenCV on Win for an app that do scene change detection based on threshold, OpenCV 3, compiled tonight OpenCV 2.x and also work fine.

                    Bottom line OpenCV do work correctly, with is not a surprise, with Qt.

                    1 Reply Last reply
                    0
                    • B boydcheung

                      So, anyone has succeeded in configuring opencv with Qt on Windows? I am using VS2013, and I found a demo for mingw, but an adjustment for vs just doesn't work well. It is always complaining about "No such file or directory" for including file:

                      C:\Users\vvv\Documents\github\OpenCV-With-QT-Quick-Demo\dialog.h:6: error: C1083: Cannot open include file: 'opencv2/core/core.hpp': No such file or directory
                      

                      So frustrating tuned a whole morning without avail. Please show a working one.

                      B Offline
                      B Offline
                      boydcheung
                      wrote on last edited by boydcheung
                      #11

                      @boydcheung okay, this vid here gives a clue. Run Qmake before debugging.

                      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