Created
August 27, 2021 16:58
-
-
Save DanielChuDC/c740b023abfeedd19992a6c0c68c3976 to your computer and use it in GitHub Desktop.
Install opencv-python 4.5.3.56 on raspberry pi model 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Tested on | |
| # pi@raspberrypi:~ $ python3 --version | |
| # Python 3.7.3 | |
| # pi@raspberrypi:~ $ pip3 --version | |
| # pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7) | |
| curl https://pyenv.run | bash | |
| export PATH="$HOME/.pyenv/bin:$PATH" | |
| eval "$(pyenv init --path)" | |
| eval "$(pyenv virtualenv-init -)" | |
| source ~/.bashrc | |
| pyenv | |
| sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev | |
| sudo pip3 install opencv-python | |
| sudo pip3 install opencv-contrib-python | |
| sudo apt install libhdf5-103 libqtgui4 libatlas3-base libjasper1 libqt4-test | |
| pip3 install -U numpy | |
| sudo tee -a $HOME/cv2-demo.py <<EOF | |
| import cv2 | |
| cap = cv2.VideoCapture(0) | |
| while True: | |
| # capture for each 1 frame | |
| ret, frame = cap.read() | |
| # if cannot cappture, close the window | |
| if not ret: | |
| break | |
| # output to the window | |
| cv2.imshow("Frame", frame) | |
| key = cv2.waitKey(1) | |
| # if interrupted, stop the process | |
| if key == 27: | |
| break | |
| cap.release() | |
| cv2.destroyAllWindows() | |
| EOF | |
| python3 demo.py |
Author
DanielChuDC
commented
Aug 27, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment