2018-04-09 05:46:01 +03:00
|
|
|
|
# 样例 {#guide_samples}
|
|
|
|
|
|
|
|
|
|
样例在 `<sdk>/samples` 目录,其提供了不同接口层的使用范例。
|
|
|
|
|
|
|
|
|
|
* `api`, API 层接口,依赖 OpenCV 。
|
|
|
|
|
* `device`,中间层接口,不依赖 OpenCV 。
|
|
|
|
|
* `uvc`,底层接口。
|
|
|
|
|
|
|
|
|
|
> 目前 API 层接口,正在实现中。
|
|
|
|
|
|
|
|
|
|
## 依赖
|
|
|
|
|
|
|
|
|
|
* [OpenCV](https://opencv.org/),用于显示图像。
|
2018-04-25 07:28:06 +03:00
|
|
|
|
* 编译前,可在系统终端(Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
|
2018-04-09 05:46:01 +03:00
|
|
|
|
|
2018-04-25 07:28:06 +03:00
|
|
|
|
```bash
|
|
|
|
|
# Linux, macOS
|
|
|
|
|
export OpenCV_DIR=~/opencv
|
|
|
|
|
|
|
|
|
|
# Windows
|
|
|
|
|
set OpenCV_DIR=C:\opencv
|
2018-04-23 18:11:11 +03:00
|
|
|
|
```
|
|
|
|
|
|
2018-04-09 05:46:01 +03:00
|
|
|
|
## 编译
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
make samples
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 运行
|
|
|
|
|
|
|
|
|
|
运行 `device` 层接口样例,显示图像并输出 IMU 。
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
./samples/_output/bin/device/camera_d
|
2018-04-25 07:28:06 +03:00
|
|
|
|
|
|
|
|
|
# Windows
|
|
|
|
|
.\samples\_output\bin\device\camera_d.bat
|
2018-04-09 05:46:01 +03:00
|
|
|
|
```
|
2018-04-25 07:28:06 +03:00
|
|
|
|
|
|
|
|
|
## 结语
|
|
|
|
|
|
|
|
|
|
更多样例的说明,请见 `samples/README.md` 。
|