Install and build OpenCV python From Source on Raspberry pi 4 and 3

preview_player
Показать описание
In this video you will learn how to install opencv for python in raspberry pi with two different methods, so if you start using raspberry pi and want to use opencv on your projects watch this video.
------------------------------------------------------------------------

The raspberry pi used in this video:
Raspberry Pi 4 Model B 4GB

-------------------------------------------------------------------------
OpenCV documentation:

-------------------------------------------------------------------------
Download opencv source:

-------------------------------------------------------------------------
OpenCV-Python from Pre-built Binaries:
sudo apt-get install python3-opencv

-------------------------------------------------------------------------
Dependencies for building OpenCV from source:
sudo apt-get install cmake
sudo apt-get install gcc g++
sudo apt-get install python3-dev python3-numpy
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libgtk-3-dev

-------------------------------------------------------------------------

Please LIKE and SUBSCRIBE for more content and supporting!
#opencv#raspberrypi
Рекомендации по теме
Комментарии
Автор

OBS: for those who are getting error: No module named 'cv2'

I think it's because there is no python2 installed anymore in raspberry pi, therefore opencv will not be installed properly.

Solution:
After you run sudo make install run this command: sudo cp -R

Just check if you have the same python version otherwise just change it to your pythons version so for example if you have python3.7 installed change the python3.9 to python3.7.

Let me know if this solve your problem.

index-zero
Автор

Thank you!
The compile process got stuck many times . It took more than 18hours for opencv to get installed( Rpi3b+, 1gb ram)
I increased the swapsize to 4096.
Kept GPU at 76. I used make -j4 command.
Made sure that the board is well ventilated and not getting heated up.
Also I used raspcontroller app to check if the download is still continuing or got stuck .

I don't know if this makes sense, but it helped me.
After 99% it took almost three hours to get the process completed.

priyagujre
Автор

Yo please help out at 63% it canceled and gave a long list of errors and whatnots but the main thing is [makefile:182: all] Error 2. Ive tried redoing the make command and that pip upgrade thing you said

PatrickBateman
Автор

Is the raspberry pi 3 work good with openCV or i need to buy tje raspberry pi 4 ?

wassimmodric
Автор

I want to know how to install cvzone and tensorflow 2 on raspberry pi

oliverorwell
Автор

i am getting error in make command that no target is sepcified and no makefile found

bgmistreamersmoments
Автор

really wonderful OpenCV video. Would the installation be the same for an Orange Pi 800? Thank you.

qzorn
Автор

I keep getting cannot create directory 'build': File exists every time I input "cd ~opencv && mkdir build && cd build"

mrmoody
Автор

Can it be install in Raspberry Pi 3 model B ram 1GB?

badarali
Автор

Hello sir.. I am also getting the same error i.e.
python3
import cv2 as cv
ModuleNot FoundError: No module named 'cv2'
I followed exactly the same steps as mentioned in your doc. Please help as soon as possible.
I am using Raspberry Pi 4 Model B 8GB

SunilKumar-qonb
Автор

Sir I have a question, I follow every step and it seems to be okey however. At 99% of /Desktop/opencv/build/ $ make, my desktop totally freeze. Hope you can help me sir thank you

syakirpro
Автор

can i do the same for the raspberry pi zero w?

Vector-uzsc
Автор

When i write cmake ../ i got ( command not found) what is the solution please?

fasel
Автор

Open CV 4 in raspberry Pi is that same method???
Please reply

solouniverse
Автор

thank you very much. but i spent 7 hours to install it. this is very long long time. it is not 2 3 hours . lmao

vnpoka
Автор

"make" operation takes a lot of time.It's about 44 percent and it started 12 hours ago. what i suposed to do?

roni
Автор

Hello everyone, firstly thank you for your explanatory video. I've a problem about installation of openCV to my raspberry pi 4 model - b,
Problems that program gave me :

make[2]: *** bin/opencv_perf_dnn] Error 1
make[1]: *** [CMakeFiles/Makefile2:2238: Error 2
make: *** [Makefile:182: all] Error 2

Are there anybody who have an idea to fix that problem, thanx

ilaydabalk
Автор

i am getting this error how can i fix it
(bash: cd: too many arguments)

yunusemrekoksal
Автор

Hey, I have installed opencv on my raspberry pi 3, i can import opencv in terminal only but not in thonny python, if i try to run command import cv2 in thonny python, i'm getting this error " No module named cv2 ",

Please help me resolve this problem

siddharamdivate
Автор

why when in "make" it stops at 98 percent only

firmanagroni