Mastering OpenCV 4 with Python requires some installed packages, which you can see here:
- Chapter 1, Setting Up OpenCV: opencv-contrib-python
- Chapter 2, Image Basics in OpenCV: opencv-contrib-python and matplotlib
- Chapter 3, Handling Files and Images: opencv-contrib-python and matplotlib
- Chapter 4, Constructing Basic Shapes in OpenCV: opencv-contrib-python and matplotlib
- Chapter 5, Image Processing Techniques: opencv-contrib-python and matplotlib
- Chapter 6, Constructing and Building Histograms: opencv-contrib-python and matplotlib
- Chapter 7, Thresholding Techniques: opencv-contrib-python, matplotlib, scikit-image, and scipy
- Chapter 8, Contours Detection, Filtering, and Drawing: opencv-contrib-python and matplotlib
- Chapter 9, Augmented Reality: opencv-contrib-python and matplotlib
- Chapter 10, Machine Learning with OpenCV: opencv-contrib-python and matplotlib
- Chapter 11, Face Detection, Tracking, and Recognition: opencv-contrib-python, matplotlib, dlib, face-recognition, cvlib, requests, progressbar, keras, and tensorflow
- Chapter 12, Introduction to Deep Learning: opencv-contrib-python, matplotlib, tensorflow, and keras
- Chapter 13, Mobile and Web Computer Vision with Python and OpenCV: opencv-contrib-python, matplotlib, flask, tensorflow, keras, requests, and pillow
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:
- Install opencv-contrib-python:
pip install opencv-contrib-python==4.0.0.21
It should be noted that OpenCV requires numpy. numpy-1.16.1 has been installed when installing opencv-contrib-python==4.0.0.21.
Run the following command to install Matplotlib library:
- Install matplotlib:
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:
- Install scikit-image:
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:
- Install scipy:
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:
- Install dlib:
pip install dlib==19.8.1
To install the face recognition library, run the following command:
- Install face-recognition:
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:
- Install cvlib:
pip install cvlib==0.1.8
To install requests library run the following command:
- Install requests:
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:
- Install progressbar:
pip install progressbar==2.5
Run the following command to install Keras library for deep learning:
- Install keras:
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.0, keras-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:
- Install tensorflow:
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:
- Install flask:
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.