Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Building OpenCV for Qt
Qt 6.11 is out! See what's new in the release blog

Building OpenCV for Qt

Scheduled Pinned Locked Moved Solved 3rd Party Software
20 Posts 4 Posters 14.1k 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
    #11

    What example ?

    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
    • M Offline
      M Offline
      MartijnKor
      wrote on last edited by
      #12

      The example/instructions on the Qt website on how to get opencv to work with Qt for Windows. On the bottom of the page they give an example code to test whether everything has been installed the properly. The instructions are on this page

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        Yacinoben
        wrote on last edited by
        #13

        Hi
        -Open file "opencv\sources\cmake\OpenCVCompilerOptions.cmake", and comment this line :
        #add_extra_compiler_option(-Werror=non-virtual-dtor)
        -After click in configure, no check : WITH_IPP
        -And use mingw32-make , mingw32-make install

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MartijnKor
          wrote on last edited by
          #14

          Thanks for your help. I deleted my opencv-build directory, commented that line in CMake-file. Did CMake again, with IPP unchecked, ran make and make install again, but no luck. Still the same problem.

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

            Maybe a silly question but, are you also using the Qt MinGW version to build that project ?

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

            M 1 Reply Last reply
            0
            • SGaistS SGaist

              Maybe a silly question but, are you also using the Qt MinGW version to build that project ?

              M Offline
              M Offline
              MartijnKor
              wrote on last edited by
              #16

              @SGaist Yes I am. I installed the mingw included in the Qt online installer and included it in Path. I also select those as the compilers in CMake. Thanks guys for all your help to untill this point. I really appreciate it!

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

                Do you have a static or dynamic build of OpenCV ?

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

                M 1 Reply Last reply
                0
                • SGaistS SGaist

                  Do you have a static or dynamic build of OpenCV ?

                  M Offline
                  M Offline
                  MartijnKor
                  wrote on last edited by
                  #18

                  @SGaist That's a good question. According to this YouTube video(I am sorry, but this was quite new for me so I used this as a source of information) at 7:46 it looks like a mix of a static Linux(.a) library and a dynamic Windows(.dll) library, since the files I got after making it have a .dll.a extension.

                  Anyway, I think I have found the solution for my problem. I will post it right away after this reaction :) Thanks SGaist for all your help!

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MartijnKor
                    wrote on last edited by MartijnKor
                    #19

                    So after a lot of searching the internet and getting very frustrated I found a solution that seems to work for me so far. I have no idea why this solves the problem and I think it is kind of strange but here is:

                    On Youtube I found a video where someone explained the exact same steps as described in the original tutorial published by Qt. The problem was the linking. CMake gave me some .dll.a files which I thoughtwas strange.
                    In this video that person got the excact same files as me (.dll.a). The problem was on how to link these files in the .pro-file.

                    So here is the solution.
                    Instead of using this:

                    LIBS += -LD:\opencv-build\install\x86\mingw\lib \
                        -lopencv_core320.dll \
                        -lopencv_highgui320.dll \
                        -lopencv_imgcodecs320.dll \
                        -lopencv_imgproc320.dll \
                        -lopencv_features2d320.dll \
                        -lopencv_calib3d320.dll
                    

                    Use this:

                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_calib3d320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_core320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_features2d320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_flann320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_highgui320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_imgcodecs320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_imgproc320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_ml320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_objdetect320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_photo320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_shape320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_stitching320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_superres320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_video320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_videoio320.dll.a"
                    LIBS += "C:\opencv-build\install\x86\mingw\lib\libopencv_videostab320.dll.a"
                    

                    EDIT: This path "C:\opencv-build\install\x86\mingw\lib" also needs to be inserted in Path in System variables I have noticed in order to work.
                    Using those (longer unfortunately) lines of code, it did work for me. If anyone knows a simpler way of making this work I and presumably other people would appreciate it. Everyone thanks a lot for their help!

                    -Martijn

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

                      Then why not:

                      LIBS += -LD:/opencv-build/lib \
                          -lopencv_core320 \
                          -lopencv_highgui320 \
                      # etc...
                      

                      ?

                      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
                      • Unsolved