Code testing specifications

Mastering OpenCV 4 with Python requires some installed packages, which you can see here:

Make sure that the version numbers of your installed packages are equal to, or greater than, versions specified here to ensure that the code examples run correctly.

If you want to install the exact versions this book was tested on, include the version when installing from pip, which is indicated as follows.

Run the following command to install the both main and contrib modules:

pip install opencv-contrib-python==4.0.0.21

It should be noted that OpenCV requires numpynumpy-1.16.1 has been installed when installing opencv-contrib-python==4.0.0.21.

Run the following command to install Matplotlib library:

pip install matplotlib==3.0.2

It should be noted that matplotlib requires kiwisolver, pyparsing, six, cycler, and python-dateutil.

cycler-0.10.0, kiwisolver-1.0.1, pyparsing-2.3.1, python-dateutil-2.8.0, and six-1.12.0 have been installed when installing matplotlib==3.0.2.

Run the following command to install library which contains collections of algorithm for image processing:

pip install scikit-image==0.14.2

It should be noted that scikit-image requires cloudpickle, decorator, networkx, numpy, toolz, dask, pillow, PyWavelets, and six.

PyWavelets-1.0.1, cloudpickle-0.8.0, dask-1.1.1, decorator-4.3.2, networkx-2.2, numpy-1.16.1, pillow-5.4.1, six-1.12.0, and toolz-0.9.0 have been installed when installing scikit-image==0.14.2.

If you need SciPy, you can install it with the following command:

pip install scipy==1.2.1 

It should be noted that scipy requires numpy.

numpy-1.16.1 has been installed when installing scipy==1.2.1.

Run the following command to install dlib library: 

pip install dlib==19.8.1

To install the face recognition library, run the following command:

pip install face-recognition==1.2.3

It should be noted that face-recognition requires dlib, Click, numpy, face-recognition-models, and pillow.

dlib-19.8.1, Click-7.0, face-recognition-models-0.3.0, and pillow-5.4.1 have been installed when installing face-recognition==1.2.3.

Run the following command to install open source computer vision library:

pip install cvlib==0.1.8

To install requests library run the following command:

pip install requests==2.21.0

It should be noted that requests requires urllib3, chardet, certifi, and idna.

urllib3-1.24.1, chardet-3.0.4, certifi-2018.11.29, and idna-2.8 have been installed when installing requests==2.21.0.

Run the following command to install text progress bar library:

pip install progressbar==2.5 

Run the following command to install Keras library for deep learning:

pip install keras==2.2.4

It should be noted that keras requires numpy, six, h5py, keras-applications, scipy, keras-preprocessing, and pyyaml.

h5py-2.9.0keras-applications-1.0.7, keras-preprocessing-1.0.9, numpy-1.16.1 pyyaml-3.13, and scipy-1.2.1 six-1.12.0 have been installed when installing keras==2.2.4.

Run the following command to install TensorFlow library: 

pip install tensorflow==1.12.0 

It should be noted that TensorFlow requires termcolor, numpy, wheel, gast, six, setuptools, protobuf, markdown, grpcio, werkzeug, tensorboard, absl-py, h5py, keras-applications, keras-preprocessing, and astor.

termcolor-1.1.0, numpy-1.16.1, wheel-0.33.1, gast-0.2.2, six-1.12.0, setuptools-40.8.0, protobuf-3.6.1, markdown-3.0.1, grpcio-1.18.0, werkzeug-0.14.1, tensorboard-1.12.2, absl-py-0.7.0, h5py-2.9.0, keras-applications-1.0.7, keras-preprocessing-1.0.9, and astor-0.7.1 have been installed when installing tensorflow==1.12.0.

Run the following command to install Flask library:

pip install flask==1.0.2

It should be noted that flask requires Werkzeug, click, itsdangerous, and MarkupSafe Jinja2.

Jinja2-2.10, MarkupSafe-1.1.1, Werkzeug-0.14.1, click-7.0, and itsdangerous-1.1.0 have been installed when installing flask==1.0.2.