Here's how you can install OpenCV on your Raspberry Pi 3, 4, and Zero 2 W. This is straightforward and all it takes is some time and patience. Leave comment with a question if you have one or a request for a future tutorial.
Subscribe for more Raspberry Pi tutorials :) https://www.youtube.com/samwestbytech...
Learn OpenCV: • OpenCV for Python
I may earn commission if you purchase from the links below:
MY CAMERA: https://amzn.to/3reaDlK
MY MICROPHONE: https://amzn.to/3fhunSN
MY LIGHTING: https://amzn.to/3dHll1i
FREE Amazon Prime: https://amzn.to/3ren80W
FREE Audible Plus: https://amzn.to/3xYzJsR
RASPBERRY PI 4: https://amzn.to/3BC4i9I
RASPBERRY PI PICO START KIT: https://amzn.to/3REvjis
RASPBERRY PI CAMERA V2: https://amzn.to/3QFp90c
ELECTRONICS COMPONENT STARTER KIT: https://amzn.to/3qB23xg
ASSORTED SENSOR KIT: https://amzn.to/3U7M7zV
USB SPEAKER: https://amzn.to/3La4foK
USB 1080P WEBCAM: https://amzn.to/3Lq0OL7
TIMESTAMPS and INSTRUCTIONS
0:00 Intro
0:13 Access the terminal of your Pi
0:34 Check if you're using all of your system memory with:
df -h
If you're not using most of it, run
sudo raspi-config
advanced -- expand filesystem
reboot your pi
1:19 Update and upgrade
sudo apt-get update && sudo apt-get upgrade
1:35 Check your python version
python3 -V
sudo apt-get install python3-pip python3-virtualenv
mkdir project
cd project
python3 -m pip install virtualenv
python3 -m virtualenv env
source env/bin/activate
3:03 We need a bunch of system packages (credit to https://singleboardbytes.com/647/inst...)
sudo apt install -y build-essential cmake pkg-config libjpeg-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libfontconfig1-dev libcairo2-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran libhdf5-dev libhdf5-serial-dev libhdf5-103 libqt5gui5 libqt5webkit5 libqt5test5 python3-pyqt5 python3-dev
If you're using a PiCamera run:
pip install "picamera[array]"
Users of PiCamera may also have to enable Camera Support:
sudo raspi-config
Inferface Options
Legacy Camera Support -- Enable
4:15 Install OpenCV
pip install opencv-contrib-python
--Takes a long time
5:25 Testing
python
import cv2
cv2.__version__