Installing OpenCV 2.4.x with Qt
Upcoming SlideShare
Loading in...5
×
 

Installing OpenCV 2.4.x with Qt

on

  • 14,496 views

 

Statistics

Views

Total Views
14,496
Views on SlideShare
14,488
Embed Views
8

Actions

Likes
1
Downloads
212
Comments
3

2 Embeds 8

https://twitter.com 7
http://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Hi, when i get to generate there is still red fields in there, if i press configure again it show me an error and the red fields dissapear but it still show me the error, someone can help me with that?
    Are you sure you want to
    Your message goes here
    Processing…
  • I can't install Opencv 2.4.3 with Qt 4.8.1 with MinGW 4.4. (windows 7 32 bit).
    mingw32-make crashes on building perf_core (about 35% of building). What do you think about
    'which mingw compiler is used to create the pre-build libs in 2.4.3 release' post here http://blog.gmane.org/gmane.comp.lib.opencv.devel/month=20121101?
    Are you sure you want to
    Your message goes here
    Processing…
  • Hi !
    Thanks for this tutorial witch is really well explained.
    However I have a problem.
    After finishing the tutorial, my 'Built_with_QT' folder is empty !
    Do you have an idea why ?

    Clement - Win 7 64bits - Opencv (2.3 and 2.4.3), QT 2009 and 2010
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Installing OpenCV 2.4.x with Qt Installing OpenCV 2.4.x with Qt Presentation Transcript

  • Installing OpenCV 2.4.x 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/
  • 0. Getting started… Official installation guides  Currently, only for Linux and Windows  http://docs.opencv.org/doc/tutorials/introduction/table_of_c ontent_introduction/table_of_content_introduction.html Prerequisites:  [Mac OS X] Xcode with command line tools installed  [Linux] GCC 4.4 or later N.B. This tutorial has been tested with OpenCV 2.3.1, 2.4.2, and 2.4.3 under Windows 7 and Mac OS X 10.7+11/9/2012 Luigi De Russis - Computer Vision - OpenCV 2 Installation
  • 1. Qt SDK (I) Download and install Qt SDK from http://qt- project.org/downloads, using the offline installer (current SDK release 1.2.1) [Windows-only] Perform a custom installation, installing all the MinGW stuff. Components about Harmattan, Symbian, etc. are not necessary for our purpose (see next slide)11/9/2012 Luigi De Russis - Computer Vision - OpenCV 3
  • 1. Qt SDK (II) - Windows11/9/2012 Luigi De Russis - Computer Vision - OpenCV 4
  • 1. Qt SDK (II) - Windows At the end, check if the folder C:QtSDKmingwbin (or similar) is included in the PATH variable11/9/2012 Luigi De Russis - Computer Vision - OpenCV 5
  • 2. OpenCV 2.4.x Download and unpack OpenCV 2.4.x from http://opencv.org/11/9/2012 Luigi De Russis - Computer Vision - OpenCV 6
  • 3. Cmake (I) Download and install Cmake from http://www.cmake.org/11/9/2012 Luigi De Russis - Computer Vision - OpenCV 7
  • 3. Cmake (II) Create two new folders named “cmake-debug” and “cmake-release” inside the opencv folder Create a folder named “build_with_Qt” (or similar) wherever you want  create two new folders named “debug” and “release” inside the “build_with_Qt” folder11/9/2012 Luigi De Russis - Computer Vision - OpenCV 8
  • 3. Cmake (II) Create two new folders named “cmake-debug” and “cmake-release” inside the opencv folder Create a folder named “build_with_Qt” (or similar) wherever you want It is not strongly mandatory… it  create two new folders named “debug” and “release” inside is only a “best practice”! the “build_with_Qt” folder11/9/2012 Luigi De Russis - Computer Vision - OpenCV 9
  • 3. Cmake (IV) Run Cmake11/9/2012 Luigi De Russis - Computer Vision - OpenCV 10
  • 3. Cmake (V) “Where is the source code” field requires the location of the opencv folder “Where to build the binaries” field requires the location of the “cmake-debug” folder, previously created Now press the button “Configure”…11/9/2012 Luigi De Russis - Computer Vision - OpenCV 11
  • 3. Cmake (VI) In the next window, select “MingGW Makefiles” under Windows, “Unix Makefiles” otherwise Then, press “Finish”11/9/2012 Luigi De Russis - Computer Vision - OpenCV 12
  • 3. Cmake (VII) The Cmake window should appear in this way:11/9/2012 Luigi De Russis - Computer Vision - OpenCV 13
  • 3. Cmake (VIII) Open the CMAKE entry  assign the value Debug to the CMAKE_BUILD_TYPE variable  change the CMAKE_INSTALL_PREFIX to match the “build_with_Qt/debug” folder11/9/2012 Luigi De Russis - Computer Vision - OpenCV 14
  • 3. Cmake (IX) Open the WITH entry:  check WITH_QT  uncheck useless values (CUDA, CUFFT, EIGEN, and PVAPI, typically)  Press “Configure”, again11/9/2012 Luigi De Russis - Computer Vision - OpenCV 15
  • 3. Cmake (X) Open the Ungrupped Entries (or QT) with a red background and add the location of qmake to the variable QT_QMAKE_EXECUTABLE  [Windows] qmake is in /Desktop/Qt/4.8.1/mingw/bin inside the folder where Qt SDK has been installed  [Linux/Mac] qmake is in /Desktop/Qt/4.8.1/gcc/bin inside the folder where Qt SDK has been installed11/9/2012 Luigi De Russis - Computer Vision - OpenCV 16
  • 3. Cmake (XI) Click again on “Configure” (until the entries background becomes totally white)11/9/2012 Luigi De Russis - Computer Vision - OpenCV 17
  • 3. Cmake (XII) Press “Generate” Repeat the steps reported on slides 11 - 18, changing:  the build destination folder from “cmake-debug” to “cmake- release”  the value of the CMAKE_BUILD_TYPE variable (in the CMAKE entry) to Release  the value of the CMAKE_INSTALL_PREFIX variable (in the CMAKE entry) to match the “build_with_Qt/release” folder11/9/2012 Luigi De Russis - Computer Vision - OpenCV 18
  • 4a. Final steps, on Linux/Mac(I) Open the terminal, move to the “cmake-debug” folder, type “make -jN”, where N is the number of threads to use, and press enter Wait… Type “make install” to complete the OpenCV installation Repeat the previous three steps for the “cmake- release” folder11/9/2012 Luigi De Russis - Computer Vision - OpenCV 19
  • 4a. Final steps, on Linux/Mac(II) Add the following folders:  /build_with_Qt/debug/bin  /build_with_Qt/release/bin to the DYLD_LIBRARY_PATH (Mac) or LD_LIBRARY_PATH (Linux) environment variable. You can perform this operation right inside QtCreator (“Build Environments” field inside the Projects” tab). 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/9/2012 Luigi De Russis - Computer Vision - OpenCV 20
  • 4b. Final steps, on Windows (I) Open the command prompt, move to the “cmake-debug” folder, type “mingw32-make –j N”, where N is the number of threads to use, and press enter Wait… Type “mingw32-make install” and press enter Repeat the previous three steps for the “cmake-release” folder11/9/2012 Luigi De Russis - Computer Vision - OpenCV 21
  • 4b. Final steps, on Windows(II) Add to the PATH environment variable the following folders:  /build_with_Qt/debug/bin  /build_with_Qt/release/bin  QtSDK/Desktop/Qt/4.8.1/mingw/bin How do I set the PATH variable? Read here. You can also perform this operation inside QtCreator (“Build Environments” field inside the Projects” tab).11/9/2012 Luigi De Russis - Computer Vision - OpenCV 22
  • 4b. Final steps, on Windows(III) Copy the file “opencv.hpp” from “/include/opencv2” to “include” (in your “build_with_Qt” folder) Done: you can start to use OpenCV with Qt!11/9/2012 Luigi De Russis - Computer Vision - OpenCV 23