How to Determine Opencv Version

Find OpenCV Version Installed on Ubuntu [duplicate]

You can look at the headers or libs installed. pkg-config can tell you where they are:

pkg-config --cflags opencv
pkg-config --libs opencv

Alternatively you can write a simple program and print the following defs:


A similar question has been also asked here:

Determine which version of OpenCV

>>> from cv2 import __version__
>>> __version__
'$Rev: 4557 $'

If that doesn't work then, use cv instead of cv2.

How to determine OpenCV version

You can check the CV_VERSION macro.

Is there a way to know the options with which OpenCV was installed?

Yes, there is a way. You can use getBuildInformation().

import cv2

In case of cpp,

std::cout << cv::getBuildInformation() << std::endl;

This will return information about cmake settings, version control, compiler flags, third-party libraries etc related to opencv installation.

How to check for openCV on Ubuntu 9.10

A proper answer to my own question !

pkg-config --modversion opencv

Any way to check opencv version in iOS project?

If you the framework file in the exact version, it is defined in there.

std::cout << CV_VERSION << std::endl;

(assuming C++)

If you don't have the dependencies, you can only look for strings in the binary or estimate from what features are used.

How to link python3 to a specific version of opencv?

I follow @Peter's suggestion print(cv2). I find a in /home/.local/lib/python3.6/site-packages/cv2 folder, but my OpenCV 4.5.0 was installed in usr/lib/python3.6/dist-packages/cv2.

Then, I removed the cv2 folder in /home/..., and I import cv2 again, and cv2.__version__ now is 4.5.0 and all functions worked.

Related Topics

Leave a reply