Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to use OpenCV inside QtCreator?
Forum Updated to NodeBB v4.3 + New Features

How to use OpenCV inside QtCreator?

Scheduled Pinned Locked Moved Solved Installation and Deployment
11 Posts 3 Posters 7.4k Views 1 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,

    Aren't you providing the path to a 64bit version of OpenCV while using a 32bit Qt ?

    On a side note, you shouldn't link to .dll files but to .lib files.

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

    B 1 Reply Last reply
    0
    • B Offline
      B Offline
      beginMyCoding
      wrote on last edited by
      #3

      Hei even i tried to follow the instructions from the same link which you attached. In the Cmake i am getting errors after i select c and c++ compilers and enter finish

      Error in configuration process, project files may be invalid
      

      Do you know what to do?

      1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Aren't you providing the path to a 64bit version of OpenCV while using a 32bit Qt ?

        On a side note, you shouldn't link to .dll files but to .lib files.

        B Offline
        B Offline
        Beriol
        wrote on last edited by
        #4

        @SGaist

        Damn, you're right. How did I not see that?

        I built the libraries again using the right mingw compiler and now it seems to be working! Thanks a lot! :D

        About the .lib files, there are none in the library. Or at least none I could find, only dll.

        @beginMyCoding

        From what I've seen it's kind of normal for Cmake to throw some errors here and there. If you try hitting the configure botton again what happens?

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

          You're welcome !

          Late night debugging can have that kind of effect ;)

          Since you have it working now, 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
          • B Beriol

            @SGaist

            Damn, you're right. How did I not see that?

            I built the libraries again using the right mingw compiler and now it seems to be working! Thanks a lot! :D

            About the .lib files, there are none in the library. Or at least none I could find, only dll.

            @beginMyCoding

            From what I've seen it's kind of normal for Cmake to throw some errors here and there. If you try hitting the configure botton again what happens?

            B Offline
            B Offline
            beginMyCoding
            wrote on last edited by
            #6

            @Beriol its the same error again and again
            can you write in brief what all you have done, it will be much useful for me and others who are trying it for first time.

            B 1 Reply Last reply
            0
            • B beginMyCoding

              @Beriol its the same error again and again
              can you write in brief what all you have done, it will be much useful for me and others who are trying it for first time.

              B Offline
              B Offline
              Beriol
              wrote on last edited by
              #7

              @beginMyCoding

              I followed exactly the guide I posted in the first post. For me the hard part was actually linking the libraries, not building them.

              Are you sure you selected the right compilers? The path should be something like:
              C:\YourPathToQT\Qt\Tools\mingw48_32\bin\gcc.exe <-- for C
              C:\YourPathToQT\Qt\Tools\mingw48_32\bin\g++.exe <-- for C++

              In my case inside the "Tools" folder there is also a folder called MinGW which also contain the bin with the compilers, but do NOT use that (which was my mistake).

              Besides this, did you add the path to CMake to your system PATH variable and restarted the computer?

              B 1 Reply Last reply
              0
              • B Beriol

                @beginMyCoding

                I followed exactly the guide I posted in the first post. For me the hard part was actually linking the libraries, not building them.

                Are you sure you selected the right compilers? The path should be something like:
                C:\YourPathToQT\Qt\Tools\mingw48_32\bin\gcc.exe <-- for C
                C:\YourPathToQT\Qt\Tools\mingw48_32\bin\g++.exe <-- for C++

                In my case inside the "Tools" folder there is also a folder called MinGW which also contain the bin with the compilers, but do NOT use that (which was my mistake).

                Besides this, did you add the path to CMake to your system PATH variable and restarted the computer?

                B Offline
                B Offline
                beginMyCoding
                wrote on last edited by
                #8

                @Beriol
                I downloaded and extracted openCV. Later installed Qt. Added the directories
                C:\Qt\5.5\mingw492_32\bin
                C:\opencv\build\x86\vc12\bin
                to the path in Environment variables.

                Later downloaded CMake and installed it and added its path
                C:\CMake\bin
                Created an empty folder opencv-mingw in C-Drive

                Rebooted Laptop

                In CMake i selected
                the sourcecode Directory as C:\Qt\Tools\mingw492_32\bin
                (also tried with C:\Qt\5.5\mingw492_32\bin)
                Buid the binary in C:/opencv-mingw and hit configure button

                Selected MinGW Makefiles from dropdown menu. Then it asked to specify native compilers
                Specified C:/Qt/Tools/mingw491_32/bin/gcc.exe for C
                specified C:/Qt/Tools/mingw491_32/bin/g++.exe for C++
                and hit finish

                IT GAVE ME ERROR
                Error in configuration process, Project files may be invalid

                B 1 Reply Last reply
                0
                • B beginMyCoding

                  @Beriol
                  I downloaded and extracted openCV. Later installed Qt. Added the directories
                  C:\Qt\5.5\mingw492_32\bin
                  C:\opencv\build\x86\vc12\bin
                  to the path in Environment variables.

                  Later downloaded CMake and installed it and added its path
                  C:\CMake\bin
                  Created an empty folder opencv-mingw in C-Drive

                  Rebooted Laptop

                  In CMake i selected
                  the sourcecode Directory as C:\Qt\Tools\mingw492_32\bin
                  (also tried with C:\Qt\5.5\mingw492_32\bin)
                  Buid the binary in C:/opencv-mingw and hit configure button

                  Selected MinGW Makefiles from dropdown menu. Then it asked to specify native compilers
                  Specified C:/Qt/Tools/mingw491_32/bin/gcc.exe for C
                  specified C:/Qt/Tools/mingw491_32/bin/g++.exe for C++
                  and hit finish

                  IT GAVE ME ERROR
                  Error in configuration process, Project files may be invalid

                  B Offline
                  B Offline
                  Beriol
                  wrote on last edited by
                  #9

                  @beginMyCoding

                  The "sourcecode directory" inside CMake should point to the folder that contains the source code for OpenCV, not the folder that contains compiler executables like the one you're using!

                  So, you should put the path to the folder where you extracted the OpenCV stuff. Something like "C:/opencv/sources". That's why you're getting the error at start, there are no source files to configure :)

                  B 1 Reply Last reply
                  1
                  • B Beriol

                    @beginMyCoding

                    The "sourcecode directory" inside CMake should point to the folder that contains the source code for OpenCV, not the folder that contains compiler executables like the one you're using!

                    So, you should put the path to the folder where you extracted the OpenCV stuff. Something like "C:/opencv/sources". That's why you're getting the error at start, there are no source files to configure :)

                    B Offline
                    B Offline
                    beginMyCoding
                    wrote on last edited by
                    #10

                    @Beriol Oh yes, thanks for the that
                    It was my silly mistake... It is working and I have generated the compilers in Cmake.

                    But in Command prompt after entering mingw32–make ,
                    I was left with errors at 31%, I referred the comments in the link and unchecked WITH_IPP and regenerated in Cmake.

                    But this time I was a getting errors at 37% in Command prompt.

                    makefile: 148: recipe for target 'all' failed
                    mingw32-make: ***[all] Error 2
                    

                    Do you know anything about this?

                    B 1 Reply Last reply
                    0
                    • B beginMyCoding

                      @Beriol Oh yes, thanks for the that
                      It was my silly mistake... It is working and I have generated the compilers in Cmake.

                      But in Command prompt after entering mingw32–make ,
                      I was left with errors at 31%, I referred the comments in the link and unchecked WITH_IPP and regenerated in Cmake.

                      But this time I was a getting errors at 37% in Command prompt.

                      makefile: 148: recipe for target 'all' failed
                      mingw32-make: ***[all] Error 2
                      

                      Do you know anything about this?

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

                      @beginMyCoding

                      It happened to me too, but I don't remember what exactly fixxed that problem.

                      Try this: in CMake tick the option "Advanced" (it's on the right after the search bar), and search for CMAKE__MAKE_PROGRAM; make sure that it points to the mingw32-make.exe inside you Qt folder "C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe". I remember that in my case it wasn't set right and I used to get errors because of that.

                      Besides this I'm not sure what else you could do... Did you check "WITH_QT"?
                      Also, try unchecking "WITH_CUDA". I remember reading somewhere that it might give problems, but I actually don't remember if it gave me any while building.

                      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