Get OpenCV Build Information

Get OpenCV Build Information

OpenCV has many features, but some of them should be enabled at compile time using configuration options. If the OpenCV code snippet is not working on a specific environment, it is possible that necessary features were not enabled when binary files were compiled.

The getBuildInformation function can be used to get OpenCV build information, such as compiler version and flags, enabled features and third-party libraries, etc.

import cv2

info = cv2.getBuildInformation()
print(info)
#include <opencv2/opencv.hpp>

using namespace cv;

int main()
{
    std::string info = getBuildInformation();
    std::cout << info << std::endl;

    return 0;
}
package app;

import org.opencv.core.Core;

public class Main
{
    static { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }

    public static void main(String[] args)
    {
        String info = Core.getBuildInformation();
        System.out.println(info);

        System.exit(0);
    }
}

Output example:

General configuration for OpenCV 4.6.0 =====================================
  Version control:               unknown

  Platform:
    Timestamp:                   2022-08-27T13:23:27Z
    Host:                        Linux 5.15.0-43-generic x86_64
    Target:                      Linux aarch64
    CMake:                       3.22.1
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/gmake
    Configuration:               RELEASE
...
  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES
      avcodec:                   YES (58.91.100)
      avformat:                  YES (58.45.100)
      avutil:                    YES (56.51.100)
      swscale:                   YES (5.7.100)
      avresample:                YES (4.0.0)
    GStreamer:                   YES (1.18.4)
    v4l/v4l2:                    YES (linux/videodev2.h)
...

Leave a Comment

Cancel reply

Your email address will not be published.