

$ sudo apt-get install libxvidcore-dev libx264-dev $ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev $ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev Next, let’s install a handful of image and video I/O libraries. Alternatively, you may SSH into the box for the install portion.įrom there, let’s update our system: $ sudo apt-get updateĪnd then install developer tools: $ sudo apt-get install build-essential cmake unzip pkg-config To get the OpenCV 4 install party started, fire up your Ubuntu machine and open a terminal.

I’ll be using Ubuntu 18.04 to install OpenCV 4 with Python 3 bindings on my machine. Step #1: Install OpenCV 4 dependencies on Ubuntu Refer to the FAQs down below if you need pointers for Python 2.7. That being said, if you’re making the conscious choice to use Python 2.7, you can of course follow these instructions, just be sure you take care to install Python 2.7 development headers and libraries as well as specifying Python 2.7 when creating your virtual environment. Python 3 has become the standard and I highly recommend you install Python 3 with OpenCV 4. Should I use Python 2.7 or Python 3 with OpenCV 4? If you intend on using this machine just for OpenCV and other computer vision tasks, Ubuntu 18.04 is perfectly fine.Ģ. If you intend on using this machine for deep learning I might suggest you use Ubuntu 16.04 as the GPU drivers are more mature. I’ve also tested these instructions with Ubuntu 16.04 as well. Today I’ll be installing OpenCV 4 on Ubuntu 18.04.

Which version of Ubuntu OS should I use with OpenCV 4? I strongly urge you to read the FAQ prior to submitting a comment on this post.īefore we begin, you probably have two burning questions:ġ. I’ll also cover some Frequently Asked Questions (FAQs) that will help you troubleshoot in the event you run into an error message. In this blog post, I’ll walk you through the six steps to install OpenCV 4 on your Ubuntu system. Looking for the source code to this post? Jump Right To The Downloads Section How to install OpenCV 4 on Ubuntu
