且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Raspberry Pi Raspbian上安装opencv

更新时间:2022-01-15 23:05:03

安装开放式简历非常简单.

installing open cv is very easy just do this.

sudo apt-get update

sudo apt-get install -y build-essential git cmake pkg-config \
    libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev \
    libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
    libxvidcore-dev libx264-dev libgtk2.0-dev \
    libatlas-base-dev gfortran \
    python2.7-dev python3-dev

然后

cd ~
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.0.0.zip
unzip opencv.zip
wget -O opencv_contrib.zip 
https://github.com/Itseez/opencv_contrib/archive/3.0.0.zip
unzip opencv_contrib.zip
cd opencv-3.0.0/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D INSTALL_C_EXAMPLES=ON \
      -D INSTALL_PYTHON_EXAMPLES=ON \
      -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.0.0/modules \
      -D BUILD_EXAMPLES=ON ..

make -j4
make clean
make
sudo make install
sudo ldconfig

这将需要几个小时.

使用OpenCV提取功能 使用以下命令下载脚本和示例图像 光盘〜 wget https://raw.githubusercontent.com/JoBergs/RaspiContent/master /OpenCV_demo/opencv_face_features.py \ https://raw.githubusercontent.com/JoBergs/RaspiContent/master/OpenCV_demo/poi_1.jpg

Extract features with OpenCV Download the Script and sample image with cd ~ wget https://raw.githubusercontent.com/JoBergs/RaspiContent/master/OpenCV_demo/opencv_face_features.py \ https://raw.githubusercontent.com/JoBergs/RaspiContent/master/OpenCV_demo/poi_1.jpg

运行脚本需要Raspbian桌面.如果您还没有启动到桌面,

Running the Script requires the Raspbian Desktop. If you haven’t already booted into the Desktop,

打开终端,然后

cd ~
python opencv_face_features.py poi_1.jpg