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:
CV_MAJOR_VERSION
CV_MINOR_VERSION
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
print(cv2.getBuildInformtion())
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 cv2.so 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
How to Fill an Array With Random Values from a Range
Recursive Function That Returns All Substrings of a String
Sorting Output Numbers Without an Array
How to Determine the Boost Version on a System
Pass Parameter to Base Class Constructor While Creating Derived Class Object
Given an Integer N. What Is the Smallest Integer Greater Than N That Only Has 0 or 1 as Its Digits
How to Properly Clean Up Elements from Vectors of Object Pointers
How to Remove an Arbitrary Element from a Standard Heap in C++
Setting Timeout for C/C++ Function Call
Automatically Add All Files in a Folder to a Target Using Cmake
How to Take Input String Till End of Line in C++ Without the Use of Getline
Regex Match Digits Between Strings
Finding Version of Microsoft C++ Compiler from Command-Line (For Makefiles)
How to Read N Bytes from a File and Put Them into a Vector<Uint8_T> Using Iterators
How to Check Whether a String Contains Every Letter in the Alphabet in C++