Title: Ubuntu 18.04: How to install OpenCV - PyImageSearch

URL Source: https://pyimagesearch.com/2018/05/28/ubuntu-18-04-how-to-install-opencv/

Published Time: 2018-05-28T14:00:37+00:00

Markdown Content:
[![Image 1](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20449'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2018/05/install_opencv-1804-header.jpg)

**In this blog post you will learn how to install OpenCV on Ubuntu 18.04.**

In the past, I’ve authored a handful of installation guides for Ubuntu:

*   [Ubuntu 16.04: How to install OpenCV with Python 2.7 and Python 3.5+](https://pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/)
*   [Install OpenCV 3.0 and Python 2.7+ on Ubuntu](https://pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/)
*   [Install OpenCV 3.0 and Python 3.4+ on Ubuntu](https://pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/)
*   (…and be sure to see [this page](https://pyimagesearch.com/opencv-tutorials-resources-guides/) if you’re looking for macOS and Raspberry Pi installation guides)

The folks at Canonical have been working hard.

On April 26, 2018, they’ve released a new Long Term Support (LTS) version of Ubuntu for the community: **Ubuntu 18.04 LTS (Bionic Beaver)**.

Support for Ubuntu 16.04 LTS continues until April 2021 so rest-assured — _you don’t have to upgrade your 16.04 OS to continue working on your image processing projects._

That said, if you want to upgrade to Ubuntu 18.04 and use the latest-and-greatest, I think you’ll be quite pleased with the new changes in Ubuntu 18.04.

Let’s get down to business and install OpenCV with Python 3 bindings.

**To learn how to stand up your Ubuntu 18.04 system with OpenCV, _just keep reading._**

_**Note:** While you won’t see an Ubuntu 17.10 specific guide here on my blog (_non_\-LTS), these instructions may work with 17.10 (you’ll just have to proceed at your own risk)._

**One major change in [Ubuntu 18.04](https://wiki.ubuntu.com/Releases) is that they’ve dropped Python 2.7 completely.**

You can still install Python 2.7 _if-needed_, **but now Python 3 is the default on the OS.**

Given that, this guide supports Python 3. If you need Python 2.7 support, read this entire guide _first_ and then check the first question of the **Troubleshooting your install (FAQ)** section near the bottom of this blog post for some Python 2.7 pointers.

### Step #0: Get comfortable — you’ll be using Python 3.6

Let’s familiarize ourselves with Python 3 on Ubuntu 18.04.

To run Python 3 on Ubuntu 18.04, you must call `python3` explicitly.

Let’s see which version is installed on our system:

$ python3 --version
Python 3.6.5

And now, let’s launch a Python 3 shell just to test the waters:

$ python3
>> print("OpenCV + Ubuntu 18.04!")
OpenCV + Ubuntu 18.04!
>> quit()

That’s easy enough, so let’s get on with installing OpenCV on Ubuntu 18.04.

### Step #1: Install OpenCV dependencies on Ubuntu 18.04

All steps today will be accomplished in the terminal/command line. Before we begin, open a terminal or connect via SSH.

From there, we need to refresh/upgrade the pre-installed packages/libraries with the [apt-get](https://help.ubuntu.com/community/AptGet/Howto) package manager:

$ sudo apt-get update
$ sudo apt-get upgrade

Followed by installing developer tools:

$ sudo apt-get install build-essential cmake unzip pkg-config

You most likely already have `pkg-config` installed on Ubuntu 18.04, but be sure to include it in the install command for sanity.

Next, we need to install some OpenCV-specific prerequisites. OpenCV is an image processing/computer vision library and therefore it needs to be able to load standard image file formats such as JPEG, PNG, TIFF, etc. The following image I/O packages will allow OpenCV to work with image files:

$ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev

Now let’s try to install `libjasper-dev` :

$ sudo apt-get install libjasper-dev

**If you receive an error about `libjasper-dev` being missing then follow the following instructions:**

sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev

**Otherwise (or once `libjasper-dev` is installed), keep going.**

Next, let’s include video I/O packages as we often work with video on the PyImageSearch blog. You’ll need the following packages so you can work with your camera stream and process video files:

$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
$ sudo apt-get install libxvidcore-dev libx264-dev

OpenCV’s highgui module relies on the GTK library for GUI operations. The highgui module will allow you to create elementary GUIs which display images, handle kepresses/mouse clicks, and create sliders and trackbars. Advanced GUIs should be built with TK, Wx, or QT. See [this blog post](https://pyimagesearch.com/2016/05/30/displaying-a-video-feed-with-opencv-and-tkinter/) to learn how to make an OpenCV GUI with TK.

Let’s install GTK:

$ sudo apt-get install libgtk-3-dev

I always recommend the following two libraries which will optimize various OpenCV functions:

$ sudo apt-get install libatlas-base-dev gfortran

And finally, our last requirement is to install Python 3 headers and libraries:

$ sudo apt-get install python3.6-dev

### Step #2: Download the official OpenCV source

_**Update 2018-12-20: These instructions have been updated to work with OpenCV 3.4.4.** These instructions should continue to work with future OpenCV 3.x versions as well._

Since we’re continuing to work in the terminal, let’s download the official OpenCV release using `wget` :

$ cd ~
$ wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.4.zip

Followed by the `opencv_contrib` module:

$ wget -O opencv\_contrib.zip https://github.com/opencv/opencv\_contrib/archive/3.4.4.zip

_**Note:** If your browser is cutting off the full command either use the_ “<>” _button in the toolbar above to expand the code block or copy and paste the following URL: https://github.com/opencv/opencv\_contrib/archive/3.4.4.zip_

So, what’s the contrib repo?

The contrib repository contains algorithms such as SIFT, SURF, and others. In the past, these implementations were included in the default installation of OpenCV 2.4; however, they were moved beginning with OpenCV 3+.

Modules that are actively being developed and/or modules that are patented (not free for commercial/industry use) are included in the contrib module. SIFT and SURF fall into this category. You can learn more about the thought process behind this move in the following blog post: _[Where did SIFT and SURF go in OpenCV 3?](https://pyimagesearch.com/2015/07/16/where-did-sift-and-surf-go-in-opencv-3/)_

_**Important:** Both `opencv` and `opencv_contrib` versions must be identical. Notice that both URLs point to 3.4.4. Feel free to install a different version while still using this guide — just be sure to update both URLs._

Now, let’s unzip the archives:

$ unzip opencv.zip
$ unzip opencv\_contrib.zip

[![Image 2](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20451'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2018/05/install_opencv-1804-ls.jpg)

**Figure 1:** After downloading and unzipping `opencv` and `opencv_contrib`, our home directory listing should look similar to what is displayed in the terminal.

Now let’s go ahead and rename the directories:

$ mv opencv-3.4.4 opencv
$ mv opencv\_contrib-3.4.4 opencv\_contrib

### Step #3: Configure your Python 3 environment

The first step we’re taking to configure our Python 3 development environment is to install pip, a Python Package Manager.

To install pip, simply enter the following in your terminal:

$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py

#### Making use of virtual environments for Python development

If you are familiar with my blog and install guides therein, the following statement might make me sound like a broken record but I’ll repeat it anyway:

I use both [virtualenv](https://virtualenv.pypa.io/en/latest/) and [virtualenvwrapper](https://virtualenvwrapper.readthedocs.org/en/latest/) daily and you should too unless you have a very specific reason not to. These two Python packages facilitate creating independent Python environments for your projects.

**It is a best practice to use virtual environments.**

Why?

Virtual environments allow you to work on your projects in isolation without spinning up resource hogs such as VMs and Docker images (I definitely do use both VirtualBox and Docker — they have their place).

For example, maybe you have a Python + OpenCV project that requires an older version of scikit-learn (v0.14) but you want to keep using the latest version of scikit-learn (0.19) for all of your newer projects.

Using virtual environments, you could handle these two software version dependencies separately, something that is not possible using _just_ the system install of Python.

If you would like more information about Python virtual environments take a look at this [article on RealPython](https://realpython.com/blog/python/python-virtual-environments-a-primer/) or read the first half of the [this blog post on PyImageSearch](https://pyimagesearch.com/2016/05/02/accessing-rpi-gpio-and-gpio-zero-with-opencv-python/).

Let’s go ahead and install `virtualenv` and `virtualenvwrapper` now:

$ sudo pip install virtualenv virtualenvwrapper
$ sudo rm -rf ~/get-pip.py ~/.cache/pip

To finish the install we need to update our `~/.bashrc` file.

Using a terminal text editor such as `vi` /`vim` or `nano` , add the following lines to your `~/.bashrc` :

\# virtualenv and virtualenvwrapper
export WORKON\_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER\_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh

Alternatively, you can append the lines directly via bash commands:

$ echo -e "\\n# virtualenv and virtualenvwrapper" >> ~/.bashrc
$ echo "export WORKON\_HOME=$HOME/.virtualenvs" >> ~/.bashrc
$ echo "export VIRTUALENVWRAPPER\_PYTHON=/usr/bin/python3" >> ~/.bashrc
$ echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc

Next, source the `~/.bashrc` file:

$ source ~/.bashrc

#### Creating a virtual environment to hold OpenCV and additional packages

Ok, while that may have seemed like a lot of work, we’re at the point where we can create your Python 3 virtual environment for OpenCV:

$ mkvirtualenv cv -p python3

This line simply creates a Python 3 virtual environment named `cv` . You can name your environment(s) whatever you’d like — I like to keep them short and sweet while also providing enough information so I’ll remember what they are for. You can have as many virtual environments on your system as you’d like!

Let’s verify that we’re in the cv environment by using the workon command:

$ workon cv

**Figure 2** shows what your terminal will look like (assuming you haven’t changed any bash prompt settings):

[![Image 3](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20451'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2018/05/install_opencv-1804-workon.jpg)

**Figure 2:** If you see the `(cv)` at the beginning of the bash prompt, then your virtual environment is active and you’re working “inside” the environment. You can now safely install OpenCV with correct Python bindings.

#### Install NumPy in your environment

Let’s install our first package into the environment: NumPy. NumPy is a requirement for working with Python and OpenCV. We simply use pip (while the `cv` Python virtual environment is active):

$ pip install numpy

### Step #4: Configure and compile OpenCV for Ubuntu 18.04

Now we’re moving. We’re ready to compile and install OpenCV.

Before we begin though, let’s ensure that we’re in the cv virtual environment:

$ workon cv

It is very important that the virtual environment is active (you are “inside” the virtual environment) which is why I keep reiterating it. If you are _not_ in the `cv` Python virtual environment before moving on to the next step your build files will not be generated properly.

#### Configure OpenCV with CMake

Let’s set up our OpenCV build using `cmake` :

$ cd ~/opencv
$ mkdir build
$ cd build
$ cmake -D CMAKE\_BUILD\_TYPE=RELEASE \\
    -D CMAKE\_INSTALL\_PREFIX=/usr/local \\
    -D WITH\_CUDA=OFF \\
    -D INSTALL\_PYTHON\_EXAMPLES=ON \\
    -D OPENCV\_EXTRA\_MODULES\_PATH=~/opencv\_contrib/modules \\
    -D OPENCV\_ENABLE\_NONFREE=ON \\
    -D BUILD\_EXAMPLES=ON ..

_**Update 2018-12-20:**_ _Be sure to set the `OPENCV_ENABLE_NONFREE=ON` flag so you’ll have access to patented algorithms that we sometimes review on this blog (and cover in depth in [PyImageSearch Gurus](https://pyimagesearch.com/pyimagesearch-gurus/)). Likewise, be sure to update the path to your virtual environment so that the correct `PYTHON_EXECUTABLE` will be used (notice `cv` in the path since our virtual environment name is `cv` )._

I always recommend that you scroll through the CMake output and check to see if anything looks out of the ordinary. You won’t see a “YES” marked next to every setting — that is normal. Be sure you don’t see any errors or your compile may fail (warnings are okay).

[![Image 4](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20451'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2018/05/install_opencv-1804-cmake-output-zoomout.jpg)

**Figure 3:** To compile OpenCV for Ubuntu 18.04, we make use of CMake. The CMake tool will configure settings prior to compilation.

Take a moment to notice that only _“Python 3”_ section is shown in the CMake output on Ubuntu 18.04 in **Figure 3**. This is by design as we are only compiling OpenCV with Python 3 support.

_**Update 2018-12-20:** Additionally, scroll up about 20 lines and make sure **“Non-free algorithms”** is set to **“YES”**._

_**Note:** If you are encountering problems related to `stdlib.h: No such file or directory` during either the `cmake` or `make` phase of this tutorial you’ll also need to include the following option to CMake: `-D ENABLE_PRECOMPILED_HEADERS=OFF` . In this case I would suggest deleting your build directory, re-creating it, and then re-running `cmake` with the above option included. This will resolve the `stdlib.h` error._

#### Compiling OpenCV on Ubuntu 18.04

Let’s compile OpenCV using `make` .

Depending on the number of processors/cores, you may be able to reduce compile time by altering the flag in the command. My computer has 4 cores, so I am using the `-j4` flag. You can update the numeral or leave the flag off altogether:

$ make -j4

[![Image 5](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20447'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2018/05/install_opencv-1804-compile-finished.jpg)

**Figure 4:** To compile OpenCV with Python 3 on Ubuntu 18.04, we use `make`. Using make compiles OpenCV from source and is preferred over using package managers for installing OpenCV.

This process may take 30 minutes or longer, so go for a nice walk if you are able.

If your compile chokes and hangs, it may be due to a threading race condition. In the event you run into this problem, simply delete your `build` directory, recreate it, and re-run `cmake` and `make` . This time do not include the flag next to `make` .

#### Installing and verifying OpenCV

Upon a successful, 100% complete compile you can now install OpenCV:

$ sudo make install
$ sudo ldconfig

To verify the install, sometimes I like to enter the following command in the terminal:

$ pkg-config --modversion opencv
3.4.4

### Step #5: Finish your Python+ OpenCV + Ubuntu 18.04 install

We’ve reached the last lap of the race so stick with it.

_**Update 2018-12-20:** The following paths have been updated. Previous versions of OpenCV installed the bindings in a different location (`/usr/local/lib/python3.6/site-packages` ), so be sure to take a look at the paths below carefully._

At this point, your Python 3 bindings for OpenCV should reside in the following folder:

$ ls /usr/local/python/cv2/python-3.6
cv2.cpython-36m-x86\_64-linux-gnu.so

Let’s rename them to simply `cv2.so` :

$ cd /usr/local/python/cv2/python-3.6
$ sudo mv cv2.cpython-36m-x86\_64-linux-gnu.so cv2.so

_**Pro-tip:**_ _If you are installing OpenCV 3 and [OpenCV 4](https://pyimagesearch.com/2018/08/15/how-to-install-opencv-4-on-ubuntu/) alongside each other, instead of renaming the file to cv2.so, you might consider naming it `cv2.opencv3.4.4.so` and then in the next sub-step sym-link appropriately from that file to `cv2.so` as well._

Our last sub-step is to sym-link our OpenCV `cv2.so` bindings into our `cv` virtual environment:

$ cd ~/.virtualenvs/cv/lib/python3.6/site-packages/
$ ln -s /usr/local/python/cv2/python-3.6/cv2.so cv2.so

### Step #6: Testing your OpenCV 3 install on Ubuntu 18.04

The race is done, but let’s verify that we’re firing on all cylinders.

To verify that our OpenCV + Ubuntu install is complete, I like to launch Python, import OpenCV, and query for the version (this is useful for sanity if you have multiple versions of OpenCV installed as well):

$ cd ~
$ workon cv
$ python
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
\[GCC 7.3.0\] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.\_\_version\_\_
'3.4.4'
>>> quit()

Here’s what it looks like on my system:

[![Image 6](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20600%20451'%3E%3C/svg%3E)](https://pyimagesearch.com/wp-content/uploads/2018/05/install_opencv-1804-verify.jpg)

**Figure 5:** To verify that OpenCV is correctly installed and configured in our Python 3 virtual environment, I like to run the Python interpreter in the terminal. From there you can import OpenCV (`cv2`) and verify the version number matches what you intended to install.

**_Update 2018-12-20:_** _I did not update the screenshot today during my update. The version should reflect the version of OpenCV you installed._

Optionally, at this point, you can safely delete the zips and directories in your home folder:

$ cd ~
$ rm opencv.zip opencv\_contrib.zip
$ rm -rf opencv opencv\_contrib

Troubleshooting your install (FAQ)
----------------------------------

In this section, I address some of the common questions, problems, and issues that arise when installing OpenCV 3 with Python 3 on Ubuntu 18.04 LTS.

_**Q.**_ Where is Python 2.7 on Ubuntu 18.04?

_**A.**_ Python 3 is the default and what comes with Ubuntu 18.04. Python 2.7 users can manually install Python 2.7 at the end of **Step #1:**

$ sudo apt-get install python2.7 python2.7-dev

From there, when you create your virtual environment in **Step #3**, first install pip for Python 2.7:

$ sudo python2.7 get-pip.py

And then (also in **Step #3**) when you make your virtual environment, simply use the relevant Python version flag:

$ mkvirtualenv cv -p python2.7

From there everything should be the same.

_**Q.**_ Why can’t I just pip to install OpenCV?

_**A.**_ There are a number of pip-installable versions of OpenCV available depending on your operating system and architecture. The problem you may run into is that they may be compiled without various optimizations, image I/O support, video I/O support, and `opencv_contrib`  support. Use them — but use them at your own risk. This tutorial is meant to give you the _full_ install of OpenCV on Ubuntu 18.04 while giving you complete control over the compile.

_**Q.**_ When I execute `mkvirtualenv`  or `workon` , I encounter a “command not found error”.

_**A.**_ There a number of reasons why you would be seeing this error message, all of come from to **Step #3:**

1.  First, make sure you have installed `virtualenv`  and `virtualenvwrapper`  properly using the `pip`  package manager. Verify by running `pip freeze` , and ensure that you see both `virtualenv`  and `virtualenvwrapper`  in the list of installed packages.
2.  Your `~/.bashrc`  file may have mistakes. View the contents of your `~/.bashrc`  file to see the proper `export`  and `source`  commands are present (check **Step #3** for the commands that should be appended to `~/.bashrc` ).
3.  You may have forgotten to `source`  your `~/.bashrc` . Make sure you run `source ~/.bashrc`  after editing it to ensure you have access to the `mkvirtualenv`  and `workon`  commands.

_**Q.**_ When I open a new terminal, logout, or reboot my Ubuntu system, I cannot execute the `mkvirtualenv`  or `workon`  commands.

_**A.**_ See **#2** from the previous question.

_**Q.**_ When I try to import OpenCV, I encounter this message: `Import Error: No module named cv2` .

_**A.**_ There are _multiple_ reasons this could be happening and unfortunately, it is hard to diagnose. I recommend the following suggestions to help diagnose and resolve the error:

1.  Make sure your `cv`  virtual environment is active by using the `workon cv`  command. If this command gives you an error, then see the first question in this FAQ.
2.  Try investigating the contents of the `site-packages`  directory in your `cv`  virtual environment. You can find the `site-packages`  directory in `~/.virtualenvs/cv/lib/python3.6/site-packages/`  depending on your Python version. Make sure (1) there is a `cv2.so`  file in the `site-packages`  directory and (2) it’s properly sym-linked to a valid file.
3.  Be sure to check the `site-packages`  (and even `dist-packages` ) directory for the system install of Python located in `/usr/local/lib/python3.6/site-packages/` . Additionally please check `/usr/local/python/cv2` . Ideally, you should have a `cv2.so`  file in one of those locations.
4.  As a last resort, check in your `build/lib`  directory of your OpenCV build. There _should_ be a `cv2.so`  file there (if both `cmake`  and `make`  executed without error). If the `cv2.so`  file is present, _manually copy it_ into both the system `site-packages`  directory as well as the `site-packages`  directory for the `cv`  virtual environment.

### What's next? We recommend [PyImageSearch University](https://pyimagesearch.com/pyimagesearch-university/?utm_source=blogPost&utm_medium=bottomBanner&utm_campaign=What%27s%20next%3F%20I%20recommend).

**Course information:**  
84 total classes • 114+ hours of on-demand code walkthrough videos • Last updated: February 2024  
★★★★★ 4.84 (128 Ratings) • 16,000+ Students Enrolled

**I strongly believe that if you had the right teacher you could _master_ computer vision and deep learning.**

Do you think learning computer vision and deep learning has to be time-consuming, overwhelming, and complicated? Or has to involve complex mathematics and equations? Or requires a degree in computer science?

That’s _not_ the case.

All you need to master computer vision and deep learning is for someone to explain things to you in _simple, intuitive_ terms. _And that’s exactly what I do_. My mission is to change education and how complex Artificial Intelligence topics are taught.

If you're serious about learning computer vision, your next stop should be PyImageSearch University, the most comprehensive computer vision, deep learning, and OpenCV course online today. Here you’ll learn how to _successfully_ and _confidently_ apply computer vision to your work, research, and projects. Join me in computer vision mastery.

**Inside PyImageSearch University you'll find:**

*   ✓ **84 courses** on essential computer vision, deep learning, and OpenCV topics
*   ✓ **84 Certificates** of Completion
*   ✓ **114+ hours** of on-demand video
*   ✓ **Brand new courses released _regularly_**, ensuring you can keep up with state-of-the-art techniques
*   ✓ **Pre-configured Jupyter Notebooks in Google Colab**
*   ✓ Run all code examples in your web browser — works on Windows, macOS, and Linux (no dev environment configuration required!)
*   ✓ Access to **centralized code repos for _all_ 536+ tutorials** on PyImageSearch
*   ✓ **Easy one-click downloads** for code, datasets, pre-trained models, etc.
*   ✓ **Access** on mobile, laptop, desktop, etc.

[Click here to join PyImageSearch University](https://pyimagesearch.com/pyimagesearch-university/?utm_source=blogPost&utm_medium=bottomBanner&utm_campaign=What%27s%20next%3F%20I%20recommend)

Summary
-------

Today we installed OpenCV 3 with Python 3 bindings on Ubuntu 18.04 LTS.

I hope you found these instructions helpful on getting your own Ubuntu 18.04 machine configured with OpenCV 3.

If you’re interested in learning more about OpenCV, computer vision, and image processing, _**be sure to enter your email address in the form below to be notified when new blog posts + tutorials are published!**_

![Image 7](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20410%20567'%3E%3C/svg%3E)

#### Join the PyImageSearch Newsletter and Grab My FREE 17-page Resource Guide PDF

Enter your email address below to **join the PyImageSearch Newsletter** and **download my FREE 17-page Resource Guide PDF** on Computer Vision, OpenCV, and Deep Learning.