Hardware
: Raspberry Pi 4 Model B Rev 1.4 (RAM 8G)Operating System
: Raspberry Pi OS Lite (64-bit), Released: 2022-04-04Kernel Version
: Linux 5.15.32-v8+sudo apt-get install -y build-essential cmake git unzip pkg-config
sudo apt-get install -y libjpeg-dev libtiff-dev libpng-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libgtk2.0-dev libcanberra-gtk* libgtk-3-dev
sudo apt-get install -y libgstreamer1.0-dev gstreamer1.0-gtk3
sudo apt-get install -y libgstreamer-plugins-base1.0-dev gstreamer1.0-gl
sudo apt-get install -y libxvidcore-dev libx264-dev
sudo apt-get install -y python3-dev python3-numpy python3-pip
sudo apt-get install -y libtbb2 libtbb-dev libdc1394-22-dev
sudo apt-get install -y libv4l-dev v4l-utils
sudo apt-get install -y libopenblas-dev libatlas-base-dev libblas-dev
sudo apt-get install -y liblapack-dev gfortran libhdf5-dev
sudo apt-get install -y libprotobuf-dev libgoogle-glog-dev libgflags-dev
sudo apt-get install -y protobuf-compiler
The build settings will change the above packages. Check your configurations out.
git clone https://github.com/opencv
git clone https://github.com/opencv_contrib
git checkout tags/4.5.5 -b 4.5.5v
git checkout tags/4.5.5 -b 4.5.5v
We'll install OpenCV 4.5.5v. If you want to install another, try to find the release and tags in the official git.
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
\
-D OPENCV_EXTRA_MODULES=$HOME/opencv_contrib/modules \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_ENABLE_NONFREE=ON \
\
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPES=OFF \
\
-D BUILD_opencv_java=NO \
\
-D BUILD_opencv_python2=NO \
-D BUILD_opencv_python3=YES \
-D PYTHON3_PACKAGES_PATH=/usr/lib/python3/dist-packages \
\
-D ENABLE_NEON=ON \
\
-D WITH_OPENMP=ON \
-D WITH_OPENCL=OFF \
-D WITH_TBB=ON \
-D WITH_EIGEN=OFF \
\
-D WITH_VTK=OFF \
-D WITH_QT=OFF \
\
-D WITH_GSTREAMER=ON \
-D WITH_FFMPEG=ON \
-D WITH_V4L=ON \
-D WITH_LIBV4L=ON \
\
-D BUILD_DOCS=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF ..
make -j$(nproc)
Configurations may differ from one another.
sudo make install
sudo ldconfig
make clean
cd $HOME
rm -rf opencv/ opencv_conrib
...or enther the command below:
opencv_version -v
[Sites] https://qengineering.eu/install-opencv-4.5-on-raspberry-64-os.html
[Sites] https://github.com/opencv/opencv
[Sites] https://github.com/opencv/opencv_contrib