After spending days trying to get OpenCV3 to install on Raspbian Stretch, always failing, I thought it would massively help if there's an image with OpenCV pre-installed, which would save several hours of compilation and debugging.

Please let me know if there is one available?

I've followed pyimagesearch links, tried to follow steps given all over the net, spent 3 days but to no avail!


4 Answers 4


You can install opencv in a few minutes using piwheels:

sudo apt install libatlas3-base libwebp6 libtiff5 libjasper1 libilmbase12 libopenexr22 libilmbase12 libgstreamer1.0-0 libavcodec57 libavformat57 libavutil55 libswscale4 libqtgui4 libqt4-test libqtcore4
sudo pip3 install opencv-python



This, link may be helpfull. The image contains the last raspbian SO (Stretch), Ros and OpenCV



Preparing a Raspberry Pi for OpenCV development is really time consuming, OpenCV takes hours to compile and a lot of other things have to be set up, so I just share my SD Card image here to speed up Raspberry OpenCV development for others. I shrank the root partition to 7GB to make it suitable for smaller SD cards. It has 300MB free space only so you better expand it to fit on the target SD card. You can do this right on your raspberry with an additional USB-SD card stick and gparted. User/pass is pi/raspberry. After startup it autologins directly to OpenBox. Right click -> Terminal emulator to open a terminal. To test and run the OpenCV examples type "workon cv" to activate the python virtual environment, go into "/home/pi/Desktop/OpenCV-Face-Recognition-master/FacialRecognition" and type "python 03_face_recognition.py" . If you have a raspberry camera installed and enabled with raspi-config, a camera window should pop up and face detection should start. For a usb camera you have to modify the scripts a little.

What does it contain

Base System

Raspbian Lite


openbox for window manager tint2 for taskbar slim for autologin pcmanfm for file manager chromium for stack overflow

Dev Tools

lxterminal for terminal vim/nano for python codeblocks for c/c++ development python for opencv development opencv 4.0 for computer vision picamera python module for the raspberry camera opencv face recognition examples


Scratch, Termite, Cortex, Brawl for short rests ( enable full KMS OpenGL support in raspi-config to play them )

Download from : http://milgra.com/downloads/milgrapi/


I uploaded an image for myself to the drive. but here, you can use this as well. this has preinstalled OpenCV and dlib in it. will require a 32 GB card because its size is around 29 GB when uncompressed. this is tested on raspberry pi 3b+. not sure about the rest of the pi's. enjoy. https://drive.google.com/file/d/1cAsP2EU3066T0_047MdGDvxlXbvIgD0Q/view?usp=sharing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.