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 LFS or dependencies have been updated since the most recent stable versions of the books.
Download (HTTP): https://github.com/opencv/opencv/archive/4.12.0/opencv-4.12.0.tar.gz
Download MD5 sum: eb6f8ff4f4cd16ef1b97bc21edc74de9
Download size: 91 MB
Estimated disk space required: 1.0 GB (with opencv-contrib)
Estimated build time: 3.6 SBU (using parallelism=8)
Optional additional modules: https://github.com/opencv/opencv_contrib/archive/4.12.0/opencv_contrib-4.12.0.tar.gz
Optional additional modules md5sum: 55603c033cc5f3d5e307b699ad72e25a
Optional additional modules Size: 53 MB
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.
CMake-4.0.3 and libarchive-3.8.1
FFmpeg-7.1.1, gst-plugins-base-1.26.4, GTK-3.24.49, jasper-4.2.5, libavif-1.3.0, libexif-0.6.25, libjpeg-turbo-3.0.1, libpng-1.6.50, libtiff-4.7.0, libwebp-1.6.0, OpenJPEG-2.5.3, v4l-utils-1.30.1, and xine-lib-1.2.13
apache-ant-1.10.15, Doxygen-1.14.0, Java-24.0.1, NumPy-2.3.1, Protobuf-31.1, ATLAS, blas, Cuda, Eigen, OpenEXR, GDAL, lapack, libdc1394, Threading Building Blocks (TBB), and VTK - The Visualization Toolkit,
If you downloaded the optional modules, unpack them now:
tar -xf ../opencv_contrib-4.12.0.tar.gz
Install opencv by running the following commands:
mkdir build && cd build && cmake -D CMAKE_INSTALL_PREFIX=/usr \ -D CMAKE_BUILD_TYPE=Release \ -D ENABLE_CXX11=ON \ -D BUILD_PERF_TESTS=OFF \ -D WITH_XINE=ON \ -D BUILD_TESTS=OFF \ -D ENABLE_PRECOMPILED_HEADERS=OFF \ -D CMAKE_SKIP_INSTALL_RPATH=ON \ -D BUILD_WITH_DEBUG_INFO=OFF \ -D OPENCV_GENERATE_PKGCONFIG=ON \ -D CMAKE_POLICY_VERSION_MINIMUM=3.5 \ -W no-dev .. && make
The package does not come with a test suite.
Now, as the root
user:
make install
-D
CMAKE_POLICY_VERSION_MINIMUM=3.5
: This switch allows
building this package with cmake-4.0 or newer.
-D
CMAKE_SKIP_INSTALL_RPATH=ON
: This switch makes
cmake remove
hardcoded library search paths (rpath) when installing a binary
executable file or a shared library. This package does not need
rpath once it's installed into the standard location, and rpath may
sometimes cause unwanted effects or even security issues.
-D WITH_XINE=ON
: This
switch instructs the make procedure to use xine-lib-1.2.13.
-D
ENABLE_PRECOMPILED_HEADERS=OFF
: This switch is needed
for compatibility with gcc-6.1 and later.
-D
OPENCV_GENERATE_PKGCONFIG=ON
: This switch tells the
build system to generate a pkg-config file for other packages to
detect and link to the libraries installed by this package.
-D
OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.12.0/modules
:
instructs the build system to build additional modules. Some
packages in BLFS (such as gst-plugins-bad-1.26.4) need these
modules to build components that use OpenCV.