How to Install OpenCV on a Raspberry Pi

preview_player
Показать описание
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.

I may earn commission if you purchase from the links below:

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

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__
Рекомендации по теме
Комментарии
Автор

I've been struggling to get open cv installed for a while, and this worked ! thank you so so much.

okineedadonutnow
Автор

This is the best opencv installation video I have found to date! I have returned to it many times for my senior design project. Thanks for being clear and concise!

prestonmcomber
Автор

Flowless on Raspberry Pi 4 model B 4GB with Bookworm 64b. I tried about four different video tutorials but this is by far the best. Thank you, Sam!

ovidiumoise
Автор

Short and simple tutorial and it works for me. Highly recommended, very useful Love from Malaysia <3 (Raspberry pi 4B)

JM-bdmg
Автор

Great and the best tutorial, after watching a lot of others tutorials i was tired. It really works without problems

lml
Автор

Like Preston said this was the best installation video. Thanks so much. Yes! Please keep these videos coming!

pademo
Автор

incredible, i am sending this message on a raspberry pi. this is the best tutorial on youtube to get open cv.

GiantSquidGamer
Автор

Best tutorial ever for OpenCV installation on Raspberry Pi!

joeldizon
Автор

I m really appreciate your video because it is really helpful to install open cv in raspberry pi 3 old module. Thank for been clear precenting every thing.

kanishkalanka
Автор

Great video!
Thank you very much for the sharing. Good work and useful!

oooopppp
Автор

So glad I came across this tutorial. Super clear and straightforward. Thanks

nicknottage
Автор

i spent an entire day staring at command prompt trying to get this working tysm

junetechon
Автор

Thank you very much for this and for explaining each command!

Kirch_
Автор

thank you very much for sharing this tutorial. very simple and clear explained. I am at the last part installing the openCV while I a m writing this comments, even if the installing process still continues I can see there are some errors popping up here and there. Since I am not the expert on this field, not sure if I should worry or not. I would like to ask you if this instructions apply either for Raspian 32 OS and Raspian 64 OS?

manuelcarriedo
Автор

Thank you very much. This video is so useful to setup.

mahmutsare
Автор

Thank you, your channel is very helpful

saraharbi
Автор

Hi Sam, which operating system should be installed on the raspberry pi? With Desktop or without?

Thank you for Video

meander
Автор

very straight forward and simple. please do a video on how to use it

interestingengineering
Автор

This is what I consider the PERFECT tutorial. Thank you a ton. Subscribed!

patxiplg
Автор

After 3 days of trying to install opencv, reseating my raspberry multiple times, and following every single tutorial, your videos are the only ones that work for me. Thank you so muchhhh!

nathalylozano