- GCC 4.x or later. In Ubuntu/Debian it can be installed with
- CMake 2.6 or higher
- Subversion (SVN) client
- GTK+ 2.x or higher, including headers (e.g. libgtk2.0-dev)
- pkgconfig
- libpng, zlib, libjpeg, libtiff, libjasper with development files (e.g. libjpeg-dev)
- Python 2.3 or later with developer packages (e.g. python-dev)
- SWIG 1.3.30 or later
-
libavcodec etc. from ffmpeg 0.4.9-pre1 or later + headers. (Video support with FFMPEG)
- libdc1394 2.x + headers for video capturing from IEEE1394 cameras
Getting OpenCV source code from the repository
Enter your working directory (denoted as ~/<your_working_dir> below) and type:
svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk
to get the current OpenCV snapshot, or
svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot
to get the latest tested OpenCV snapshot.
Compilation
To build OpenCV using cmake, type the following:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
mkdir release # create the output directory
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ..
You will see the configuration results. Various build options can be adjusted interactively using CMake GUI. Then you build the library and install it to the target directory:
make
sudo make install
Path Configuration
In order to use the libraries in Linux, thier path should be specified. Library path can be specified in /etc/ld.so.conf.d/ by creating a file called 'opencv.conf' which contains the opencv library path (Default configuration is /usr/local/lib). Once the file is created, execute
to make new set library pathes effective. Or you can also add the path to LD_LIBRARY_PATH:
Test OpenCV
You can run the correctness tests cxcoretest and cvtest for a quick sanity check:
./cxcoretest
./cvtest -d ~/<your_working_dir>/opencv/tests/cv/testdata
You can also build and run OpenCV samples:
. build_all.sh
./delaunay
# try other samples (some of them require a camera) ...