forked from ray/RobotKernal-UESTC
46 lines
1.4 KiB
Markdown
46 lines
1.4 KiB
Markdown
# 割草机器人算法环境搭建——OpenCV编译安装
|
||
|
||
### 一、说明
|
||
|
||
割草机器人项目的算法采用`opencv 3.4.3`的版本,在RK3588上编译大约需要花费1到2个小时左右。步骤比较简单,按照下面的步骤一步步输入命令即可。
|
||
|
||
> `OpenCV`安装3.4.3版本
|
||
>
|
||
> 下载地址:1) 官方下载地址 https://github.com/opencv/opencv/archive/3.4.3.zip 2)http://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
|
||
``` |