opencv cmakes installation and dflags - Serbipunk/notes GitHub Wiki
Dependency
- BUILD_CUDA_STUBS (OFF)
- BUILD_IPP_IW (ON) Intel(R) Integrated Performance Primitives (Intel IPP) Integration Wrappercores in yours threading related
- BUILD_WITH_DYNAMIC_IPP (OFF)
- BUILD_ITT (ON) Intel ITT API old profiling library example
- BUILD_JASPER (OFF) JasPer is a free implementation of the JPEG-2000 Part-1 standard by Intel
- BUILD_JPEG (OFF) omit
- BUILD_OPENEXR (OFF) high-dynamic range format official site github
- BUILD_PNG (OFF)
- BUILD_PROTOBUF (ON)
- BUILD_TBB (OFF)
- BUILD_TIFF (OFF)
- BUILD_WEBP (OFF) ???
- BUILD_ZLIB (OFF) a data-compression library?
MKL_WITH_OPENMP OFF
MKL_WITH_TBB OFF
OPENCL_FOUND OFF WITH_1394 ON
WITH_ARAVIS OFF
WITH_CLP OFF
WITH_CUDA OFF
WITH_EIGEN ON
WITH_FFMPEG ON
WITH_GDAL OFF
WITH_GDCM OFF
WITH_GIGEAPI OFF
WITH_GPHOTO2 OFF
WITH_GSTREAMER ON
WITH_GSTREAMER_0_10 OFF
WITH_GTK ON
WITH_GTK_2_X OFF
WITH_HALIDE OFF
WITH_IMGCODEC_HDR ON
WITH_IMGCODEC_PXM ON
WITH_IMGCODEC_SUNRASTER ON
WITH_INF_ENGINE OFF
WITH_IPP ON
WITH_ITT ON
WITH_JASPER ON
WITH_JPEG ON
WITH_LAPACK ON
WITH_LIBV4L OFF
WITH_MFX OFF
WITH_OPENCL ON
WITH_OPENCLAMDBLAS ON
WITH_OPENCLAMDFFT ON
WITH_OPENCL_SVM OFF
WITH_OPENEXR ON
WITH_OPENGL OFF
WITH_OPENMP OFF
WITH_OPENNI OFF
WITH_OPENNI2 OFF
WITH_OPENVX OFF
WITH_PNG ON
WITH_PROTOBUF ON
WITH_PTHREADS_PF ON
WITH_PVAPI OFF
WITH_QT OFF
WITH_QUIRC ON
WITH_TBB OFF
WITH_TIFF ON
WITH_UNICAP OFF
WITH_V4L ON
WITH_VA OFF
WITH_VA_INTEL OFF
WITH_VTK ON
WITH_WEBP ON
WITH_XIMEA OFF
WITH_XINE OFF opencv_dnn_PERF_CAFFE OFF
opencv_dnn_PERF_CLCAFFE OFF
making language interface
- BUILD_JAVA
arguments receiver
BUILD_LIST
link
there is a BUILD_LIST feature, where you can specify the modules you want , overriding the existing BUILD_opencv_xxxx=ON settings. you'd use it like
cmake -DBUILD_LIST=dnn,core,calib3d,imgproc,imgcodecs,highgui
build component
BUILD_opencv_apps ON
BUILD_opencv_calib3d ON
BUILD_opencv_core ON
BUILD_opencv_dnn ON
BUILD_opencv_features2d ON
BUILD_opencv_flann ON
BUILD_opencv_highgui ON
BUILD_opencv_imgcodecs ON
BUILD_opencv_imgproc ON
BUILD_opencv_java_bindings_gen ON
BUILD_opencv_js OFF
BUILD_opencv_ml ON
BUILD_opencv_objdetect ON
BUILD_opencv_photo ON
BUILD_opencv_python_bindings_g ON
BUILD_opencv_python_tests ON
BUILD_opencv_shape ON
BUILD_opencv_stitching ON
BUILD_opencv_superres ON
BUILD_opencv_ts ON
BUILD_opencv_video ON
BUILD_opencv_videoio ON
BUILD_opencv_videostab ON
BUILD_opencv_world OFF
OPENCV_DNN_OPENCL OFF
Building component
- BUILD_DOCS
- BUILD_EXAMPLES
- BUILD_PERF_TESTS performance test
- BUILD_SHARED_LIBS
- BUILD_TESTS
Building preference
- BUILD_USE_SYMLINKS (OFF)
- BUILD_WITH_DEBUG_INFO (OFF)
- CV_DISABLE_OPTIMIZATION OFF
- CV_ENABLE_INTRINSICS ON
- CV_TRACE ON ??
ENABLE_BUILD_HARDENING OFF
ENABLE_CCACHE ON
ENABLE_CONFIG_VERIFICATION OFF
ENABLE_COVERAGE OFF ENABLE_CXX11 OFF
ENABLE_FAST_MATH OFF
ENABLE_FLAKE8 OFF
ENABLE_GNU_STL_DEBUG OFF
ENABLE_IMPL_COLLECTION OFF
ENABLE_INSTRUMENTATION OFF
ENABLE_LTO OFF
ENABLE_NOISY_WARNINGS OFF
ENABLE_OMIT_FRAME_POINTER ON
ENABLE_PIC ON
ENABLE_PRECOMPILED_HEADERS ON
ENABLE_PROFILING OFF
ENABLE_PYLINT OFF
ENABLE_SOLUTION_FOLDERS OFF
EXECUTABLE_OUTPUT_PATH /home/bai/lib/opencv-3.4.7/build/bin GENERATE_ABI_DESCRIPTOR OFF
INSTALL_CREATE_DISTRIB OFF
INSTALL_C_EXAMPLES OFF
INSTALL_PYTHON_EXAMPLES OFF
INSTALL_TESTS OFF
INSTALL_TO_MANGLED_PATHS OFF
OPENCV_DUMP_HOOKS_FLOW OFF
OPENCV_ENABLE_MEMORY_SANITIZER OFF
OPENCV_ENABLE_NONFREE OFF
OPENCV_EXTRA_MODULES_PATH
OPENCV_FORCE_3RDPARTY_BUILD OFF
OPENCV_GENERATE_PKGCONFIG ON
OPENCV_GENERATE_SETUPVARS ON
unknown
BUILD_PACKAGE (ON)
example of general configuration tables
-- General configuration for OpenCV 4.7.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Timestamp: 2023-06-17T05:20:52Z
-- Host: Linux 5.19.0-45-generic x86_64
-- CMake: 3.22.1
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/gmake
-- Configuration: Release
--
-- CPU/HW features:
-- Baseline: SSE SSE2 SSE3
-- requested: SSE3
-- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
-- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
-- SSE4_1 (18 files): + SSSE3 SSE4_1
-- SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
-- FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
-- AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
-- AVX2 (34 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
-- AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ standard: 11
-- C++ Compiler: /usr/bin/c++ (ver 11.3.0)
-- C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
-- Linker flags (Debug): -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies: dl m pthread rt
-- 3rdparty dependencies:
--
-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching ts video videoio
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: java python2 python3
-- Applications: tests perf_tests apps
-- Documentation: NO
-- Non-free algorithms: NO
--
-- GUI: NONE
-- QT: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
-- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
-- WEBP: build (ver encoder: 0x020f)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
-- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.3.0)
-- JPEG 2000: build (ver 2.4.0)
-- OpenEXR: build (ver 2.3.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
-- DC1394: NO
-- FFMPEG: NO
-- avcodec: NO
-- avformat: NO
-- avutil: NO
-- swscale: NO
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: pthreads
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2020.0.0 Gold [2020.0.0]
-- at: /home/bai/lib/opencv-4.7.0/build_with_qt/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2020.0.0)
-- at: /home/bai/lib/opencv-4.7.0/build_with_qt/3rdparty/ippicv/ippicv_lnx/iw
-- VA: NO
-- Lapack: NO
-- Eigen: NO
-- Custom HAL: NO
-- Protobuf: build (3.19.1)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/bai/lib/opencv-4.7.0/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load
--
-- Python (for build): /usr/bin/python3
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Install to: /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bai/lib/opencv-4.7.0/build_with_qt
using qt instead of gtk in linux
reference:
- download qt or apt install qt
I tried wget qt.run
- -DWITH_GTK*=OFF & -DWITH_QT=ON
Qt5Concurrent_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Concurrent
Qt5Core_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Core
Qt5Gui_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Gui
Qt5OpenGL_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5OpenGL
Qt5Test_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Test
Qt5Widgets_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5Widgets
Qt5_DIR = /home/raisa/Qt5.9.9/5.9.9/gcc_64/lib/cmake/Qt5
build with opencv contrib
https://docs.opencv.org/4.x/d7/d9f/tutorial_linux_install.html
mkdir opencv_481
cd opencv_481/
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.x.zip
unzip opencv.zip
unzip opencv_contrib.zip
mkdir -p build && cd build
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.x/modules ../opencv-4.x -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build . -j 8
sudo make install
using apt installed opencv lib
OPENCV_CFLAGS = $(shell pkg-config --cflags opencv)
OPENCV_LDFLAGS = $(shell pkg-config --libs opencv)
all: main
main: main.cc
g++ --std=c++11 $< $(OPENCV_LDFLAGS) -o $@
MacOS m4
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D BUILD_opencv_python3=OFF \
-D BUILD_opencv_java=OFF \
-D WITH_CUDA=OFF \
-D WITH_OPENCL=OFF \
-D WITH_IPP=OFF \
-D WITH_TBB=ON \
-D WITH_OPENMP=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_DOCS=OFF \
-D BUILD_EXAMPLES=OFF ..