I want to write to short code snippet in python, to determine which version of OpenCV has been installed in my System. How do i do it ? Thank you.
The OpenCV version is included in a special string variable named cv2. __version__ . All we need to do is check this variable and we'll be able to determine our OpenCV version.
It uses the Python 3 that comes with the system. If you want to use your own Python 3 installation, let's see how to install OpenCV for Python. Now you should have pip installed.
cv2 is the module import name for opencv-python, "Unofficial pre-built CPU-only OpenCV packages for Python". The traditional OpenCV has many complicated steps involving building the module from scratch, which is unnecessary.
>>> from cv2 import __version__
>>> __version__
'$Rev: 4557 $'
If that doesn't work then, use cv
instead of cv2
.
One line way can be like below:-
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With