1
0
Fork 0
RobotKernal-UESTC/Docs/3. 割草机器人算法环境搭建—OpenCV编译安装.md

46 lines
1.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 割草机器人算法环境搭建——OpenCV编译安装
### 一、说明
割草机器人项目的算法采用`opencv 3.4.3`的版本在RK3588上编译大约需要花费1到2个小时左右。步骤比较简单按照下面的步骤一步步输入命令即可。
> `OpenCV`安装3.4.3版本
>
> 下载地址1) 官方下载地址 https://github.com/opencv/opencv/archive/3.4.3.zip 2http://logzhan.ticp.io:30000/Mirrors/opencv-3.4.3
### 二、OpenCV的代码下载和编译
```shell
# 方法1 wget https://github.com/opencv/opencv/archive/3.4.3.zip
# 方法2 git clone http://logzhan.ticp.io:30000/Mirrors/opencv-3.4.3.git
unzip opencv-3.4.3.zip
cd opencv-3.4.3
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
```
### 三、OpenCV的环境配置
`OpenCV`安装好后,需要配置一下环境才能正常使用,配置的步骤如下。
```shell
# 1.添加库路径
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
# 2.更新系统库
sudo ldconfig
# 3.配置bash
sudo gedit /etc/bash.bashrc
# 4.在末尾粘贴这两行代码
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
# 5.保存后,执行如下命令使得配置生效
source /etc/bash.bashrc
# 6.安装mlocate
sudo apt-get install mlocate
sudo updatedb
# 7.检测opencv版本
pkg-config --modversion opencv
```