Installing OpenCV 2.3.1 with Qt

  • 12,313 views
Uploaded on

Tutorial for installing OpenCV 2.3.1 with Qt. Slides made for the Computer Vision course at Politecnico di Torino (academic year 2011/2012).

Tutorial for installing OpenCV 2.3.1 with Qt. Slides made for the Computer Vision course at Politecnico di Torino (academic year 2011/2012).

More in: Education , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
12,313
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
161
Comments
2
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Installing OpenCV 2.3.1 with Qt Luigi De Russis Politecnico di TorinoDipartimento di Automatica e Informatica (DAUIN) Torino - Italy luigi.derussis@polito.itThis work is licensed under the Creative Commons (CC BY-SA) License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/
  • 2. 0. Getting started… Official installation guide: http://opencv.willowgarage.com/wiki/InstallGuide Prerequisites:  [Mac OS X] Xcode 3.2 or later  [Linux] GCC 4.3 or later11/11/2011 Luigi De Russis - Computer Vision - OpenCV 2
  • 3. 1. Qt SDK (I) Download and install Qt SDK from http://qt.nokia.com/downloads, using the offline installer (current release 4.7.4) [Windows-only] Perform a custom installation, installing all the mingw32 stuff. Components about Meego, Symbian, etc. are not necessary for our purpose (see next slide)11/11/2011 Luigi De Russis - Computer Vision - OpenCV 3
  • 4. 1. Qt SDK (II) - Windows11/11/2011 Luigi De Russis - Computer Vision - OpenCV 4
  • 5. 1. Qt SDK (II) - Windows At the end, check if the folder C:QtSDKmingwbin (or similar) is included in the PATH variable11/11/2011 Luigi De Russis - Computer Vision - OpenCV 5
  • 6. 2. OpenCV 2.3.1 Download and unpack OpenCV 2.3.1 from http://opencv.willowgarage.com/wiki11/11/2011 Luigi De Russis - Computer Vision - OpenCV 6
  • 7. 3. Cmake (I) Download and install Cmake from http://www.cmake.org/11/11/2011 Luigi De Russis - Computer Vision - OpenCV 7
  • 8. 3. Cmake (II) Create a folder named “builds_with_Qt” (or similar) wherever you want (suggested location: inside the opencv folder) Create two new folders named “debug” and “release” inside the “builds_with_Qt” folder [Mac-only] Warning: choose carefully where you put the “builds_with_Qt” folder. To move the folder, thus maintaining the compiled opencv library working, may require a little bit effort (by using “install_name_tool”).11/11/2011 Luigi De Russis - Computer Vision - OpenCV 8
  • 9. 3. Cmake (II) Create a folder named “builds_with_Qt” (or similar) wherever you want (suggested location: inside the opencv folder) Create two new folders named “debug” and It is not strongly mandatory… “release” inside the “builds_with_Qt” folder only a “best practice”! [Mac-only] Warning: choose carefully where you put the “builds_with_Qt” folder. To move the folder, thus maintaining the compiled opencv library working, may require a little bit effort (by using “install_name_tool”).11/11/2011 Luigi De Russis - Computer Vision - OpenCV 9
  • 10. 3. Cmake (III) Run Cmake11/11/2011 Luigi De Russis - Computer Vision - OpenCV 10
  • 11. 3. Cmake (III) “Where is the source code” field requires the location of the opencv folder “Where to build the binaries” field requires the location of the “debug” folder, previously created Now press the button “Configure”…11/11/2011 Luigi De Russis - Computer Vision - OpenCV 11
  • 12. 3. Cmake (IV) In the next window, select “MingGW Makefiles” under Windows, “Unix Makefiles” otherwise Then, press “Finish”11/11/2011 Luigi De Russis - Computer Vision - OpenCV 12
  • 13. 3. Cmake (V) The Cmake window should appear in this way:11/11/2011 Luigi De Russis - Computer Vision - OpenCV 13
  • 14. 3. Cmake (VI) Open the CMAKE entry and assign the value DEBUG to the CMAKE_BUILD_TYPE variable11/11/2011 Luigi De Russis - Computer Vision - OpenCV 14
  • 15. 3. Cmake (VII) Open the WITH entry:  uncheck WITH_CUDA and WITH_EIGEN  check WITH_QT  Press “Configure”, again11/11/2011 Luigi De Russis - Computer Vision - OpenCV 15
  • 16. 3. Cmake (VIII) Open the QT entry with a red background and add the location of qmake to the variable QT_QMAKE_EXECUTABLE (qmake is in /Desktop/Qt/4.7.4/mingw/bin inside the folder where Qt SDK has been installed)11/11/2011 Luigi De Russis - Computer Vision - OpenCV 16
  • 17. 3. Cmake (IX) Click again on “Configure” (until the entries background becomes totally white)11/11/2011 Luigi De Russis - Computer Vision - OpenCV 17
  • 18. 3. Cmake (X) Press “Generate” Repeat the steps reported on slides 11 - 18, changing:  the build destination folder from “debug” to “release”  the value of the CMAKE_BUILD_TYPE variable (in the CMAKE entry) to RELEASE11/09/2011 Luigi De Russis - Computer Vision - OpenCV 18
  • 19. 4a. Final steps, on Linux/Mac(I) Open the terminal, move to the “debug” folder, type “make -jN”, where N is the number of threads to use (typically, dual core processor can efficiently handle 4 threads), and press enter Wait… Repeat the previous two steps for the “release” folder Copy the “include” folder (the one inside the “build” folder) from the WINDOWS version of opencv in your “builds_with_Qt” folder11/09/2011 Luigi De Russis - Computer Vision - OpenCV 19
  • 20. 4a. Final steps, on Linux/Mac(II) Copy the file “opencv.hpp” from “/include/opencv2” to “include” (in your “builds_with_Qt” folder) Done: you can start to use OpenCV with Qt!11/09/2011 Luigi De Russis - Computer Vision - OpenCV 20
  • 21. 4b. Final steps, on Windows (I) Open the command prompt, move to the “debug” folder, type “mingw32-make” and press enter Wait… Repeat the previous two steps for the “release” folder11/09/2011 Luigi De Russis - Computer Vision - OpenCV 21
  • 22. 4b. Final steps, on Windows(II) Add to the PATH environment variable the location of the following folders:  bin folder inside “debug”  bin folder inside “release”  QtSDK/Desktop/Qt/4.7.4/mingw/bin How do I set the PATH variable? Read here.11/11/2011 Luigi De Russis - Computer Vision - OpenCV 22
  • 23. 4b. Final steps, on Windows(III) Copy the “include” folder (the one inside the “build” folder in the opencv folder) in your “builds_with_Qt” folder Copy the file “opencv.hpp” from “/include/opencv2” to “include” (in your “builds_with_Qt” folder) Done: you can start to use OpenCV with Qt!11/11/2011 Luigi De Russis - Computer Vision - OpenCV 23