Update Python Version In Virtualenvwrapper UbuntuProceed at your own risk, and consult the Raspberry Pi forums for help. Important It is my recommendation that you proceed with a fresh install of Raspbian Stretch Upgrading from Raspbian Jessie is not recommended. Assuming that your OS is up to date, youll need one of the following for the remainder of this post Physical access to your Raspberry Pi 3 so that you can open up a terminal and execute commands. Remote access via SSH or VNC. Ill be doing the majority of this tutorial via SSH, but as long as you have access to a terminal, you can easily follow along. Cant SSH If you see your Pi on your network, but cant ssh to it, you may need to enable SSH. This can easily be done via the Raspberry Pi desktop preferences menu youll need an HDMI cable and a keyboardmouse or running. Pi. After youve changed the setting and rebooted, you can test SSH directly on the Pi with the localhost address. Open a terminal and type. Keyboard layout giving you problems Change your keyboard layout by going to the Raspberry Pi desktop preferences menu. I use the standard US Keyboard layout, but youll want to select the one appropriate for your keyboard or desire any Dvorkac users out there. Installing Open. CV 3 on a Raspberry Pi 3 running Raspbian Stretch. If youve ever installed Open. CV on a Raspberry Pi or any other platform before, you know that the process can be quite time consuming with many dependencies and pre requisites that have to be installed. The goal of this tutorial is to thus guide you step by step through the compile and installation process. In order to make the installation process go more smoothly, Ive included timings for each step so you know when to take a break, grab a cup of coffee, and checkup on email while the Pi compiles Open. CV. Lets go ahead and get started installing Open. CV 3 on your Raspberry Pi 3 running Raspbian Stretch. Step 1 Expand filesystem. Are you using a brand new install of Raspbian StretchIf so, the first thing you should do is expand your filesystem to include all available space on your micro SD card. And then select the Advanced Options menu item Figure 1 Select the Advanced Options item from the raspi config menu. Followed by selecting Expand filesystem Figure 2 Expanding the filesystem on your Raspberry Pi 3. Once prompted, you should select the first option, A1. Expand File System, hit Enter on your keyboard, arrow down to the lt Finish button, and then reboot your Pi you may be prompted to reboot, but if you arent you can execute. After rebooting, your file system should have been expanded to include all available space on your micro SD card. You can verify that the disk has been expanded by executing. Filesystem Size Used Avail Use Mounted on. G 4. 2. G 2. 4G 1. M 0 4. 34. M 0 dev. M 0 4. 38. M 0 devshm. M 1. 2M 4. 27. M 3 run. M 4. 0. K 5. 0. M 1 runlock. M 0 4. 38. M 0 sysfscgroup. M 2. 1M 2. 1M 5. M 0 8. M 0 runuser1. Filesystem Size Used Avail UseMounted ondevroot 3. G 4. 2. G 2. 4G 1. M 0 4. 34. M 0devtmpfs 4. M 0 4. 38. M 0devshmtmpfs 4. M 1. 2M 4. 27. M 3runtmpfs 5. M 4. 0. K 5. 0. M 1runlocktmpfs 4. M 0 4. 38. M 0sysfscgroupdevmmcblk. M 2. 1M 2. 1M 5. M 0 8. 8M 0runuser1. As you can see, my Raspbian filesystem has been expanded to include all 3. GB of the micro SD card. However, even with my filesystem expanded, I have already used 1. GB card. If you are using an 8. GB card you may be using close to 5. Libre. Office and Wolfram engine to free up some space on your Pi. After removing the Wolfram Engine and Libre. Office, you can reclaim almost 1. GB Step 2 Install dependencies. This isnt the first time Ive discussed how to install Open. CV on the Raspberry Pi, so Ill keep these instructions on the briefer side, allowing you to work through the installation process Ive also included the amount of time it takes to execute each command some depend on your Internet speed so you can plan your Open. CV Raspberry Pi 3 install accordingly Open. CV itself takes approximately 4 hours to compile more on this later. The first step is to update and upgrade any existing packages. Timing 2m 1. 4s. We then need to install some developer tools, including CMake, which helps us configure the Open. CV build process. Timing 1. 9s. Next, we need to install some image IO packages that allow us to load various image file formats from disk. Examples of such file formats include JPEG, PNG, TIFF, etc. Timing 2. 1s. Just as we need image IO packages, we also need video IO packages. These libraries allow us to read various video file formats from disk as well as work directly with video streams. Timing 3. 2s. The Open. CV library comes with a sub module named. GUIs. In order to compile the. GTK development library. Timing 1m 3. 6s. Many operations inside of Open. CV namely matrix operations can be optimized further by installing a few extra dependencies. Timing 2. 3s. These optimization libraries are especially important for resource constrained devices such as the Raspberry Pi. Lastly, lets install both the Python 2. Python 3 header files so we can compile Open. CV with Python bindings. Timing 4. 5s. If youre working with a fresh install of the OS, it is possible that these versions of Python are already at the newest version youll see a terminal message stating this. If you skip this step, you may notice an error related to the. Python. h header file not being found when running. Open. CV. Step 3 Download the Open. CV source code. Now that we have our dependencies installed, lets grab the. Open. CV from the official Open. CV repository. This version includes the. Deep Learning with Open. CV Note As future versions of open. CV are released, you can replace. O opencv. zip https github. Itseezopencvarchive3. Oopencv. ziphttps github. Itseezopencvarchive3. Timing 4. 1s. Well want the full install of Open. CV 3 to have access to features such as SIFT and SURF, for instance, so we also need to grab the opencvcontrib repository as well. O opencvcontrib. Itseezopencvcontribarchive3. Oopencvcontrib. ziphttps github.