-Basic Installation
-==================
-
-Windows
-=======
-
- Installation under Windows is pretty strightforward.
- Download executable installation from SourceForge and run it.
- It installs OpenCV, registers DirectShow filters and performs
- other post-installation procedures.
- After that you can start using OpenCV.
-
- Building OpenCV from sources
- ----------------------------
-
- Also, it is possible to build the modified OpenCV from source, or
- build the latest OpenCV snapshot,
- obtained from SourceForge CVS (see http://sourceforge.net/cvs/?group_id=22870).
-
- +++ These are instructions for MSVC 6.0, MSVC.NET 2003 and MSVC.NET 2005
-
- * Specify the appropriate CVSROOT (see the link above) in WinCVS and
- checkout the module "opencv".
- * Open opencv\_make\opencv.dsw (in case of MSVC 6.0 or MSVC.NET 2003, in the latter
- case they will be converted to MSVC.NET 2003 project files),
- or opencv\_make\opencv.sln (in case of MSVC.NET 2005)
- * Select the configuration of interest, for example, Win32 Release, and build it.
- * Add opencv\bin to the system PATH.
- The path can be modified at
- MyComputer--[right button click]-->Properties->Advanced->Environment Variables.
-
- +++ One may also build OpenCV with command-line tools from Microsoft Platform SDK
- (Intel compiler can optionally be used instead of the one from Microsoft),
- or with MinGW - native GNU C/C++ port to Win32.
- The platforms supported are: Win32 on IA32, Win64 on EM64T/AMD64, Win64 on Itanium.
-
- * Install platform SDK or MinGW (with GCC 3.x or 4.x),
- Intel Compiler 9.0 or later (if needed)
- * Edit opencv\_make\make_cfg.mak, correct the paths to the SDK and ICC.
- * In the command-line prompt:
- * Enter opencv\_make directory
- * Run of the following:
- nmake /f makefile.32 - build IA32 version with cl compiler
- nmake /f makefile.icc - build IA32 version with icc (icl) compiler
- nmake /f makefile.vs - build IA32 version with cl compiler,
- environment variables are used instead of the Platform SDK.
- (ideal as command-line alternative to MSVC 6.0)
- nmake /f makefile.64 - build EM64T/AMD64 version using Platform SDK
- (the produced DLLs will have _64 suffix)
- nmake /f makefile.i7 - build Itanium version using Platform SDK
- (the produced DLLs will have _i7 suffix).
-
- mingw32-make -f make_all_gnu.mak - build IA32 version with gcc compiler
- (Make sure that <gcc_root>\bin is in the system path.
- To build VFW-enabled highgui, read instructions in
- opencv\otherlibs\_graphics\readme.txt)
-
- How to test built OpenCV binaries
- ---------------------------------
-
- Build and run samples at opencv\samples\c.
- (Note: some of the demos need an AVI file or a camera, e.g. motempl.c)
-
- or run algorithmic tests: opencv\bin\cxcoretest.exe, opencv\bin\cvtest.exe.
- It will produce cxcoretest.sum and cvtest.sum, respectively, that should hopefully
- contain all OK's.
-
- How to add IPP support
- ----------------------
-
- + Obtain IPP from Intel site (http://www.intel.com/software/products/ipp/index.htm),
- version 5.1 or later is preferrable, and install it.
- + Make sure the appropriate binary folder
- (e.g. c:\program files\intel\ipp\5.1\ia32\bin) is in the system path.
- + That's it. IPP should be automatically detected by OpenCV and loaded at runtime.
- + To smaller memory footprint and shorter application loading time,
- it is possible to build custom IPP dll for OpenCV, ippopencv*.dll, see interfaces\ipp.
- + It is possible to load/unload IPP at runtime, see cvUseOptimized() function.
-
-
-Linux
-=====
-
- There are no prebuilt binaries for Linux versions (because of a large variety of
- different versions of GCC and GLIBC in different distributions) from our side. So, if
- your distributor (SuSE, Debian, Ubuntu) doesn't offer OpenCV, you'll have
- to build it from sources.
-
- That's what you need to build fully-functionaly libraries and demos:
- ======
-
- + GTK+ 2.x or higher including headers
-
- + pkgconfig
-
- + libpng, zlib, libjpeg, libtiff, libjasper with development files.
-
- + Python 2.3, 2.4 or 2.5 with headers installed (developer package)
-
- + libavcodec, etc. from ffmpeg 0.4.9-pre1 or later + headers.
- Earlier versions do not work with OpenCV because of different API.
- libavcodec is LGPL software, so to use it with non-GPL software (such as OpenCV)
- you need to build and use a _shared_ library libavcodec.so.*:
- get ffmpeg from ffmpeg.sourceforge.net
- ./configure --enable-shared
- make
- make install
- you will have got: /usr/local/lib/libavcodec.so.*
- /usr/local/lib/libavformat.so.*
- (/usr/local/lib/libavutil.so.* for newer versions)
- /usr/local/include/ffmpeg/*.h
-
- Now build OpenCV:
- ======
-
- a) if your distribution uses RPM, you may build RPMs using:
- rpmbuild -ta OpenCV-x.y.z.tar.gz (for RPM 4.x or later) or
- rpm -ta OpenCV-x.y.z.tar.gz" (for eariler versions of RPM)
- where OpenCV-x.y.z.tar.gz should be put to /usr/src/redhat/SOURCES/ or
- similar directory
-
- it will build OpenCV-x.y.z.*.rpm
- (there is no OpenCV-devel, everything is in one package)
+= OpenCV Installation Guide =
+
+== Prerequisites ==
+
+=== Common Prerequisites ===
+
+ * C/C++ compiler (OpenCV is known to work with VS2005, VS2008,
+ including Express Editions, and Mingw on Windows,
+ GCC 4.x on Linux, MacOSX and other Unix-like systems).
+ * CMake 2.6 or later. CMake is now the only method of building OpenCV SVN snapshots
+ on Windows and the recommended method on Linux/MacOSX.
+ * (''Optional'') Subversion client (e.g. command-line svn tool, SmartSVN, Tortoise SVN)
+ * (''Optional'') Python 2.5.x or 2.6.x (Python 3.x support status is unknown),
+ including the development files: Python.h, etc. in order to build Python wrappers
+ * (''Optional'') SWIG 1.3.30 or later to build Python & Octave wrappers
+ (in order to build Octave wrappers you will need at least SWIG 1.3.36).
+ * (''Optional'') IPP 5.1 or later. OpenCV does not require IPP, but can be configured to
+ use IPP to make some functions run faster.
+ * (''Optional'') LiveTeX distribution (or MiKTeX on Windows) to build the up-to-date OpenCV reference manual
+
+=== Extra Prerequisites (Linux/BSD/other Unix-like OSes) ===
+
+ * pkg-config. It is used at the configuration stage and also simplifies the further use of OpenCV itself.
+ * (''Optional'') gtk+ 2.x and the related packages (glib, gthread etc.).
+ This is the GUI toolkit of choice for highgui on OSes other than Windows and MacOSX.
+ * (''Optional'') libjpeg, libtiff, libjasper, libpng and zlib. Install any of those with the associated
+ development packages (libjpeg-dev etc. on Debian/Ubuntu) to be able to read/write the corresponding
+ image formats.
+ * (''Optional'') ffmpeg, libgstreamer, libxine, unicap, libdc1394 2.x (or libdc1394 1.x + libraw1394).
+ You should have some/all of these packages installed (together with associated development packages)
+ to add video capturing, video decoding and video encoding capabilities to highgui.
+ The output of the configure script or cmake will show you, which of the packages have been detected
+ and will be used in highgui. For example, on Ubuntu 8.10 all the necessary ffmpeg files
+ can be installed using the following command:
+ sudo apt-get install libavformat-dev libswscale-dev
+ * (''Optional'') Octave 2.9 or later, together with SWIG 1.3.36 or later, in order to build Octave wrappers.
+ Note that currently Octave wrappers can only be built with autotools, not cmake.
+
+=== Extra Prerequisities (MacOSX) ===
+
+ * Xcode 3.1 or later. It does not only include the required C++ compiler,
+ but also Quicktime and Carbon frameworks that make highgui on MacOSX functional.
+ Besides, CMake can generate Xcode projects, so you can
+ build OpenCV conveniently from within the IDE.
+
+== Getting the latest stable OpenCV version ==
+
+ * Go to http://sourceforge.net/projects/opencvlibrary
+ * Windows: download the executable installation package for Windows and run it
+ * Linux/MacOSX/other operating systems: download the source tarball and unpack it
+
+=== Getting the cutting-edge OpenCV from SourceForge SVN repository ===
+
+ Launch SVN client and checkout either
+ a) the current OpenCV snapshot from here:
+ http://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk
+ b) or the latest tested OpenCV snapshot from here:
+ http://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot
+
+ In Linux/MacOSX it can be done using command line, e.g.:
+ {{{
+ cd ~/<my_working_directory>
+ svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk
+ }}}
+
+== Building OpenCV from source using CMake (Cross-platform) ==
+
+ 1. Create a temporary directory, which we denote as <cmake_binary_dir>,
+ where you want to put the generated Makefiles,
+ VisualStudio, Xcode, or Eclipse etc. project files as well the object files and output binaries.
+ You can do it using CMake GUI.
+
+ 2.
+ 2a. If you use CMake GUI, execute "Configure" to do the initial configuration,
+ then adjust any options, then press "Configure" again and then press "Generate".
- then install it by:
- rpm -i OpenCV-x.y.z.*.rpm
+ For the best performance, and if you compiler and the platform supports it,
+ it is recommended to turn on SSE2 optimization
+ (on Mac and Windows it is turned on by default) and OpenMP support.
- b) if your distribution does not support RPM, build and install it
- in Unix/Linux traditional way:
-
- ./configure
- make
- sudo make install
- sudo ldconfig
-
- You can influence which libraries are used and which features are
- enabled by specifying the appropriate flags to ./configure.
-
- See './configure --help' for more information.
-
-
- both a&b (post-install))
-
- default installation path is /usr/local/lib and /usr/local/include/opencv,
- so you need to add /usr/local/lib to /etc/ld.so.conf (and run ldconfig after)
- or add it to LD_LIBRARY_PATH environment variable
-
- c) if you want to step in as an OpenCV developer, you will need some additional tools:
-
- autoconf-2.59 (including autoheader-2.59)
- automake-1.9* (including aclocal-1.9*)
- libtool-1.5 (including libtoolize-1.5)
- swig (version 1.3.30 or current CVS version respectively)
-
- If the default versions of these tools installed on your machine differs, you
- should specify the paths to the required versions via environment variables. For
- example, if 'automake --version' gives you a version number 1.7.x but there is
- /usr/bin/automake-1.9 installed on your machine, then call
-
- export AUTOMAKE=/usr/binautomake-1.9
-
- whenever you want to work on OpenCV sources.
-
- In addition, you should 'configure --enable-maintainer-mode', so that all
- autotools are invoked automagically, if Makefile's or the configure-script
- need to be regenerated. You can manually regenerate everything by starting
- 'autoreconf' from the top directory.
-
-
- How to test OpenCV:
- =======
-
- + You can compile test programs using the traditional check target
- of automake projects:
-
- make check
-
- This implicitly runs the folowing test programs:
-
- tests/cv/src/cvtest
- tests/cxcore/src/cxcoretest
-
- + or
- compile and run simple c examples at
- /usr/local/share/opencv/samples, e.g.:
-
- g++ `pkg-config --cflags opencv` -o morphology morphology.c `pkg-config --libs opencv`
- Plain gcc won't work because of unresolved c++-specific symbols (located in highgui?)
-
-
- How to make OpenCV use IPP:
- =======
-
- + install IPP.
- Let's assume, it installs to /opt/intel/ipp/5.1/ia32.
-
- + add <install_path>/bin and <install_path>/bin/linux32
- (for example, /opt/intel/ipp/5.1/ia32/bin and /opt/intel/ipp/5.1/ia32/bin/linux32)
- to LD_LIBRARY_PATH in your initialization script (.bashrc or similar):
-
- LD_LIBRARY_PATH=/opt/intel/ipp/5.1/ia32/bin:/opt/intel/ipp/5.1/ia32/bin/linux32:$LD_LIBRARY_PATH
- export LD_LIBRARY_PATH
-
- or add these two directories, one per line, to /etc/ld.so.conf and run
- ldconfig as root.
-
- + that's it. Now OpenCV should be able to locate IPP shared libraries and make use of them.
-
-
-MacOSX
-======
-
- (TODO: add more detailed description)
- (see also OpenCV Wiki)
-
- + Basically, the requirements and building instructions are very similar to Linux case,
- with the following exceptions:
-
- * Carbon is used instead of GTK+ by default
- * Quicktime is used instead of FFMPEG/xine by default
- * pkg-config is optional (it is only used explicitly in samples\c\build_all.sh script)
- * RPM and ldconfig are not supported by default,
- use configure+make+sudo make install to build and install OpenCV,
- update LD_LIBRARY_PATH (unless ./configure --prefix=/usr is used).
-
- * for full functionality, you should install libpng, libtiff, libjpeg and libjasper
- from darwinports and/or fink and make them available to ./configure (see ./configure --help)
-
- + Known problems:
-
- * Currently there is no way to write AVI files with QuickTime
- * A plain OS X system doesn't have libpng, libtiff, libjasper installed, so
- you won't be able to read or write these image formats
- * The build system doesn't allow to build functional universal libraries at this time
- * The build system doesn't allow to build with the intel compiler on OS X at this time
-
- + If you'd like to step in as a developer, you will need to get the appropriate
- versions of automake, etc. (see Linux section) from darwinports.
-
-Other Systems
-=============
-
- Although there is no official support for non-x86 based
- processors it is reportedly possible to compile OpenCV on ARM.
-
- * on ARM pass CXXFLAGS=-fsigned-char to configure.
+ Also, if you want to build Python wrappers, samples or the reference manual in PDF,
+ you should explicitly turn it on.
+
+ 2b. If you are using command line, enter the <cmake_binary_dir> and type
+ {{{
+ cmake [<some optional parameters...>] <path to the OpenCV source directory>
+ }}}
+
+ For example, if you downloaded the project to ~/projects/opencv, you can do the following:
+ {{{
+ cd ~/projects/opencv # the directory containing INSTALL, CMakeLists.txt etc.
+ mkdir release
+ cd release
+ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
+ }}}
+ that will generate makefiles for the Release configuration and will put them in
+ ~/projects/opencv/release directory.
+
+ 3.
+ 3a. If you generated project files for VisualStudio, Xcode, Eclipse etc., run the respective IDE, open
+ the OpenCV top-level project/solution/workspace etc. and build it.
+
+ 3b. If you generated makefiles, then enter the created temporary directory and run make/nmake utility.
+ Then you can optionally run "sudo make install".
+
+ 4. If you did not run "make install", you should let your system know where to find the generated libraries.
+
+ On Windows you should add <cmake_binary_dir>/bin/debug and <cmake_binary_dir>/bin/release to the system path
+ (My Computer--[Right button click]-->Properties->Advanced->Environment Variables->Path)
+
+ On Linux you should add <cmake_binary_dir>/lib[/debug|/release] to /etc/ld.so.conf or
+ to LD_LIBRARY_PATH, e.g.:
+ {{{
+ export LD_LIBRARY_PATH=~/projects/opencv/release/lib:$LD_LIBRARY_PATH
+ sudo ldconfig
+ }}}
+ On MacOSX you should add <cmake_binary_dir>/lib[/debug|/release] to DYLD_LIBRARY_PATH.
+
+== Testing OpenCV (CMake, cross-platform) ==
+
+ You may turn on "BUILD_EXAMPLES" in CMake GUI or run cmake with "-D BUILD_EXAMPLES=ON" option,
+ then it will include short demo samples to the build. Note that some of them need image files
+ from the original source directory, you may just copy them to the bin directory.
+
+ You can also run tests correctness tests <cmake_binary_dir>/bin[/debug|/release]/cxcoretest and .../cvtest.
+
+=== Testing Python/Octave wrappers ===
+
+ As long as you build Python/Octave wrappers and installed them, you can
+ just enter opencv/samples/swig_python or opencv/samples/octave and run the samples, e.g.
+ {{{
+ python delaunay.py
+ }}}
+
+=== Building your own code that uses OpenCV ===
+
+ * If you use CMake, you can write your own CMakeLists.txt script and use the provided FindOpenCV.cmake file there,
+ just like you would use FindJPEG.cmake etc. Please, refer to CMake documentation.
+ * You can add opencv include, lib and bin subdirectory to your IDE settings.
+ * For hand-written Makefiles you can specify the necessary paths and options manually, e.g.:
+ {{{
+ g++ -o my_example my_example.cpp -I<opencv_source_dir>/include[/opencv] \
+ -L<cmake_binary_dir>/lib -lcxcore -lcv -lcvaux -lhighgui -lml
+ }}}
+ * Finally, you can use pkg-config and the provided opencv.pc.
+ 1. Make sure that opencv.pc is found by pkg-config:
+ {{{
+ pkg-config opencv --libs # should print something like -lcxcore -lcv ...
+ }}}
+ 2. You can now use it in your Makefiles or build scripts, e.g.:
+ {{{
+ g++ -o my_example my_example.cpp `pkg-config opencv --cflags --libs`
+ }}}
+----
+Up-to-date version of this manual can be found here: http://opencv.willowgarage.com/wiki/InstallGuide
+
+[[Welcome | OpenCV Wiki]]
+
+[[FullOpenCVWiki | Full OpenCV Wiki]]