In this tutorial, we will introduce a quick way to check your OpenCV build settings.
If you have ever compiled or installed OpenCV, you know it can be compiled with an overwhelming number of options. For example, when installed on MacOS with Homebrew, OpenCV3 has the following options.
$ brew options opencv3 --c++11 Build using C++11 mode --with-contrib Build "extra" contributed modules --with-cuda Build with CUDA v7.0+ support --with-examples Install C and python examples (sources) --with-ffmpeg Build with ffmpeg support --with-gphoto2 Build with gphoto2 support --with-gstreamer Build with gstreamer support --with-jasper Build with jasper support --with-java Build with Java support --with-jpeg-turbo Build with libjpeg-turbo instead of libjpeg --with-libdc1394 Build with libdc1394 support --with-nonfree Enable non-free algorithms --with-opengl Build with OpenGL support (must use --with-qt) --with-openni Build with openni support --with-openni2 Build with openni2 support --with-python3 Build with python3 support --with-qt Build the Qt backend to HighGUI --with-quicktime Use QuickTime for Video I/O instead of QTKit --with-static Build static libraries --with-tbb Enable parallel code in OpenCV using Intel TBB --with-vtk Build with vtk support --without-eigen Build without eigen support --without-numpy Use a numpy you've installed yourself instead of a Homebrew-packaged numpy --without-opencl Disable GPU code in OpenCV using OpenCL --without-openexr Build without openexr support --without-python Build without Python support --without-test Build without accuracy & performance tests --HEAD Install HEAD version
It can be mind numbing to figure out what option you had used while compiling or installing OpenCV.
I had written a detailed post earlier on how to find OpenCV version.
But if you want the full build information, you need to use getBuildInformation. The usage is straightforward.
The C++ and Python code are listed below.
How to find OpenCV build information using C++ ?
The code for obtaining build information is shared below.
#include <opencv2/opencv.hpp> int main(void) { std::cout << cv::getBuildInformation() << std::endl; }
How to find OpenCV build information using Python?
The code for obtaining build information using python is shared below.
import cv2 print cv2.getBuildInformation()
Output of getBuildInformation
I have shared an example of getBuildInformation output below. This is very useful to share when asking questions in a forum.
General configuration for OpenCV 3.2.0 ===================================== Version control: unknown Extra modules: Location (extra): /tmp/opencv3-20170521-37568-15s9x5w/opencv-3.2.0/opencv_contrib/modules Version control (extra): unknown Platform: Timestamp: 2017-05-21T18:48:31Z Host: Darwin 16.6.0 x86_64 CMake: 3.8.1 CMake generator: Unix Makefiles CMake build tool: /usr/local/Homebrew/Library/Homebrew/shims/super/gmake Configuration: Release C/C++: Built as dynamic libs?: YES C++ Compiler: /usr/local/Homebrew/Library/Homebrew/shims/super/clang++ (ver 8.1.0.8020042) C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mavx -mavx2 -fvisibility=hidden -fvisibility-inlines-hidden -mf16c -DNDEBUG -DNDEBUG C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mavx -mavx2 -fvisibility=hidden -fvisibility-inlines-hidden -mf16c -g -O0 -DDEBUG -D_DEBUG C Compiler: /usr/local/Homebrew/Library/Homebrew/shims/super/clang C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mavx -mavx2 -fvisibility=hidden -fvisibility-inlines-hidden -mf16c -DNDEBUG -DNDEBUG C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mavx -mavx2 -fvisibility=hidden -fvisibility-inlines-hidden -mf16c -g -O0 -DDEBUG -D_DEBUG Linker flags (Release): Linker flags (Debug): ccache: NO Precompiled headers: NO Extra dependencies: -framework OpenCL /usr/local/opt/jpeg/lib/libjpeg.dylib /usr/local/lib/libpng.dylib /usr/local/lib/libtiff.dylib /usr/local/lib/libImath.dylib /usr/local/lib/libIlmImf.dylib /usr/local/lib/libIex.dylib /usr/local/lib/libHalf.dylib /usr/local/lib/libIlmThread.dylib avcodec avformat avutil swscale avresample -framework VideoDecodeAcceleration bz2 -framework Cocoa -framework AVFoundation -framework CoreGraphics -framework CoreMedia -framework CoreVideo -framework QuartzCore /usr/local/lib/libhdf5.dylib /usr/local/lib/libsz.dylib /usr/lib/libz.dylib /usr/lib/libdl.dylib /usr/lib/libm.dylib /usr/local/lib/libtesseract.dylib /usr/local/lib/liblept.dylib tbb -framework Accelerate 3rdparty dependencies: libwebp libprotobuf OpenCV modules: To be built: core flann hdf imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo tracking videostab xfeatures2d ximgproc aruco optflow phase_unwrapping stitching structured_light matlab python2 Disabled: world contrib_world Disabled by dependency: - Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python3 ts viz cnn_3dobj cvv freetype sfm GUI: QT: NO Cocoa: YES OpenGL support: NO VTK support: NO Media I/O: ZLib: /usr/lib/libz.dylib (ver 1.2.8) JPEG: /usr/local/opt/jpeg/lib/libjpeg.dylib (ver 80) WEBP: build (ver 0.3.1) PNG: /usr/local/lib/libpng.dylib (ver 1.6.29) TIFF: /usr/local/lib/libtiff.dylib (ver 42 - 4.0.7) JPEG 2000: NO OpenEXR: /usr/local/lib/libImath.dylib /usr/local/lib/libIlmImf.dylib /usr/local/lib/libIex.dylib /usr/local/lib/libHalf.dylib /usr/local/lib/libIlmThread.dylib (ver 2.2.0) GDAL: NO GDCM: NO Video I/O: DC1394 1.x: NO DC1394 2.x: NO FFMPEG: YES avcodec: YES (ver 57.89.100) avformat: YES (ver 57.71.100) avutil: YES (ver 55.58.100) swscale: YES (ver 4.6.100) avresample: YES (ver 3.5.0) GStreamer: NO OpenNI: NO OpenNI PrimeSensor Modules: NO OpenNI2: NO PvAPI: NO GigEVisionSDK: NO Aravis SDK: NO AVFoundation: YES V4L/V4L2: NO/NO XIMEA: NO gPhoto2: NO Parallel framework: TBB (ver 2017.0 interface 9106) Other third-party libraries: Use IPP: 9.0.1 [9.0.1] at: /tmp/opencv3-20170521-37568-15s9x5w/opencv-3.2.0/macbuild/3rdparty/ippicv/ippicv_osx Use IPP Async: NO Use VA: NO Use Intel VA-API/OpenCL: NO Use Lapack: YES (-framework Accelerate) Use Eigen: YES (ver 3.3.3) Use Cuda: NO Use OpenCL: YES Use OpenVX: NO Use custom HAL: NO OpenCL: <Link with OpenCL library> Include path: /usr/local/include /usr/local/include Link libraries: -framework OpenCL Use AMDFFT: YES Use AMDBLAS: YES Python 2: Interpreter: /usr/bin/python (ver 2.7.10) Libraries: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (ver 2.7.10) numpy: /usr/local/lib/python2.7/site-packages/numpy/core/include (ver 1.12.1) packages path: lib/python2.7/site-packages Python 3: Interpreter: /usr/local/bin/python3 (ver 3.6.1) Python (for build): /usr/bin/python Java: ant: NO JNI: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/include /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/include/darwin /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/include Java wrappers: NO Java tests: NO Matlab: mex: /Applications/MATLAB_R2016b.app/bin/mex Compiler/generator: Working Documentation: Doxygen: /usr/local/bin/doxygen (ver 1.8.11) Tests and samples: Tests: NO Performance tests: NO C/C++ Examples: NO Install path: /usr/local/Cellar/opencv3/3.2.0 cvconfig.h is in: /tmp/opencv3-20170521-37568-15s9x5w/opencv-3.2.0/macbuild -----------------------------------------------------------------
Subscribe & Download Code
If you liked this article and would like to download code (C++ and Python) and example images used in all posts in this blog, please subscribe to our newsletter. You will also receive a free Computer Vision Resource Guide. In our newsletter, we share OpenCV tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.