当前位置: 首页 > 工具软件 > go-opencv > 使用案例 >

build-opencv4-on-raspberrypi

曾泳
2023-12-01

The OpenCV software uses other third-party software libraries. These have to be installed first.

$ sudo apt-get update
$ sudo apt-get upgrade

# general tools (35.8 MB)
$ sudo apt-get install build-essential cmake pkg-config

# image formats (0.9 MB)
$ sudo apt-get install libjpeg-dev libpng-dev libgif-dev

# video formats (32.1 MB)

$ sudo apt-get install libavcodec-dev libavformat-dev
$ sudo apt-get install libswscale-dev libdc1394-22-dev
$ sudo apt-get install libxvidcore-dev libx264-dev 

# video back engine (0.6 MB)
$ sudo apt-get install libv4l-dev v4l-utils

# the GTK+2 GUI (175 MB)
$ sudo apt-get install libgtk2.0-dev libcanberra-gtk* libgtk-3-dev

# install only if your have a RPi OS lite with no desktop
$ sudo apt-get install python3-dev python3-numpy python3-pip
$ sudo apt-get install python-dev python-numpy

# parallel framework (2.7 MB)
# don't install if your having a 1 core CPU (like RPi zero)
$ sudo apt-get install libtbb2 libtbb-dev

$ sudo apt-get install libopenblas-dev libatlas-base-dev libblas-dev
$ sudo apt-get install libjasper-dev liblapack-dev libhdf5-dev

# Go to build directory. install, config, clean.
$ sudo make install
$ sudo ldconfig
$ make clean

# Installation in Python
$ cd /usr/lib/python3/dist-packages/
$ sudo ln -s /usr/local/lib/python3.7/dist-packages/cv2/python-3.7/cv2.cpython-37m-arm-linux-gnueabihf.so 


# if you don't want install from source, and can accept use old version (opencv 3.2.0), 
# below will give you a quick install for c++ development.
$ sudo apt-get install libopencv-dev
 

 类似资料: