ubuntu 22.04 编译 opencv4.10.0
apt update
apt -y install wget vim unzip cmake build-essential
apt -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
apt -y install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
apt -y install libgtk-3-dev libfreeimage3 libfreeimage-dev
apt -y install libpng-dev libjpeg-dev libopenexr-dev libtiff-dev libwebp-dev libdc1394-dev
apt -y install pkg-config libfreetype-dev libharfbuzz-dev
mkdir -p /home/hesy/opencv && cd /home/hesy/opencv
wget https://github.com/opencv/opencv/archive/refs/tags/4.10.0.tar.gz
wget https://github.com/opencv/opencv_contrib/archive/refs/tags/4.10.0.zip
unzip 4.10.0.zip
tar xvf 4.10.0.tar.gz
cd opencv-4.10.0
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_IPP=OFF -D WITH_OPENGL=OFF -D WITH_QT=OFF -D OPENCV_ENABLE_NONFREE=ON -D OPENCV_EXTRA_MODULES_PATH=/home/hesy/opencv/opencv_contrib-4.10.0/modules -D BUILD_EXAMPLES=OFF -D WITH_JASPER=OFF -D BUILD_DOCS=OFF -D BUILD_TESTS=OFF -D BUILD_opencv_java=NO -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -DWITH_FREETYPE=ON -DBUILD_png=ON ..
make -j6
make install
tar czvf opencv-dev-4.10.0.tar.gz /usr/local/include usr/local/lib
配置输出内容
-- OpenCV modules:
-- To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape signal stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: python3 world
-- Disabled by dependency: -
-- Unavailable: cannops cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv hdf java julia matlab ovis python2 sfm viz
-- Applications: perf_tests apps
-- Documentation: NO
-- Non-free algorithms: YES
--
-- GUI: GTK3
-- GTK+: YES (ver 3.24.33)
-- GThread : YES (ver 2.72.4)
-- GtkGlExt: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: /usr/lib/aarch64-linux-gnu/libwebp.so (ver encoder: 0x020f)
-- PNG: build (ver 1.6.43)
-- SIMD Support Request: YES
-- SIMD Support: YES (Arm NEON)
-- TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.3.0)
-- JPEG 2000: build (ver 2.5.0)
-- OpenEXR: /usr/lib/aarch64-linux-gnu/libImath-2_5.so /usr/lib/aarch64-linux-gnu/libIlmImf-2_5.so /usr/lib/aarch64-linux-gnu/libIex-2_5.so /usr/lib/aarch64-linux-gnu/libHalf-2_5.so /usr/lib/aarch64-linux-gnu/libIlmThread-2_5.so (ver 2_5)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: YES (2.2.6)
-- FFMPEG: YES
-- avcodec: YES (58.134.100)
-- avformat: YES (58.76.100)
-- avutil: YES (56.70.100)
-- swscale: YES (5.9.100)
-- avresample: NO
-- GStreamer: YES (1.20.3)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Lapack: NO
-- Eigen: YES (ver 3.4.0)
-- Custom HAL: YES (carotene (ver 0.0.1, Auto detected))
-- Protobuf: build (3.19.1)
-- Flatbuffers: builtin/3rdparty (23.5.9)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/hesy/opencv/opencv-4.10.0/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python (for build): /usr/bin/python3
--
-- Java:
-- ant: NO
-- Java: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done