As OpenCV is a complex beast, to ensure the full installation of OpenCV is working correctly we perform the following tests.
All tested with OpenCV 3.x and Python 3.x.
Assumes that git and wget tools are available on the command line or that similar tools are available to access git / download files.
(For testing on MS Windows, download and unzip example files from source URL as specified - here - onto the user space J:/ drive).
(for testing on MS Windows at Durham (DUDE system), open all .py
scripts from J:/ in IDLE and run module from there)
git clone https://github.com/tobybreckon/python-examples-ip.git
cd python-examples-ip
python3 ./version.py
- Text output to console such that:
We are using OpenCV: CCC
.. do we have the Open CV Contrib Modules: True
.. do we have the OpenCV Non-free algorithms: True
We are using numpy: <???>
We are using matplotlib: <???>
.. and this is in Python: PPP
- such that CCC >= 3.3.x (or higher); PPP > 3.x; ??? = (doesn't matter).
[ to build with Non-free algorithms set OPENCV_ENABLE_NONFREE=TRUE in CMake ]
Only to be used if building OpenCV from source (any platform) or using a pre-built version from a 3rd party repository (on Linux / Mac OS).
.. (as per test 1 for steps 1 + 2)
python3 ./checkbuildinfo.py
- The resulting build element information should ideally contain the following as a subset of the configuration (where present indicates a reference to a system file or a version number that tells us it is present on the system / in the build):
build element | Linux | MS Windows |
---|---|---|
Platform: ... Configuration: | Release | Release |
Built as dynamic libs: | YES | YES |
OpenCV modules: | contains: core flann ... imgproc ... ml ... imgcodecs ... videoio .. xfeatures2d ... ximgproc ... optflow ... stitching | <-- same as Linux |
Non-free algorithms: | YES | YES |
QT: | NO | NO |
GTK+ 2.x: | YES | NO |
ZLib: | present | present |
JPEG: | present | present |
WEBP: | present | present |
PNG: | present | present |
JPEG 2000: | present | present |
OpenEXR: | present | present |
PNG: | present | present |
FFMPEG: | YES (all sub-elements) | NO |
GStreamer: | YES (all sub-elements) | NO |
V4L/V4L2: | present | NO |
XINE: | YES | NO |
gPhoto2: | YES | NO |
Parallel framework: | pthreads | ??? |
Use IPP: | present | NO |
(for MS Windows download image from here and save as example.jpg in directory python-examples-ip-master)
.. (as per test 1 for steps 1 + 2)
wget https://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg
mv JPEG_example_JPG_RIP_100.jpg example.jpg
python3 ./smooth_image.py
- image is displayed in window (a blurred version of example.jpg), pressing 'x' closes window.
.. (as per test 1 for steps 1 + 2)
<<< connect a usb web-cam (any web-cam)
python3 ./save_video.py
- possible error message such as "???... ???? Unable to open source 'input.avi'" - ignore this.
- a window appears with live video from camera, pressing 'x' closes window and ends program (saving a video file).
- video file saved as output.avi file can be played in vlc or similar.
- Ignore "cannot open video messages" from ffpmeg/xine or similar (this is it failing to open video file as alt. to camera, not write from camera).
(for MS Windows download video from here and save as video.avi in directory python-examples-ip-master)
.. (as per test 1 for steps 1 + 2)
wget http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4
mv big_buck_bunny.mp4 video.avi
python3 ./capture_video.py
- The video available at http://camendesign.co.uk/code/video_for_everybody/test.html is played back in a window, but with no audio.