Introduction to opencv

The opencv package contains graphics libraries mainly aimed at real-time computer vision.



Development versions of BLFS may not build or run some packages properly if dependencies have been updated since the most recent stable versions of the book.

Package Information

Additional Downloads



One additional file that starts with "ippicv" (integrated performance primitives) will be automatically downloaded during the cmake portion of the build procedure. This download is specific to the system architecture.

opencv Dependencies


CMake-3.25.0 and UnZip-6.0



apache-ant-1.10.12, Doxygen-1.9.5, Java-19.0.1, Python-2.7.18, blas, Cuda, Eigen, OpenEXR, GDAL, lapack, libdc1394, NumPy, Threading Building Blocks (TBB), and VTK - The Visualization Toolkit,

User Notes:

Installation of opencv

First, fix building this package with ffmpeg-5.1:

sed -e '/\/avformat.h/i #include <libavcodec/version.h>' \
    -i modules/videoio/src/ffmpeg_codecs.hpp

If needed, unpack the additional modules package:

tar xf ../opencv_contrib-4.6.0.tar.gz

Install opencv by running the following commands:

mkdir build &&
cd    build &&

cmake -DCMAKE_INSTALL_PREFIX=/usr      \
      -DCMAKE_BUILD_TYPE=Release       \
      -DENABLE_CXX11=ON                \
      -DBUILD_PERF_TESTS=OFF           \
      -DWITH_XINE=ON                   \
      -DBUILD_TESTS=OFF                \
      -DCMAKE_SKIP_RPATH=ON            \
      -Wno-dev  ..                     &&

The package does not come with an operable test suite.

Now, as the root user:

make install

Command Explanations

-DWITH_XINE=ON: This option instructs the make procedure to use xine-lib-1.2.12.

-DENABLE_PRECOMPILED_HEADERS=OFF: This option is needed for compatibility with gcc-6.1 and later.

-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.6.0/modules: instructs the build system to build additional modules.


Installed Programs: opencv_annotation, opencv_interactive-calibration, opencv_model_diagnostics, opencv_version, opencv_visualisation, and
Installed Libraries:,,,,,,,,,,,,,, and
Installed Directories: /usr/include/opencv4, /usr/lib/cmake/opencv4, /usr/lib/python3.11/site-packages/cv2, /usr/share/licenses/opencv4, /usr/share/opencv4, and /usr/share/java/opencv4