Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-s-sdk into develop

This commit is contained in:
TinyOh 2019-03-23 11:11:50 +08:00
commit 042293fb3b
148 changed files with 5030 additions and 3487 deletions

2
.gitignore vendored
View File

@ -7,6 +7,8 @@ _build/
_install/
_output/
/docs/_doxygen/
/get-pip.py
/*INFO*

View File

@ -62,24 +62,21 @@ all: init samples tools ros
# doc
apidoc:
doc: apidoc
apidoc: cleandoc
@$(call echo,Make $@)
@# @[ -e ./_install/include ] || $(MAKE) install
@[ -e /usr/local/include/mynteye ] || $(MAKE) install
@$(SH) ./doc/build.sh
@cd docs; make html
opendoc: apidoc
@$(call echo,Make $@)
@$(shell $(SH) ./doc/langs.sh 1); \
for lang in "$${LANGS[@]}"; do \
html=./doc/_output/$$lang/html/index.html; \
[ -f "$$html" ] && $(SH) ./scripts/open.sh $$html; \
done
@$(SH) ./scripts/open.sh docs/_build/html/index.html
cleandoc:
@$(call rm,./doc/_output/)
@$(call rm,./docs/_build/)
@$(call rm,./docs/_doxygen/)
.PHONY: apidoc opendoc cleandoc
.PHONY: doc apidoc opendoc cleandoc
# deps

View File

@ -1,83 +0,0 @@
#!/usr/bin/env bash
# Copyright 2018 Slightech Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# _VERBOSE_=1
# _TEST_=1
BASE_DIR=$(cd "$(dirname "$0")" && pwd)
ROOT_DIR=$(realpath "$BASE_DIR/..")
SCRIPTS_DIR="$ROOT_DIR/scripts"
source "$SCRIPTS_DIR/common/echo.sh"
source "$SCRIPTS_DIR/common/mkdir.sh"
source "$SCRIPTS_DIR/common/detect.sh"
_detect "doxygen"
_detect "pdflatex" 1
source "$BASE_DIR/langs.sh"
DOXYFILE="api.doxyfile"
OUTPUT="$BASE_DIR/_output"
# \usepackage{CJKutf8}
# \begin{document}
# \begin{CJK}{UTF8}{gbsn}
# ...
# \end{CJK}
# \end{document}
_texcjk() {
tex="$1"; shift;
_echo_in "add cjk to $tex"
sed -i "" -E $'s/^\\\\begin{document}$/\\\\usepackage{CJKutf8}\\\n\\\\begin{document}\\\n\\\\begin{CJK}{UTF8}{gbsn}/g' $tex
sed -i "" -E $'s/^\\\\end{document}$/\\\\end{CJK}\\\n\\\\end{document}/g' $tex
}
for lang in "${LANGS[@]}"; do
_echo_s "Build doc $lang"
[ -d "$BASE_DIR/$lang" ] || continue
cd "$BASE_DIR/$lang"
if [ -f "$DOXYFILE" ]; then
_mkdir "$OUTPUT/$lang"
_echo_i "doxygen $DOXYFILE"
doxygen $DOXYFILE
version=`cat $DOXYFILE | grep -m1 "^PROJECT_NUMBER\s*=" | \
sed -E "s/^.*=[[:space:]]*(.*)[[:space:]]*$/\1/g"`
# html
if [ -d "$OUTPUT/$lang/html" ]; then
dirname="mynt-eye-s-sdk-apidoc"; \
[ -n "$version" ] && dirname="$dirname-$version"; \
dirname="$dirname-$lang"
cd "$OUTPUT/$lang"
[ -d "$dirname" ] && rm -rf "$dirname"
mv "html" "$dirname" && zip -r "$dirname.zip" "$dirname"
fi
# latex
if [ $pdflatex_FOUND ] && [ -f "$OUTPUT/$lang/latex/Makefile" ]; then
_echo_in "doxygen make latex"
filename="mynt-eye-s-sdk-apidoc"; \
[ -n "$version" ] && filename="$filename-$version"; \
filename="$filename-$lang.pdf"
cd "$OUTPUT/$lang/latex" && _texcjk refman.tex && make
[ -f "refman.pdf" ] && mv "refman.pdf" "../$filename"
fi
_echo_d "doxygen completed"
else
_echo_e "$DOXYFILE not found"
fi
done

View File

@ -1,11 +0,0 @@
# MYNT EYE S SDK {#mainpage}
* <a class="el" href="annotated.html">API Classes</a>
* <a class="el" href="modules.html">API Modules</a>
* \link enumerations Enumerations\endlink
* \link datatypes Datatypes\endlink
* \link utils Utiliities\endlink
* \link calibration Intrinsics & Extrinsics\endlink
* <span style="font-weight:bold">Device Specifications</span>
* @subpage specs_data
* @subpage specs_ctrl

View File

@ -1,26 +0,0 @@
# Control Protocols {#spec_control_api}
There are two control modes, one is through UVC standard protocol, the other is through UVC custom protocol with extension unit.
## Standard Protocol
| Name | Field | Bytes | Default | Min | Max | Stored | Flash Address | Note |
| :--- | :---- | :---- | :------ | :-- | :-- | :----- | :------------ | :--- |
| Gain | gain | 2 | 24 | 0 | 48 | √ | 0x12 | valid if manual-exposure |
| Brightness | brightness/exposure_time | 2 | 120 | 0 | 240 | √ | 0x14 | valid if manual-exposure |
| Contrast | contrast/black_level_calibration | 2 | 127 | 0 | 255 | √ | 0x10 | valid if manual-exposure |
## Custom Protocol
| Name | Field | Bytes | Default | Min | Max | Stored | Flash Address | Channel | Note |
| :--- | :---- | :---- | :------ | :-- | :-- | :----- | :------------ | :------ | :----- |
| Frame rate | frame_rate | 2 | 25 | 10 | 60 | √ | 0x21 | XU_CAM_CTRL | values: {10,15,20,25,30,35,40,45,50,55,60} |
| IMU frequency | imu_frequency | 2 | 200 | 100 | 500 | √ | 0x23 | XU_CAM_CTRL | values: {100,200,250,333,500} |
| Exposure mode | exposure_mode | 1 | 0 | 0 | 1 | √ | 0x0F | XU_CAM_CTRL | 0: enable auto-exposure; 1: manual-exposure |
| Max gain | max_gain | 2 | 48 | 0 | 48 | √ | 0x1D | XU_CAM_CTRL | valid if auto-exposure |
| Max exposure time | max_exposure_time | 2 | 240 | 0 | 240 | √ | 0x1B | XU_CAM_CTRL | valid if auto-exposure |
| Desired brightness | desired_brightness | 2 | 192 | 0 | 255 | √ | 0x19 | XU_CAM_CTRL | valid if auto-exposure |
| IR control | ir_control | 1 | 0 | 0 | 160 | × | - | XU_CAM_CTRL | |
| HDR mode | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 0: 10-bit; 1: 12-bit |
| Zero drift calibration | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | |
| Erase chip | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | |

View File

@ -1,53 +0,0 @@
# Control Channels {#spec_control_channel}
| Name | Field | Address | Bandwidth | Node |
| :----- | :----- | :----- | :----- | :----- |
| Camera control channel | XU_CAM_CTRL_CHANNEL | 1 | 3 | |
| Half-Duplex channel | XU_HALF_DUPLEX_CHANNEL | 2 | 20 | |
| IMU write channel | XU_IMUDATA_WRITE_CHANNEL | 3 | 5 | |
| IMU read channel | XU_IMUDATA_READ_CHANNEL | 4 | 2000 | |
| File channel | XU_FILE_CHANNEL | 5 | 2000 | |
## Camera Control Channel
The channel provides get, set and query (min, max, default).
## Half-Duplex Channel
The channel only provides set, such as zero drift correction.
## IMU Channel
The channel is used to request and response IMU data, see @ref spec_imu_data.
## File Channel
The channel is used to read and write device information, image params, and IMU params.
| Name | Header | Size | File | Checksum |
| :--- | :- | :--- | :--- | :-------- |
| Bytes | 1 | 2 | - | 1 |
| Type | uint8_t | uint16_t | - | uint8_t |
| Description | Flags | Content size | Content data | Checksum, XOR of all content bytes |
| Header Bit Subscript | Description |
| :------------------- | :---------- |
| 0 | Device information |
| 1 | Image params |
| 2 | IMU params |
| 3~6 | Undefined |
| 7 | 0: Get; 1: Set |
### File Content Packet
| Name | ID | Size | Content |
| :--- | :- | :--- | :------ |
| Bytes | 1 | 2 | - |
| Type | uint8_t | uint16_t | - |
| Description | Content ID | Content size | Content data |
| File | ID | Max Size |
| :--- | :- | :------- |
| Device information | 1 | 250 |
| Image params | 2 | 250 |
| IMU params | 4 | 500 |

View File

@ -1,16 +0,0 @@
# Device Information {#spec_hardware_info}
| Name | Field | Fixed Value | USB Descriptor | UVC Extension Unit | Bytes | Note |
| :----- | :----- | :-------- | :-------------- | :----------------- | :-------- | :----- |
| VID | vid | 0x04B4 | √ | × | 2 | |
| PID | pid | 0x00F9 | √ | × | 2 | |
| Device name | name | MYNT-EYE-? | √ | √ Get | 16 | MYNT-EYE-S1000 |
| Serial number | serial_number | - | √ | √ Get | 16 | |
| Firmware version | firmware_version | - | √ | √ Get | 2 | major,minor |
| Hardware version | hardware_version | - | × | √ Get | 3 | major,minor,flag |
| Spec version | spec_version | - | × | √ Get | 2 | major,minor |
| Lens type | lens_type | - | × | √ Get/Set | 4 | vendor(2),product(2); default: 0 |
| IMU type | imu_type | - | × | √ Get/Set | 4 | vendor(2),product(2); default: 0 |
| Nominal baseline | nominal_baseline | - | × | √ Get/Set | 2 | unit: mm; default: 0 |
| Auxiliary chip version | auxiliary_chip_version | - | × | √ Get | 2 | major,minor |
| isp version | isp_version | - | × | √ Get | 2 | major,minor |

View File

@ -1,20 +0,0 @@
# Image Data {#spec_image_data}
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Frame ID | frame_id | - | 2 | uint16_t; [0,65535] |
| Timestamp | timestamp | 10 us | 4 | uint32_t |
| Exposure Time | exposure_time | 10 us | 2 | uint16_t |
## Image Packet
| Name | Header | Size | Frame ID | Timestamp | Exposure Time | Checksum |
| :--- | :----- | :--- | :------- | :-------- | :------------ | :------- |
| Bytes | 1 | 1 | 2 | 4 | 2 | 1 |
| Type | uint8_t | uint8_t | uint16_t | uint32_t | uint16_t | uint8_t |
| Description | 0x3B | 0x08, content size | Frame ID | Timestamp | Exposure time | Checksum, XOR of all content bytes |
* The image packet will be dropped, if checksum is incorrect.
* The accuracy of the time unit: 0.01 ms / 10 us.
* The timestamp could indicate 11.9 hours, it will accumulate again after overflow.
* The timestamp accumulation starts from the time of power-on, instead of opening.

View File

@ -1,23 +0,0 @@
# Image Params {#spec_image_params}
## Image Intrinsics
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Image width | width | px | 2 | uint16_t; [0,65535] |
| Image height | height | px | 2 | uint16_t; [0,65535] |
| Focal length | fx | - | 8 | double |
| ^ | fy | - | 8 | double |
| Principal point | cx | - | 8 | double |
| ^ | cy | - | 8 | double |
| Distortion model | model | - | 1 | uint8_t; pinhole,... |
| Distortion coefficients | coeffs[5] | - | 40 | double; k1,k2,p1,p2,k3 |
## Image Extrinsics
Transformation matrix from left image to right image.
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Rotation matrix | rotation[3][3] | - | 72 | double |
| Translation vector | translation[3] | - | 24 | double |

View File

@ -1,42 +0,0 @@
# IMU Data {#spec_imu_data}
## IMU Request Packet
| Name | Header | Serial Number |
| :--- | :----- | :------------ |
| Bytes | 1 | 4 |
| Type | uint8_t | uint32_t |
| Description | 0x5A | First request should be 0, otherwise the last one |
## IMU Response Packet
The IMU response packet contains multiple IMU packets, and each IMU packet contains multiple IMU segments.
| Name | Header | State | Size | IMU Packets | Checksum |
| :--- | :----- | :---- | :--- | :---------- | :------- |
| Bytes | 1 | 1 | 2 | ... | 1 |
| Type | uint8_t | uint8_t | uint16_t | - | uint8_t |
| Description | 0x5B | 0 is success, others are failed | Content size | IMU packets | Checksum, XOR of all content bytes |
### IMU Packet
The IMU packet is an array of IMU datas.
| Name | Serial Number | Timestamp | Count | IMU Datas |
| :--- | :------------ | :-------- | :---- | :-------- |
| Bytes | 4 | 4 | 1 | ... |
| Type | uint32_t | uint32_t | uint8_t | - |
| Description | Serial number | IMU basic timestamp | The number of IMU datas | IMU datas |
### IMU Segment
| Name | Offset | Frame ID | Accelerometer | Temperature | Gyroscope |
| :--- | :----- | :------- | :------------ | :---------- | :-------- |
| Bytes | 2 | 2 | 6 | 2 | 6 |
| Type | int16_t | uint16_t | int16_t * 3 | int16_t | int16_t * 3 |
| Description | The timestamp offset | Image frame ID | Accel x,y,z values | IMU temperature | Gyro x,y,z values |
* Formula for converting the accel & gyro values to real ones: **real = data * range / 0x10000** .
* ``accel`` default ``range`` is **8 g**, ``gyro`` default ``range`` is **1000 deg/s**.
* Formula for converting the temperature to real value: **real = data / ratio + offset** .
* default ``ratio`` is **326.8**, default ``offset`` is **25℃**.

View File

@ -1,23 +0,0 @@
# IMU Params {#spec_imu_params}
## IMU Intrinsics
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Scale matrix | acc_scale[3][3] | - | 72 | double |
| ^ | gyro_scale[3][3] | - | 72 | double |
| Zero-drift | acc_drift[3] | - | 24 | double |
| ^ | gyro_drift[3] | - | 24 | double |
| Noise density | acc_noise[3] | - | 24 | double |
| ^ | gyro_noise[3] | - | 24 | double |
| Random walk | acc_bias[3] | - | 24 | double |
| ^ | gyro_bias[3] | - | 24 | double |
## IMU Extrinsics
Transformation matrix from left image to IMU.
| Name | Field | Unit | Bytes | Note |
| :----- | :----- | :----- | :-------- | :----- |
| Rotation matrix | rotation[3][3] | - | 72 | double |
| Translation vector | translation[3] | - | 24 | double |

View File

@ -1,4 +0,0 @@
# Device Control Specification {#specs_ctrl}
* @subpage spec_control_api
* @subpage spec_control_channel

View File

@ -1,7 +0,0 @@
# Device Data Specification {#specs_data}
* @subpage spec_hardware_info
* @subpage spec_image_params
* @subpage spec_imu_params
* @subpage spec_image_data
* @subpage spec_imu_data

View File

@ -1,20 +0,0 @@
#!/usr/bin/env bash
# Copyright 2018 Slightech Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
LANGS=(
en
zh-Hans
)
[ $# -gt 0 ] && echo "LANGS=(${LANGS[@]})"

View File

@ -1,3 +0,0 @@
#projectlogo img {
margin: 1em 0.5em 1em 1em;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +0,0 @@
# 编译 on Linux {#guide_build_linux}
> Ubuntu 16.04, Ubuntu 14.04
## 获取代码
```bash
git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
```
## 准备依赖
```bash
cd mynt-eye-s-sdk/
make init
```
### [OpenCV](https://opencv.org/)
编译前可在系统终端Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
```bash
# Linux, macOS
export OpenCV_DIR=~/opencv
# Windows
set OpenCV_DIR=C:\opencv
```
## 编译代码
```bash
make install
```
结果:
![make install](make_install.png)
\latexonly
\includegraphics[width=0.6\textwidth,keepaspectratio]{make_install.png}
\endlatexonly
> CMake 如何引入编译好的库,可参考 `samples/CMakeLists.txt` 里的配置。

View File

@ -1,113 +0,0 @@
# 编译 on Windows {#guide_build_win}
> Windows 10
## 前提条件
* [Git](https://git-scm.com/downloads),用于获取代码。
* [CMake](https://cmake.org/download/),用于构建编译。
* [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html),用于生成文档。
最终命令提示符Command Prompt, cmd里可找到如下命令
```cmd
>cmake --version
cmake version 3.10.1
>git --version
git version 2.11.1.windows.1
>doxygen --version
1.8.13
```
* [Visual Studio](https://www.visualstudio.com/)
* [Visual Studio 2015](https://my.visualstudio.com/Downloads?q=Visual Studio 2015)
* [Visual Studio 2017](https://my.visualstudio.com/Downloads?q=Visual Studio 2017)
* [Windows 10 SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk)
以 Visual Studio 2015 举例,请在系统环境变量 `PATH` 里添加上如下路径:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
C:\Program Files (x86)\MSBuild\14.0\Bin
最终命令提示符Command Prompt, cmd里可找到如下命令
```cmd
>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
>link
Microsoft (R) Incremental Linker Version 14.00.24215.1
>lib
Microsoft (R) Library Manager Version 14.00.24215.1
>msbuild
Microsoft (R) 生成引擎版本 14.0.25420.1
```
* [MSYS2](http://www.msys2.org/)
* [国内镜像](https://lug.ustc.edu.cn/wiki/mirrors/help/msys2)
* [pacman](https://wiki.archlinux.org/index.php/pacman)
打开 MSYS2 MSYS ,然后执行:
```msys
$ pacman -Syu
$ pacman -S make
```
并在系统环境变量 `PATH` 里添加上如下路径:
C:\msys64\usr\bin
最终命令提示符Command Prompt, cmd里可找到如下命令
```cmd
>make --version
GNU Make 4.2.1
```
## 获取代码
```cmd
>git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
```
## 准备依赖
```cmd
>cd mynt-eye-s-sdk
>make init
Make init
Init deps
Install cmd: pacman -S
Install deps: git clang-format
pacman -S clang-format (not exists)
error: target not found: clang-format
pip install --upgrade autopep8 cpplint pylint requests
...
Init git hooks
ERROR: clang-format-diff is not installed!
Expect cmake version >= 3.0
cmake version 3.10.1
```
### [OpenCV](https://opencv.org/)
编译前可在系统终端Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
```bash
# Linux, macOS
export OpenCV_DIR=~/opencv
# Windows
set OpenCV_DIR=C:\opencv
```
## 编译代码
```cmd
>make install
```

View File

@ -1,6 +0,0 @@
# 日志 {#guide_log}
日志系统用的 `glog` ,通用配置在头文件 `logger.h` 里。
* 日志文件会存储在当前工作目录, `make cleanlog` 可以清理。
* 如果需要打开详细日志,请取消 `logger.h` 里注释的 `FLAGS_v = 2;` ,重新编译。

View File

@ -1,13 +0,0 @@
# OpenCV 依赖 {#guide_opencv}
SDK 提供了三层接口,其 OpenCV 依赖情况如下:
* `api` 上层接口,依赖 OpenCV 。
* `device`,中间层接口,不依赖 OpenCV 。
* `uvc`,底层接口,不依赖 OpenCV 。
如果不想使用 OpenCV ,你可编辑 `<sdk>/cmake/Option.cmake` 里的 `WITH_API` 选项,设为 `OFF` 就能关闭 `api` 层代码编译:
```cmake
option(WITH_API "Build with API layer, need OpenCV" ON)
```

View File

@ -1,30 +0,0 @@
# ROS 封装 {#guide_ros}
ROS 封装实现在 ``<sdk>/wrappers/ros`` 目录。
## 依赖
* [ROS](http://www.ros.org/) 环境。
## 编译
```bash
cd <sdk>
make ros
```
## 运行
运行发布节点,
```bash
source wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper mynteye.launch
```
运行发布节点,同时打开 RViz 预览图像,
```bash
source wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper display.launch
```

View File

@ -1,46 +0,0 @@
# 样例 {#guide_samples}
样例在 `<sdk>/samples` 目录,其提供了不同接口层的使用范例。
## 依赖
* [OpenCV](https://opencv.org/),用于显示图像。
* 编译前可在系统终端Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
```bash
# Linux, macOS
export OpenCV_DIR=~/opencv
# Windows
set OpenCV_DIR=C:\opencv
```
## 编译
```bash
make samples
```
## 运行
运行 `api` 层接口样例,显示图像并输出 IMU 。
```bash
./samples/_output/bin/api/camera_a
# Windows
.\samples\_output\bin\api\camera_a.bat
```
运行 `device` 层接口样例,显示图像并输出 IMU 。
```bash
./samples/_output/bin/device/camera_d
# Windows
.\samples\_output\bin\device\camera_d.bat
```
## 结语
更多样例的说明,请见 `samples/README.md`

View File

@ -1,73 +0,0 @@
# 工具 {#guide_tools}
工具在 `<sdk>/tools` 目录,其提供一些有用的脚本和程序。
## 依赖
* [OpenCV](https://opencv.org/),部分工具需要。
* 编译前可在系统终端Windows 命令提示符)里如下指定 OpenCV 路径,其为 `OpenCVConfig.cmake` 目录:
```bash
# Linux, macOS
export OpenCV_DIR=~/opencv
# Windows
set OpenCV_DIR=C:\opencv
```
* Python 第三方库,脚本需要。
```bash
cd tools/
sudo pip install -r requirements.txt
```
## 编译
```bash
make tools
```
## 录制数据集
```bash
./tools/_output/bin/dataset/record
# Windows
.\tools\_output\bin\dataset\record.bat
```
默认录制进 `dataset` 目录,加参数可指定该目录。
## 分析数据集
分析 IMU 数据,
```bash
python tools/analytics/imu_analytics.py -i dataset -c tools/config/mynteye/mynteye_config.yaml \
-al=-1.2,1.2 -gl= -gdu=d -gsu=d -kl=
```
![imu analytics](imu_analytics.png)
\latexonly
\includegraphics[width=0.6\textwidth,keepaspectratio]{imu_analytics.png}
\endlatexonly
分析图像 & IMU 时间戳,
```bash
python tools/analytics/stamp_analytics.py -i dataset -c tools/config/mynteye/mynteye_config.yaml
```
![stamp analytics](stamp_analytics.png)
\latexonly
\includegraphics[width=0.6\textwidth,keepaspectratio]{stamp_analytics.png}
\endlatexonly
> 如果用 ROS ,分析脚本也支持 ROS Bag 格式。
## 结语
设备信息读写、校验码等更多工具的说明,请见 `tools/README.md`

View File

@ -1,9 +0,0 @@
# SDK 指导 {#guides}
* @subpage guide_build_linux
* @subpage guide_build_win
* @subpage guide_samples
* @subpage guide_tools
* @subpage guide_log
* @subpage guide_opencv
* @subpage guide_ros

View File

@ -1,11 +0,0 @@
# MYNT EYE S SDK {#mainpage}
* <a class="el" href="annotated.html">API 类</a>
* <a class="el" href="modules.html">API 模块</a>
* \link enumerations 枚举类型\endlink
* \link datatypes 数据类型\endlink
* \link utils 工具函数\endlink
* \link calibration 内参与外参\endlink
* <span style="font-weight:bold">设备说明</span>
* @subpage specs_data
* @subpage specs_ctrl

View File

@ -1,27 +0,0 @@
# 控制 API 说明 {#spec_control_api}
控制有两种实现方式,一是通过 UVC 标准协议,二是通过 UVC 拓展通道自定义协议。
## 标准协议
| 名称 | 字段 | 字节数 | 默认值 | 最小值 | 最大值 | 是否储存 | Flash 地址 | 说明 |
| :----- | :----- | :-------- | :-------- | :-------- | :-------- | :----------- | :----------- | :----- |
| 亮度 | brightness | 2 | 192 | 0 | 255 | √ | 0x14 | 关闭自动曝光,手动设定的参数 |
> UVC 标准协议实现的控制,有现成的 API 进行 Get & Set ,包括 Min, Max, Default 。
## 自定义协议
| 名称 | 字段 | 字节数 | 默认值 | 最小值 | 最大值 | 是否储存 | Flash 地址 | 所属通道 | 通道地址 | 说明 |
| :----- | :----- | :-------- | :-------- | :-------- | :-------- | :----------- | :----------- | :----------- | :----------- | :----- |
| 曝光模式 | exposure_mode | 1 | 0 | 0 | 1 | √ | 0x0F | XU_CAM_CTRL | 0x0100 | 0开启自动曝光 1关闭 |
| 最大增益 | max_gain | 2 | 8 | 0 | 255 | √ | 0x1D | XU_CAM_CTRL | 0x0100 | 开始自动曝光,可设定的阈值 |
| 最大曝光时间 | max_exposure_time | 2 | 333 | 0 | 1000 | √ | 0x1B | XU_CAM_CTRL | 0x0100 | 开始自动曝光,可设定的阈值 |
| 期望亮度 | desired_brightness | 2 | 122 | 1 | 255 | √ | 0x19 | XU_CAM_CTRL | 0x0100 | |
| 擦除芯片 | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | 0x0200 | |
| 最小曝光时间 | min_exposure_time | 2 | 0 | 0 | 1000 | √ | - | XU_CAM_CTRL | 0x0100 | 开始自动曝光,可设定的阈值 |
| 加速度计量程 | accelerometer_range | 2 | 12 | 6 | 48 | √ | - | XU_CAM_CTRL | 0x0100 | |
| 陀螺仪量程 | gyroscope_range | 2 | 1000 | 250 | 4000 | √ | - | XU_CAM_CTRL | 0x0100 | |
| 加速度计低通滤波 | accelerometer_low_pass_filter | 2 | 2 | 0 | 2 | √ | - | XU_CAM_CTRL | 0x0100 | |
| 陀螺仪低通滤波 | gyroscope__low_pass_filter | 2 | 64 | 23 | 64 | √ | - | XU_CAM_CTRL | 0x0100 | |

View File

@ -1,53 +0,0 @@
# 拓展通道说明 {#spec_control_channel}
| 名称 | 字段 | 地址 | 带宽 | 说明 |
| :----- | :----- | :----- | :----- | :----- |
| 相机控制通道 | XU_CAM_CTRL_CHANNEL | 1 | 3 | |
| 半双工通道 | XU_HALF_DUPLEX_CHANNEL | 2 | 20 | |
| IMU 请求通道 | XU_IMUDATA_WRITE_CHANNEL | 3 | 5 | |
| IMU 响应通道 | XU_IMUDATA_READ_CHANNEL | 4 | 2000 | |
| 文件通道 | XU_FILE_CHANNEL | 5 | 2000 | |
## 相机控制通道
相机控制通道是那些需要 Get & Set & Query 的控制通道,其中 Query 细分为 Min, Max, Default 。
## 半双工通道
半双工通道是那些仅需 Set 的控制通道,如请求零漂矫正。
## IMU 通道
用来请求和响应 IMU 数据的通道,可参见 @ref spec_imu_data 。
## 文件通道
用来读写硬件信息、图像参数、 IMU 参数的通道。
| Name | Header | Size | File | Checksum |
| :--- | :----- | :--- | :--- | :-------- |
| 字节数 | 1 | 2 | - | 1 |
| 类型 | uint8_t | uint16_t | - | uint8_t |
| 描述 | 标识 | 文件内容大小 | 文件内容 | 校验码(文件内容所有字节异或) |
| Header Bit Subscript | Description |
| :------------------- | :---------- |
| 0 | 硬件信息 |
| 1 | 图像参数 |
| 2 | IMU 参数 |
| 3~6 | 未定义 |
| 7 | 0: Get; 1: Set |
### 文件内容包
| Name | ID | Size | Content |
| :--- | :- | :--- | :------ |
| 字节数 | 1 | 2 | - |
| 类型 | uint8_t | uint16_t | - |
| 描述 | 内容 ID | 内容大小 | 内容 |
| File | ID | Max Size |
| :--- | :- | :------- |
| 硬件信息 | 1 | 250 |
| 图像参数 | 2 | 404 |
| IMU 参数 | 4 | 500 |

View File

@ -1,19 +0,0 @@
# 硬件信息说明 {#spec_hardware_info}
| 名称 | 字段 | 固定值 | 描述符获取 | 拓展通道获取 | 字节数 | 说明 |
| :----- | :----- | :-------- | :-------------- | :----------------- | :-------- | :----- |
| VID | vid | 0x04B4 | √ | × | 2 | |
| PID | pid | 0x00F9 | √ | × | 2 | |
| 设备名称 | name | MYNT-EYE-? | √ | √ Get | 16 | MYNT-EYE-S1000 |
| 序列号 | serial_number | - | √ | √ Get | 16 | |
| 固件版本 | firmware_version | - | √ | √ Get | 2 | major,minor |
| 硬件版本 | hardware_version | - | × | √ Get | 3 | major,minor,flag |
| 协议版本 | spec_version | - | × | √ Get | 2 | major,minor |
| 镜头类型 | lens_type | - | × | √ Get/Set | 4 | vendor(2),product(2) ,未 Set 默认 0 |
| IMU 类型 | imu_type | - | × | √ Get/Set | 4 | vendor(2),product(2) ,未 Set 默认 0 |
| 基线长度 | nominal_baseline | - | × | √ Get/Set | 2 | 单位 mm ,未 set 默认 0 |
| 辅助芯片版本 | auxiliary_chip_version | - | × | √ Get | 2 | major,minor |
| ISP版本 | isp_version | - | × | √ Get | 2 | major,minor |
* 描述符获取:指通用 USB 设备信息,可用工具查看。
* 拓展通道获取指通过拓展通道UVC Extension Unit问硬件获取到的信息需要读取。

View File

@ -1,21 +0,0 @@
# 图像数据说明 {#spec_image_data}
| 名称 | 字段 | 单位 | 字节数 | 说明 |
| :----- | :----- | :----- | :-------- | :----- |
| 帧 ID | frame_id | - | 2 | uint16_t; [0,65535] |
| 时间戳 | timestamp | 1 us | 8 | uint64_t |
| 曝光时间 | exposure_time | 1 us | 2 | uint16_t |
> 图像数据传输方式:倒序排在图像尾部。
## 图像数据包
| Name | Header | Size | FrameID | Timestamp | ExposureTime | Checksum |
| :--- | :----- | :--- | :------ | :-------- | :----------- | :------- |
| 字节数 | 1 | 1 | 2 | 8 | 2 | 1 |
| 类型 | uint8_t | uint8_t | uint16_t | uint64_t | uint16_t | uint8_t |
| 描述 | 0x3B | 0x10 (数据内容大小) | 帧 ID | 时间戳 | 曝光时间 | 校验码(数据内容所有字节异或) |
* 数据包校验不过,会丢弃该帧。
* 时间的单位精度为: 1 us 。
* 时间累计是从上电时从开始,而不是从打开时开始。

View File

@ -1,25 +0,0 @@
# 图像参数说明 {#spec_image_params}
## 图像内参
| 名称 | 字段 | 单位 | 字节数 | 说明 |
| :----- | :----- | :----- | :-------- | :----- |
| 宽度 | width | px | 2 | uint16_t; [0,65535] |
| 高度 | height | px | 2 | uint16_t; [0,65535] |
| 焦距 | fx | - | 8 | double |
| ^ | fy | - | 8 | double |
| 图像中心 | cx | - | 8 | double |
| ^ | cy | - | 8 | double |
| 畸变模型 | model | - | 1 | uint8_t; pinhole,... |
| 畸变参数 | coeffs[5] | - | 40 | double; k1,k2,p1,p2,k3 |
> 图像分辨率不同,内参不同。多分辨率的话,需有多个内参。
## 图像外参
Left Image 到 Right Image 的变换矩阵。
| 名称 | 字段 | 单位 | 字节数 | 说明 |
| :----- | :----- | :----- | :-------- | :----- |
| 旋转矩阵 | rotation[3][3] | - | 72 | double |
| 平移矩阵 | translation[3] | - | 24 | double |

View File

@ -1,42 +0,0 @@
# IMU 数据说明 {#spec_imu_data}
## IMU 请求数据包
| Name | Header | Serial Number |
| :--- | :----- | :------------ |
| 字节数 | 1 | 4 |
| 类型 | uint8_t | uint32_t |
| 描述 | 0x5A | 首次请求写 0 ,不然写上次响应数据包最后一个 IMU 包的序列号 |
## IMU 响应数据包
IMU 响应数据包里会包含1个 IMU 包,而每个 IMU 包又带有多个 IMU 段。
| Name | Header | State | Size | IMU Packets | Checksum |
| :--- | :----- | :---- | :--- | :---------- | :------- |
| 字节数 | 1 | 1 | 2 | ... | 1 |
| 类型 | uint8_t | uint8_t | uint16_t | - | uint8_t |
| 描述 | 0x5B | 正常状态为 0 ,否则错误 | 数据内容大小 | 所包含的 IMU 包 | 校验码(数据内容所有字节异或) |
### IMU 包
IMU 包/小包,是一组 IMU 数据。
| Name | Count | IMU Datas |
| :--- | :-----| :-------- |
| 字节数 | 2 | ... |
| 类型 | uint16_t | - |
| 描述 | IMU 段数量 | 所包含的 IMU 段 |
### IMU 段
| Name | Serial Number | Timestamp | flag | Temperature | Accelerometer or Gyroscope |
| :--- | :------------ | :-------- | :----| :----------- | :------------------------- |
| 字节数 | 4 | 8 | 1 | 2 | 6 |
| 类型 | uint32_t | uint64_t | int8_t | int16_t | int16_t * 3 |
| Description | 序列号 | 时间戳 | 指定传感器类型 | IMU 的温度 | 陀螺仪或陀螺仪 x y z 三轴的值 |
* 加速度计和陀螺仪的计量值换算成物理值公式: **real = data * range / 0x10000**
* 加速度计量程默认值为 **12 g** ,陀螺仪量程默认值为 **1000 deg/s**
* 温度计量值换算成物理值公式: **real = data / ratio + offset**
* ``ratio`` 默认值为 **326.8** ``offset`` 默认值为 **25℃**

View File

@ -1,23 +0,0 @@
# IMU 参数说明 {#spec_imu_params}
## IMU 内参
| 名称 | 字段 | 单位 | 字节数 | 说明 |
| :----- | :----- | :----- | :-------- | :----- |
| 比例因子 | acc_scale[3][3] | - | 72 | double |
| ^ | gyro_scale[3][3] | - | 72 | double |
| 零漂 | acc_drift[3] | - | 24 | double |
| ^ | gyro_drift[3] | - | 24 | double |
| 噪声密度 | acc_noise[3] | - | 24 | double |
| ^ | gyro_noise[3] | - | 24 | double |
| 随机游走 | acc_bias[3] | - | 24 | double |
| ^ | gyro_bias[3] | - | 24 | double |
## IMU 外参
Left Image 到 IMU 的变换矩阵。
| 名称 | 字段 | 单位 | 字节数 | 说明 |
| :----- | :----- | :----- | :-------- | :----- |
| 旋转矩阵 | rotation[3][3] | - | 72 | double |
| 平移矩阵 | translation[3] | - | 24 | double |

View File

@ -1,4 +0,0 @@
# 设备控制说明 {#specs_ctrl}
* @subpage spec_control_api
* @subpage spec_control_channel

View File

@ -1,7 +0,0 @@
# 设备数据说明 {#specs_data}
* @subpage spec_hardware_info
* @subpage spec_image_params
* @subpage spec_imu_params
* @subpage spec_image_data
* @subpage spec_imu_data

View File

@ -44,21 +44,21 @@ PROJECT_NUMBER = 2.3.4
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = http://www.myntai.com/mynteye/standard
PROJECT_BRIEF = https://www.myntai.com/mynteye/standard
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
PROJECT_LOGO = ../static/images/icon.png
PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = ../_output/en
OUTPUT_DIRECTORY = _doxygen
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@ -791,17 +791,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = mainpage.md \
specs_data.md \
spec_hardware_info.md \
spec_image_params.md \
spec_imu_params.md \
spec_image_data.md \
spec_imu_data.md \
specs_ctrl.md \
spec_control_api.md \
spec_control_channel.md \
/usr/local/include/mynteye
INPUT = ../include/mynteye
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -938,7 +928,7 @@ EXAMPLE_RECURSIVE = NO
# that contain images that are to be included in the documentation (see the
# \image command).
IMAGE_PATH = ../static/images
IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
@ -1115,7 +1105,7 @@ IGNORE_PREFIX =
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
# The default value is: YES.
GENERATE_HTML = YES
GENERATE_HTML = NO
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@ -1185,7 +1175,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = ../static/custom.css
HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@ -1667,7 +1657,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.
GENERATE_LATEX = YES
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@ -1947,7 +1937,7 @@ MAN_LINKS = NO
# captures the structure of the code including all documentation.
# The default value is: NO.
GENERATE_XML = NO
GENERATE_XML = YES
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@ -2102,7 +2092,8 @@ INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN_WORKING \
"MYNTEYE_BEGIN_NAMESPACE=namespace mynteye {" \
"MYNTEYE_END_NAMESPACE=}"
"MYNTEYE_END_NAMESPACE=}" \
"MYNTEYE_API=" "LAST="
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The

19
docs/Makefile Normal file
View File

@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

23
docs/api/api.rst Normal file
View File

@ -0,0 +1,23 @@
API
===
API
---
.. doxygenclass:: mynteye::API
:project: mynteyes
:members:
api::StreamData
---------------
.. doxygenstruct:: mynteye::api::StreamData
:project: mynteyes
:members:
api::MotionData
---------------
.. doxygenstruct:: mynteye::api::MotionData
:project: mynteyes
:members:

12
docs/api/contents.rst Normal file
View File

@ -0,0 +1,12 @@
.. _api:
API DOC
=========
.. toctree::
api
device
enums
types
utils

30
docs/api/device.rst Normal file
View File

@ -0,0 +1,30 @@
Device
======
Device
------
.. doxygenclass:: mynteye::Device
:project: mynteyes
:members:
device::Frame
-------------
.. doxygenclass:: mynteye::device::Frame
:project: mynteyes
:members:
device::StreamData
------------------
.. doxygenstruct:: mynteye::device::StreamData
:project: mynteyes
:members:
device::MotionData
------------------
.. doxygenstruct:: mynteye::device::MotionData
:project: mynteyes
:members:

67
docs/api/enums.rst Normal file
View File

@ -0,0 +1,67 @@
Enums
=====
..
.. doxygengroup:: enumerations
:project: mynteyes
Model
-----
.. doxygenenum:: mynteye::Model
:project: mynteyes
Stream
------
.. doxygenenum:: mynteye::Stream
:project: mynteyes
Capabilities
------------
.. doxygenenum:: mynteye::Capabilities
:project: mynteyes
Info
----
.. doxygenenum:: mynteye::Info
:project: mynteyes
Option
------
.. doxygenenum:: mynteye::Option
:project: mynteyes
Source
------
.. doxygenenum:: mynteye::Source
:project: mynteyes
AddOns
------
.. doxygenenum:: mynteye::AddOns
:project: mynteyes
Format
------
.. doxygenenum:: mynteye::Format
:project: mynteyes
CalibrationModel
----------------
.. doxygenenum:: mynteye::CalibrationModel
:project: mynteyes
DisparityComputingMethod
------------------------
.. doxygenenum:: mynteye::DisparityComputingMethod
:project: mynteyes

75
docs/api/types.rst Normal file
View File

@ -0,0 +1,75 @@
Types
=====
OptionInfo
----------
.. doxygenstruct:: mynteye::OptionInfo
:project: mynteyes
:members:
Resolution
----------
.. doxygenstruct:: mynteye::Resolution
:project: mynteyes
:members:
StreamRequest
-------------
.. doxygenstruct:: mynteye::StreamRequest
:project: mynteyes
:members:
Intrinsics
----------
IntrinsicsPinhole
~~~~~~~~~~~~~~~~~
.. doxygenstruct:: mynteye::IntrinsicsPinhole
:project: mynteyes
:members:
IntrinsicsEquidistant
~~~~~~~~~~~~~~~~~~~~~
.. doxygenstruct:: mynteye::IntrinsicsEquidistant
:project: mynteyes
:members:
ImuIntrinsics
~~~~~~~~~~~~~
.. doxygenstruct:: mynteye::ImuIntrinsics
:project: mynteyes
:members:
MotionIntrinsics
~~~~~~~~~~~~~~~~~
.. doxygenstruct:: mynteye::MotionIntrinsics
:project: mynteyes
:members:
Extrinsics
----------
.. doxygenstruct:: mynteye::Extrinsics
:project: mynteyes
:members:
ImgData
-------
.. doxygenstruct:: mynteye::ImgData
:project: mynteyes
:members:
ImuData
-------
.. doxygenstruct:: mynteye::ImuData
:project: mynteyes
:members:

32
docs/api/utils.rst Normal file
View File

@ -0,0 +1,32 @@
Utils
=====
select
------
.. doxygenfunction:: select
:project: mynteyes
select_request
--------------
.. doxygenfunction:: select_request
:project: mynteyes
get_real_exposure_time
----------------------
.. doxygenfunction:: get_real_exposure_time
:project: mynteyes
get_sdk_root_dir
----------------
.. doxygenfunction:: get_sdk_root_dir
:project: mynteyes
get_sdk_install_dir
-------------------
.. doxygenfunction:: get_sdk_install_dir
:project: mynteyes

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

194
docs/conf.py Normal file
View File

@ -0,0 +1,194 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'MYNT® EYE S SDK'
copyright = '2018, MYNTAI'
author = 'MYNTAI'
# The short X.Y version
version = '2.3.4'
# The full version, including alpha/beta/rc tags
release = version
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'breathe',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
# on_rtd is whether we are on readthedocs.org
import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
import subprocess
subprocess.call('doxygen', shell=True)
# -- Options for HTML output -------------------------------------------------
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'MYNTEYESSDKdoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'MYNTEYESSDK.tex', 'MYNT® EYE S SDK Documentation',
'MYNTAI', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'mynteyessdk', 'MYNT® EYE S SDK Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'MYNTEYESSDK', 'MYNT® EYE S SDK Documentation',
author, 'MYNTEYESSDK', 'One line description of project.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
breathe_projects = { 'mynteyes': '_doxygen/xml' }

View File

@ -0,0 +1,7 @@
# libmynteye configuration
#
# 1) Copy this file to: /etc/ld.so.conf.d/libmynteye.conf
# 2) Run this cmd in Terminal: sudo /sbin/ldconfig
/usr/local/cuda/lib64
$HOME/opencv-3.4.1/lib

BIN
docs/images/boardupdate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
docs/images/ir.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
docs/images/stmsuccess.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
docs/images/stmupdate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
docs/images/vs_cmd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
docs/images/vs_cmd_menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

BIN
docs/images/vs_cmd_test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

30
docs/index.rst Normal file
View File

@ -0,0 +1,30 @@
.. MYNT® EYE S SDK documentation master file, created by
sphinx-quickstart on Mon Mar 11 08:59:35 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
MYNT® EYE S SDK
===============
.. toctree::
:maxdepth: 2
:titlesonly:
src/mynteye/contents
src/sdk/contents
src/firmware/contents
src/data/contents
src/control/contents
src/log/contents
src/wrapper/contents
src/analytics/contents
src/slam/contents
api/contents
..
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

35
docs/make.bat Normal file
View File

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd

5
docs/requirements.txt Normal file
View File

@ -0,0 +1,5 @@
breathe>=4.11.1
restructuredtext-lint>=1.1.3
Sphinx>=1.8.1
sphinx-intl>=0.9.11
sphinx-rtd-theme>=0.4.2

View File

@ -0,0 +1,38 @@
.. _analytics_imu:
Analyzing IMU
==============
The SDK provides the script ``imu_analytics.py`` for IMU analysis. The tool details can be seen in `tools/README.md <https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/tools>`_ .
Refer to run commands and results on Linux:
.. code-block:: bash
$ python tools/analytics/imu_analytics.py -i dataset -c tools/config/mynteye/mynteye_config.yaml -al=-1.2,1.2 -gl= -gdu=d -gsu=d -kl=
imu analytics ...
input: dataset
outdir: dataset
gyro_limits: None
accel_limits: [(-1.2, 1.2), (-1.2, 1.2), (-1.2, 1.2), (-1.2, 1.2)]
time_unit: None
time_limits: None
auto: False
gyro_show_unit: d
gyro_data_unit: d
temp_limits: None
open dataset ...
imu: 20040, temp: 20040
timebeg: 4.384450, timeend: 44.615550, duration: 40.231100
save figure to:
dataset/imu_analytics.png
imu analytics done
The analysis result graph will be saved in the data set directory, as follows:
.. image:: ../../images/imu_analytics.png
In addition, the script specific options can be executed ``-h``:
.. code-block:: bash
$ python tools/analytics/imu_analytics.py -h

View File

@ -0,0 +1,55 @@
.. _analytics_stamp:
Analyze time stamps
====================
SDK provides a script for timestamp analysis ``stamp_analytics.py`` . Tool details are visible in `tools/README.md <https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/tools>`_ .
Reference run commands and results on Linux:
.. code-block:: bash
$ python tools/analytics/stamp_analytics.py -i dataset -c tools/config/mynteye/mynteye_config.yaml
stamp analytics ...
input: dataset
outdir: dataset
open dataset ...
save to binary files ...
binimg: dataset/stamp_analytics_img.bin
binimu: dataset/stamp_analytics_imu.bin
img: 1007, imu: 20040
rate (Hz)
img: 25, imu: 500
sample period (s)
img: 0.04, imu: 0.002
diff count
imgs: 1007, imus: 20040
imgs_t_diff: 1006, imus_t_diff: 20039
diff where (factor=0.1)
imgs where diff > 0.04*1.1 (0)
imgs where diff < 0.04*0.9 (0)
imus where diff > 0.002*1.1 (0)
imus where diff < 0.002*0.9 (0)
image timestamp duplicates: 0
save figure to:
dataset/stamp_analytics.png
stamp analytics done
The analysis result graph will be saved in the dataset directory, as follows:
.. image:: ../../images/stamp_analytics.png
In addition, the script specific options can be executed ``-h`` to understand:
.. code-block:: bash
$ python tools/analytics/stamp_analytics.py -h
.. tip::
Suggestions when recording data sets ``record.cc`` annotation display image inside ``cv::imshow()``, ``dataset.cc`` annotation display image inside ``cv::imwrite()`` . Because these operations are time-consuming, they can cause images to be discarded. In other words, consumption can't keep up with production, so some images are discarded. ``GetStreamDatas()`` used in ``record.cc`` only caches the latest 4 images.

View File

@ -0,0 +1,10 @@
.. _analytics:
Data Analytics
===============
.. toctree::
dataset
analytics_imu
analytics_stamp

View File

@ -0,0 +1,58 @@
.. _dataset:
Recording data sets
====================
The SDK provides the tool ``record`` for recording data sets. Tool details can be seen in `tools/README.md <https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/tools>`_ .
Reference run command:
.. code-block:: bash
./tools/_output/bin/dataset/record2
# Windows
.\tools\_output\bin\dataset\record2.bat
Reference run results on Linux:
.. code-block:: bash
$ ./tools/_output/bin/dataset/record
I0513 21:28:57.128947 11487 utils.cc:26] Detecting MYNT EYE devices
I0513 21:28:57.807116 11487 utils.cc:33] MYNT EYE devices:
I0513 21:28:57.807155 11487 utils.cc:37] index: 0, name: MYNT-EYE-S1000
I0513 21:28:57.807163 11487 utils.cc:43] Only one MYNT EYE device, select index: 0
I0513 21:28:57.808437 11487 channels.cc:114] Option::GAIN: min=0, max=48, def=24, cur=24
I0513 21:28:57.809999 11487 channels.cc:114] Option::BRIGHTNESS: min=0, max=240, def=120, cur=120
I0513 21:28:57.818678 11487 channels.cc:114] Option::CONTRAST: min=0, max=255, def=127, cur=127
I0513 21:28:57.831529 11487 channels.cc:114] Option::FRAME_RATE: min=10, max=60, def=25, cur=25
I0513 21:28:57.848914 11487 channels.cc:114] Option::IMU_FREQUENCY: min=100, max=500, def=200, cur=500
I0513 21:28:57.865185 11487 channels.cc:114] Option::EXPOSURE_MODE: min=0, max=1, def=0, cur=0
I0513 21:28:57.881434 11487 channels.cc:114] Option::MAX_GAIN: min=0, max=48, def=48, cur=48
I0513 21:28:57.897598 11487 channels.cc:114] Option::MAX_EXPOSURE_TIME: min=0, max=240, def=240, cur=240
I0513 21:28:57.913918 11487 channels.cc:114] Option::DESIRED_BRIGHTNESS: min=0, max=255, def=192, cur=192
I0513 21:28:57.930177 11487 channels.cc:114] Option::IR_CONTROL: min=0, max=160, def=0, cur=0
I0513 21:28:57.946341 11487 channels.cc:114] Option::HDR_MODE: min=0, max=1, def=0, cur=0
Saved 1007 imgs, 20040 imus to ./dataset
I0513 21:29:38.608772 11487 record.cc:118] Time beg: 2018-05-13 21:28:58.255395, end: 2018-05-13 21:29:38.578696, cost: 40323.3ms
I0513 21:29:38.608853 11487 record.cc:121] Img count: 1007, fps: 24.9732
I0513 21:29:38.608873 11487 record.cc:123] Imu count: 20040, hz: 496.983
Results save into ``<workdir>/dataset`` by default. You can also add parameter, select other directory to save.
Record contents:
.. code-block:: none
<workdir>/
└─dataset/
├─left/
│ ├─stream.txt # Image infomation
│ ├─000000.png # Imageindex 0
│ └─...
├─right/
│ ├─stream.txt # Image information
│ ├─000000.png # Imageindex 0
│ └─...
└─motion.txt # IMU information

View File

@ -0,0 +1,129 @@
.. _auto_exposure:
Enable auto exposure and its adjustment function
=================================================
Using the ``SetOptionValue()`` function of the API, you can set various control values of the current open device.
To enable auto exposure, set ``Option::EXPOSURE_MODE`` to ``0`` .
For mynteye s1030, the settings available for adjustment during auto exposure are:
* ``Option::MAX_GAIN`` Maximum gain.
* ``Option::MAX_EXPOSURE_TIME`` Maximum exposure time.
* ``Option::DESIRED_BRIGHTNESS`` Expected brightness.
For mynteye s2100/s210a, the settings available for adjustment during auto exposure are:
* ``Option::MAX_GAIN`` Maximum gain.
* ``Option::MAX_EXPOSURE_TIME`` Maximum exposure time.
* ``Option::DESIRED_BRIGHTNESS`` Expected brightness.
* ``Option::MIN_EXPOSURE_TIME`` Minimum exposure time.
Reference Code:
s1030
.. code-block:: c++
auto &&api = API::Create(argc, argv);
// auto-exposure: 0
api->SetOptionValue(Option::EXPOSURE_MODE, 0);
// max_gain: range [0,48], default 48
api->SetOptionValue(Option::MAX_GAIN, 48);
// max_exposure_time: range [0,240], default 240
api->SetOptionValue(Option::MAX_EXPOSURE_TIME, 240);
// desired_brightness: range [0,255], default 192
api->SetOptionValue(Option::DESIRED_BRIGHTNESS, 192);
LOG(INFO) << "Enable auto-exposure";
LOG(INFO) << "Set MAX_GAIN to " << api->GetOptionValue(Option::MAX_GAIN);
LOG(INFO) << "Set MAX_EXPOSURE_TIME to "
<< api->GetOptionValue(Option::MAX_EXPOSURE_TIME);
LOG(INFO) << "Set DESIRED_BRIGHTNESS to "
<< api->GetOptionValue(Option::DESIRED_BRIGHTNESS);
s2100/s210a
.. code-block:: c++
auto &&api = API::Create(argc, argv);
bool ok;
auto &&request = api->SelectStreamRequest(&ok);
if (!ok) return 1;
api->ConfigStreamRequest(request);
// auto-exposure: 0
api->SetOptionValue(Option::EXPOSURE_MODE, 0);
// max_gain: range [0,255], default 8
api->SetOptionValue(Option::MAX_GAIN, 8);
// max_exposure_time: range [0,1000], default 333
api->SetOptionValue(Option::MAX_EXPOSURE_TIME, 333);
// desired_brightness: range [1,255], default 122
api->SetOptionValue(Option::DESIRED_BRIGHTNESS, 122);
// min_exposure_time: range [0,1000], default 0
api->SetOptionValue(Option::MIN_EXPOSURE_TIME, 0);
LOG(INFO) << "Enable auto-exposure";
LOG(INFO) << "Set EXPOSURE_MODE to "
<< api->GetOptionValue(Option::EXPOSURE_MODE);
LOG(INFO) << "Set MAX_GAIN to " << api->GetOptionValue(Option::MAX_GAIN);
LOG(INFO) << "Set MAX_EXPOSURE_TIME to "
<< api->GetOptionValue(Option::MAX_EXPOSURE_TIME);
LOG(INFO) << "Set DESIRED_BRIGHTNESS to "
<< api->GetOptionValue(Option::DESIRED_BRIGHTNESS);
LOG(INFO) << "Set MIN_EXPOSURE_TIME to "
<< api->GetOptionValue(Option::MIN_EXPOSURE_TIME);
Reference running results on Linux:
s1030
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_auto_exposure
I0513 14:07:57.963943 31845 utils.cc:26] Detecting MYNT EYE devices
I0513 14:07:58.457536 31845 utils.cc:33] MYNT EYE devices:
I0513 14:07:58.457563 31845 utils.cc:37] index: 0, name: MYNT-EYE-S1000
I0513 14:07:58.457567 31845 utils.cc:43] Only one MYNT EYE device, select index: 0
I0513 14:07:58.474916 31845 auto_exposure.cc:37] Enable auto-exposure
I0513 14:07:58.491058 31845 auto_exposure.cc:38] Set MAX_GAIN to 48
I0513 14:07:58.505131 31845 auto_exposure.cc:39] Set MAX_EXPOSURE_TIME to 240
I0513 14:07:58.521375 31845 auto_exposure.cc:41] Set DESIRED_BRIGHTNESS to 192
s2100/s210a
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_auto_exposure
I/utils.cc:30 Detecting MYNT EYE devices
I/utils.cc:40 MYNT EYE devices:
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
I/utils.cc:51 Only one MYNT EYE device, select index: 0
I/utils.cc:79 MYNT EYE devices:
I/utils.cc:82 index: 0, request: width: 1280, height: 400, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 1, request: width: 1280, height: 400, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 2, request: width: 1280, height: 400, format: Format::BGR888, fps: 30
I/utils.cc:82 index: 3, request: width: 1280, height: 400, format: Format::BGR888, fps: 60
I/utils.cc:82 index: 4, request: width: 2560, height: 800, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 5, request: width: 2560, height: 800, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 6, request: width: 2560, height: 800, format: Format::BGR888, fps: 30
I/utils.cc:93 There are 7 stream requests, select index:
3
I/auto_exposure.cc:72 Enable auto-exposure
I/auto_exposure.cc:73 Set EXPOSURE_MODE to 0
I/auto_exposure.cc:75 Set MAX_GAIN to 8
I/auto_exposure.cc:76 Set MAX_EXPOSURE_TIME to 333
I/auto_exposure.cc:78 Set DESIRED_BRIGHTNESS to 122
I/auto_exposure.cc:80 Set MIN_EXPOSURE_TIME to 0
The sample program displays an image with a real exposure time in the upper left corner, in milliseconds.
Complete code examples, see `auto_exposure.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/auto_exposure.cc>`_ .

View File

@ -0,0 +1,13 @@
.. _ctrl:
MYNT® EYE Control
=================
.. toctree::
framerate
imu_range
auto_exposure
manual_exposure
infrared
imu_low_pass_filter

View File

@ -0,0 +1,108 @@
.. _framerate:
Set the frame rate of image & IMU frequency
============================================
Using the ``SetOptionValue()`` function in the API, you can set various control valuesfor the current device.
For mynteye s1030, to set the image frame rate and IMU frequency, set ``Option::FRAME_RATE`` and ``Option::IMU_FREQUENCY``.
.. Attention::
* The effective fps of the image: 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60.
* The effective frequency of IMU: 100, 200, 250, 333, 500.
For mynteye s2100/s210a, the image frame rate should be selected when running the sample, and the frame rate and resolution are combined as follows:
.. code-block:: bash
index: 0, request: width: 1280, height: 400, format: Format::BGR888, fps: 10
index: 1, request: width: 1280, height: 400, format: Format::BGR888, fps: 20
index: 2, request: width: 1280, height: 400, format: Format::BGR888, fps: 30
index: 3, request: width: 1280, height: 400, format: Format::BGR888, fps: 60
index: 4, request: width: 2560, height: 800, format: Format::BGR888, fps: 10
index: 5, request: width: 2560, height: 800, format: Format::BGR888, fps: 20
index: 6, request: width: 2560, height: 800, format: Format::BGR888, fps: 30
Reference Code:
s1030
.. code-block:: c++
auto &&api = API::Create(argc, argv);
// Attention: must set FRAME_RATE and IMU_FREQUENCY together, otherwise won't
// succeed.
// FRAME_RATE values: 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
api->SetOptionValue(Option::FRAME_RATE, 25);
// IMU_FREQUENCY values: 100, 200, 250, 333, 500
api->SetOptionValue(Option::IMU_FREQUENCY, 500);
LOG(INFO) << "Set FRAME_RATE to " << api->GetOptionValue(Option::FRAME_RATE);
LOG(INFO) << "Set IMU_FREQUENCY to "
<< api->GetOptionValue(Option::IMU_FREQUENCY);
s2100/s210a
.. code-block:: c++
auto &&api = API::Create(argc, argv);
if (!api) return 1;
bool ok;
auto &&request = api->SelectStreamRequest(&ok);
if (!ok) return 1;
api->ConfigStreamRequest(request);
LOG(INFO) << "Please set frame rate by 'SelectStreamRequest()'";
Reference running results on Linux:
s1030
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_framerate
I0513 14:05:57.218222 31813 utils.cc:26] Detecting MYNT EYE devices
I0513 14:05:57.899404 31813 utils.cc:33] MYNT EYE devices:
I0513 14:05:57.899430 31813 utils.cc:37] index: 0, name: MYNT-EYE-S1000
I0513 14:05:57.899435 31813 utils.cc:43] Only one MYNT EYE device, select index: 0
I0513 14:05:58.076257 31813 framerate.cc:36] Set FRAME_RATE to 25
I0513 14:05:58.076836 31813 framerate.cc:37] Set IMU_FREQUENCY to 500
I0513 14:06:21.702361 31813 framerate.cc:82] Time beg: 2018-05-13 14:05:58.384967, end: 2018-05-13 14:06:21.666115, cost: 23281.1ms
I0513 14:06:21.702388 31813 framerate.cc:85] Img count: 573, fps: 24.6122
I0513 14:06:21.702404 31813 framerate.cc:87] Imu count: 11509, hz: 494.348
s2100/s210a
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_framerate
I/utils.cc:30 Detecting MYNT EYE devices
I/utils.cc:40 MYNT EYE devices:
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
I/utils.cc:51 Only one MYNT EYE device, select index: 0
I/utils.cc:79 MYNT EYE devices:
I/utils.cc:82 index: 0, request: width: 1280, height: 400, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 1, request: width: 1280, height: 400, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 2, request: width: 1280, height: 400, format: Format::BGR888, fps: 30
I/utils.cc:82 index: 3, request: width: 1280, height: 400, format: Format::BGR888, fps: 60
I/utils.cc:82 index: 4, request: width: 2560, height: 800, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 5, request: width: 2560, height: 800, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 6, request: width: 2560, height: 800, format: Format::BGR888, fps: 30
I/utils.cc:93 There are 7 stream requests, select index:
2
I/framerate.cc:54 Please set frame rate by 'SelectStreamRequest()'
I/framerate.cc:99 Time beg: 2018-12-29 10:05:08.203095, end: 2018-12-29 10:08:20.074969, cost: 191872ms
I/framerate.cc:102 Img count: 5759, fps: 30.0148
I/framerate.cc:104 Imu count: 77163, hz: 402.159
After the sample program finishes running with ``ESC/Q``, it will output the calculated value of the frame rate of image & IMU frequency.
Complete code samplesplease see `framerate.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/framerate.cc>`_ .

View File

@ -0,0 +1,63 @@
.. _imu_low_pass_filter:
Low-pass Filter
===============
Using the ``SetOptionValue()`` function in the API, you can set various control values for the current device.
To set the value of accelerometer low-pass filter and gyroscope low-pass filter, set ``Option::ACCELEROMETER_LOW_PASS_FILTER`` and ``Option::GYROSCOPE_LOW_PASS_FILTER``.
.. Attention::
* s1030 doesn't support this feature
Reference Code:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
if (!api) return 1;
bool ok;
auto &&request = api->SelectStreamRequest(&ok);
if (!ok) return 1;
api->ConfigStreamRequest(request);
// ACCELEROMETER_RANGE values: 0, 1, 2
api->SetOptionValue(Option::ACCELEROMETER_LOW_PASS_FILTER, 2);
// GYROSCOPE_RANGE values: 23, 64
api->SetOptionValue(Option::GYROSCOPE_LOW_PASS_FILTER, 64);
LOG(INFO) << "Set ACCELEROMETER_LOW_PASS_FILTER to "
<< api->GetOptionValue(Option::ACCELEROMETER_LOW_PASS_FILTER);
LOG(INFO) << "Set GYROSCOPE_LOW_PASS_FILTER to "
<< api->GetOptionValue(Option::GYROSCOPE_LOW_PASS_FILTER);
Reference running results on Linux:
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_imu_low_pass_filter
I/utils.cc:30 Detecting MYNT EYE devices
I/utils.cc:40 MYNT EYE devices:
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
I/utils.cc:51 Only one MYNT EYE device, select index: 0
I/utils.cc:79 MYNT EYE devices:
I/utils.cc:82 index: 0, request: width: 1280, height: 400, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 1, request: width: 1280, height: 400, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 2, request: width: 1280, height: 400, format: Format::BGR888, fps: 30
I/utils.cc:82 index: 3, request: width: 1280, height: 400, format: Format::BGR888, fps: 60
I/utils.cc:82 index: 4, request: width: 2560, height: 800, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 5, request: width: 2560, height: 800, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 6, request: width: 2560, height: 800, format: Format::BGR888, fps: 30
I/utils.cc:93 There are 7 stream requests, select index:
1
I/imu_low_pass_filter.cc:48 Set ACCELEROMETER_LOW_PASS_FILTER to 2
I/imu_low_pass_filter.cc:50 Set GYROSCOPE_LOW_PASS_FILTER to 64
I/imu_low_pass_filter.cc:96 Time beg: 2018-12-29 13:53:42.296299, end: 2018-12-29 14:06:33.295960, cost: 771000ms
I/imu_low_pass_filter.cc:99 Img count: 15412, fps: 19.9896
I/imu_low_pass_filter.cc:101 Imu count: 309891, hz: 401.934
After the sample program finishes running with ``ESC/Q``, the low-pass filter of imu setting is complete. The ranges will be kept inside the hardware and not affected by power off.
Complete code samplesplease see `imu_low_pass_filter.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/imu_low_pass_filter.cc>`_

View File

@ -0,0 +1,108 @@
.. _imu_range:
Set the range of accelerometer & gyroscope
==========================================
Using the ``SetOptionValue()`` function in the API, you can set various control values for the current device.
To set the range of accelerometer and gyroscope, set ``Option::ACCELEROMETER_RANGE`` and ``Option::GYROSCOPE_RANGE``.
.. Attention::
For mynteye s1030, the available settings are:
* The effective range of accelerometer(unit:g): 4, 8, 16, 32.
* Gyroscope Range Valid value (unit: DEG/S): 500, 1000, 2000, 4000.
For mynteye s2100/s210a, the available settings are:
* The effective range of accelerometer(unit:g): 6, 12, 24, 32.
* The effective range of gyroscope(unit:deg/s): 250, 500, 1000, 2000, 4000.
Reference Code:
s1030
.. code-block:: c++
auto &&api = API::Create(argc, argv);
if (!api)
return 1;
// ACCELEROMETER_RANGE values: 4, 8, 16, 32
api->SetOptionValue(Option::ACCELEROMETER_RANGE, 8);
// GYROSCOPE_RANGE values: 500, 1000, 2000, 4000
api->SetOptionValue(Option::GYROSCOPE_RANGE, 1000);
LOG(INFO) << "Set ACCELEROMETER_RANGE to "
<< api->GetOptionValue(Option::ACCELEROMETER_RANGE);
LOG(INFO) << "Set GYROSCOPE_RANGE to "
<< api->GetOptionValue(Option::GYROSCOPE_RANGE);
s2100/s210a
.. code-block:: c++
auto &&api = API::Create(argc, argv);
if (!api) return 1;
bool ok;
auto &&request = api->SelectStreamRequest(&ok);
if (!ok) return 1;
api->ConfigStreamRequest(request);
// ACCELEROMETER_RANGE values: 6, 12, 24, 32
api->SetOptionValue(Option::ACCELEROMETER_RANGE, 6);
// GYROSCOPE_RANGE values: 250, 500, 1000, 2000, 4000
api->SetOptionValue(Option::GYROSCOPE_RANGE, 1000);
LOG(INFO) << "Set ACCELEROMETER_RANGE to "
<< api->GetOptionValue(Option::ACCELEROMETER_RANGE);
LOG(INFO) << "Set GYROSCOPE_RANGE to "
<< api->GetOptionValue(Option::GYROSCOPE_RANGE);
Reference running results on Linux:
s1030
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_imu_range
I/utils.cc:28 Detecting MYNT EYE devices
I/utils.cc:38 MYNT EYE devices:
I/utils.cc:41 index: 0, name: MYNT-EYE-S1030, sn: 4B4C1F1100090712
I/utils.cc:49 Only one MYNT EYE device, select index: 0
I/imu_range.cc:34 Set ACCELEROMETER_RANGE to 8
I/imu_range.cc:36 Set GYROSCOPE_RANGE to 1000
I/imu_range.cc:81 Time beg: 2018-11-21 15:34:57.726428, end: 2018-11-21 15:35:12.190478, cost: 14464ms
I/imu_range.cc:84 Img count: 363, fps: 25.0967
I/imu_range.cc:86 Imu count: 2825, hz: 195.312
s2100/s210a
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_imu_range
I/utils.cc:30 Detecting MYNT EYE devices
I/utils.cc:40 MYNT EYE devices:
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
I/utils.cc:51 Only one MYNT EYE device, select index: 0
I/utils.cc:79 MYNT EYE devices:
I/utils.cc:82 index: 0, request: width: 1280, height: 400, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 1, request: width: 1280, height: 400, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 2, request: width: 1280, height: 400, format: Format::BGR888, fps: 30
I/utils.cc:82 index: 3, request: width: 1280, height: 400, format: Format::BGR888, fps: 60
I/utils.cc:82 index: 4, request: width: 2560, height: 800, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 5, request: width: 2560, height: 800, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 6, request: width: 2560, height: 800, format: Format::BGR888, fps: 30
I/utils.cc:93 There are 7 stream requests, select index:
3
I/imu_range.cc:51 Set ACCELEROMETER_RANGE to 6
I/imu_range.cc:53 Set GYROSCOPE_RANGE to 1000
I/imu_range.cc:98 Time beg: 2018-12-29 10:03:10.706211, end: 2018-12-29 10:04:12.497427, cost: 61791.2ms
I/imu_range.cc:101 Img count: 3706, fps: 59.9762
I/imu_range.cc:103 Imu count: 24873, hz: 402.533
After the sample program finishes running with ``ESC/Q``, the ranges of imu setting is complete. The ranges will be kept inside the hardware and not affected by power off.
Complete code samplesplease see `imu_range.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/imu_range.cc>`_.

View File

@ -0,0 +1,54 @@
.. _infrared:
Enable IR and its adjustments function
=======================================
Using the ``SetOptionValue()`` function of the API, you can set various control values for the current open device.
Enabling IR is setting ``Option::IR_CONTROL`` greater than 0. The greater the value, the greater the IR's intensity.
.. Attention::
* mynteye s2100/s210a doesn't support this feature.
Reference Code:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
// Detect infrared add-ons
LOG(INFO) << "Support infrared: " << std::boolalpha
<< api->Supports(AddOns::INFRARED);
LOG(INFO) << "Support infrared2: " << std::boolalpha
<< api->Supports(AddOns::INFRARED2);
// Get infrared intensity range
auto &&info = api->GetOptionInfo(Option::IR_CONTROL);
LOG(INFO) << Option::IR_CONTROL << ": {" << info << "}";
// Set infrared intensity value
api->SetOptionValue(Option::IR_CONTROL, 80);
Reference running results on Linux:
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_infrared
I0504 16:16:28.016624 25848 utils.cc:13] Detecting MYNT EYE devices
I0504 16:16:28.512462 25848 utils.cc:20] MYNT EYE devices:
I0504 16:16:28.512473 25848 utils.cc:24] index: 0, name: MYNT-EYE-S1000
I0504 16:16:28.512477 25848 utils.cc:30] Only one MYNT EYE device, select index: 0
I0504 16:16:28.520848 25848 infrared.cc:13] Support infrared: true
I0504 16:16:28.520869 25848 infrared.cc:15] Support infrared2: true
I0504 16:16:28.520889 25848 infrared.cc:20] Option::IR_CONTROL: {min: 0, max: 160, def: 0}
At this point, if the image is displayed, you can see IR speckle on the image, as below:
.. image:: ../../images/ir.png
.. attention::
The hardware will not record the IR value after being turned off. In order to keep IR enabled, you must set the IR value after turning on the device.
Complete code samplessee `infrared.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/infrared.cc>`_ .

View File

@ -0,0 +1,110 @@
.. _manual_exposure:
Enable manual exposure and its adjustment function
===================================================
Using the ``SetOptionValue()`` function of the API, you can set various control values for the current open device.
To enabling manual exposure, set ``Option::EXPOSURE_MODE`` to ``1``.
For mynteye s1030, during manual exposure, the settings available for adjustment are:
* ``Option::GAIN`` Gain.
* ``Option::BRIGHTNESS`` Brightness (Exposure time).
* ``Option::CONTRAST`` Contrast (Black level calibration).
For mynteye s2100/s210a, during manual exposure, the settings available for adjustment are:
* ``Option::BRIGHTNESS`` Brightness (Exposure time).
Reference Code:
s1030
.. code-block:: c++
auto &&api = API::Create(argc, argv);
// manual-exposure: 1
api->SetOptionValue(Option::EXPOSURE_MODE, 1);
// gain: range [0,48], default 24
api->SetOptionValue(Option::GAIN, 24);
// brightness/exposure_time: range [0,240], default 120
api->SetOptionValue(Option::BRIGHTNESS, 120);
// contrast/black_level_calibration: range [0,255], default 127
api->SetOptionValue(Option::CONTRAST, 127);
LOG(INFO) << "Enable manual-exposure";
LOG(INFO) << "Set GAIN to " << api->GetOptionValue(Option::GAIN);
LOG(INFO) << "Set BRIGHTNESS to " << api->GetOptionValue(Option::BRIGHTNESS);
LOG(INFO) << "Set CONTRAST to " << api->GetOptionValue(Option::CONTRAST);
s2100/s210a
.. code-block:: c++
auto &&api = API::Create(argc, argv);
bool ok;
auto &&request = api->SelectStreamRequest(&ok);
if (!ok) return 1;
api->ConfigStreamRequest(request);
// manual-exposure: 1
api->SetOptionValue(Option::EXPOSURE_MODE, 1);
// brightness/exposure_time: range [0,240], default 120
api->SetOptionValue(Option::BRIGHTNESS, 120);
LOG(INFO) << "Enable manual-exposure";
LOG(INFO) << "Set EXPOSURE_MODE to "
<< api->GetOptionValue(Option::EXPOSURE_MODE);
LOG(INFO) << "Set BRIGHTNESS to "
<< api->GetOptionValue(Option::BRIGHTNESS);
Reference running results on Linux:
s1030
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_manual_exposure
I0513 14:09:17.104431 31908 utils.cc:26] Detecting MYNT EYE devices
I0513 14:09:17.501519 31908 utils.cc:33] MYNT EYE devices:
I0513 14:09:17.501551 31908 utils.cc:37] index: 0, name: MYNT-EYE-S1000
I0513 14:09:17.501562 31908 utils.cc:43] Only one MYNT EYE device, select index: 0
I0513 14:09:17.552918 31908 manual_exposure.cc:37] Enable manual-exposure
I0513 14:09:17.552953 31908 manual_exposure.cc:38] Set GAIN to 24
I0513 14:09:17.552958 31908 manual_exposure.cc:39] Set BRIGHTNESS to 120
I0513 14:09:17.552963 31908 manual_exposure.cc:40] Set CONTRAST to 127
s2100/s210a
.. code-block:: bash
$ ./samples/_output/bin/tutorials/ctrl_manual_exposure
I/utils.cc:30 Detecting MYNT EYE devices
I/utils.cc:40 MYNT EYE devices:
I/utils.cc:43 index: 0, name: MYNT-EYE-S210A, sn: 07C41A190009071F
I/utils.cc:51 Only one MYNT EYE device, select index: 0
I/utils.cc:79 MYNT EYE devices:
I/utils.cc:82 index: 0, request: width: 1280, height: 400, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 1, request: width: 1280, height: 400, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 2, request: width: 1280, height: 400, format: Format::BGR888, fps: 30
I/utils.cc:82 index: 3, request: width: 1280, height: 400, format: Format::BGR888, fps: 60
I/utils.cc:82 index: 4, request: width: 2560, height: 800, format: Format::BGR888, fps: 10
I/utils.cc:82 index: 5, request: width: 2560, height: 800, format: Format::BGR888, fps: 20
I/utils.cc:82 index: 6, request: width: 2560, height: 800, format: Format::BGR888, fps: 30
I/utils.cc:93 There are 7 stream requests, select index:
3
I/manual_exposure.cc:62 Enable manual-exposure
I/manual_exposure.cc:63 Set EXPOSURE_MODE to 1
I/manual_exposure.cc:65 Set BRIGHTNESS to 120
The sample program displays an image with a real exposure time in the upper left corner, in milliseconds.
Complete code samplessee `manual_exposure.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/control/manual_exposure.cc>`_ .

View File

@ -0,0 +1,22 @@
.. _data:
MYNT® EYE Data
==============
.. toctree::
get_device_info
get_img_params
get_imu_params
get_stereo
get_stereo_rectified
get_disparity
get_depth
get_points
get_imu
get_imu_correspondence
get_from_callbacks
get_with_plugin
save_params
write_img_params
write_imu_params

View File

@ -0,0 +1,54 @@
.. _get_depth:
Get depth image
===============
Depth images belongs to the upper layer of synthetic data. You need to start the ``EnableStreamData()`` beforehand, to get it through ``GetStreamData()``. The depth image type is CV_16UC1. In addition, it should be check not be empty before use.
For detailed process description, please see :ref:`get_stereo` :ref:`get_stereo_rectified`.
In addition, it is recommended to use plugins to calculate depth: Depth images work better and operate faster. Please refer to :ref:`get_with_plugin`.
Reference code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
api->EnableStreamData(Stream::DEPTH);
api->Start(Source::VIDEO_STREAMING);
cv::namedWindow("frame");
cv::namedWindow("depth");
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
cv::imshow("frame", img);
auto &&depth_data = api->GetStreamData(Stream::DEPTH);
if (!depth_data.frame.empty()) {
cv::imshow("depth", depth_data.frame); // CV_16UC1
}
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
api->Stop(Source::VIDEO_STREAMING);
The above code uses OpenCV to display the image. When the display window is selected, pressing ``ESC/Q`` will end the program.
Complete code examples, see `get_depth.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_depth.cc>`_ .
.. tip::
Preview the value of a region of the depth image, see `get_depth_with_region.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/api/get_depth_with_region.cc>`_ .

View File

@ -0,0 +1,41 @@
.. _get_device_info:
Get device information
======================
Use ``GetInfo()`` function to get various current information values.
Reference code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
LOG(INFO) << "Device name: " << api->GetInfo(Info::DEVICE_NAME);
LOG(INFO) << "Serial number: " << api->GetInfo(Info::SERIAL_NUMBER);
LOG(INFO) << "Firmware version: " << api->GetInfo(Info::FIRMWARE_VERSION);
LOG(INFO) << "Hardware version: " << api->GetInfo(Info::HARDWARE_VERSION);
LOG(INFO) << "Spec version: " << api->GetInfo(Info::SPEC_VERSION);
LOG(INFO) << "Lens type: " << api->GetInfo(Info::LENS_TYPE);
LOG(INFO) << "IMU type: " << api->GetInfo(Info::IMU_TYPE);
LOG(INFO) << "Nominal baseline: " << api->GetInfo(Info::NOMINAL_BASELINE);
Reference result on Linux:
.. code-block:: bash
$ ./samples/_output/bin/tutorials/get_device_info
I0503 16:40:21.109391 32106 utils.cc:13] Detecting MYNT EYE devices
I0503 16:40:21.604116 32106 utils.cc:20] MYNT EYE devices:
I0503 16:40:21.604127 32106 utils.cc:24] index: 0, name: MYNT-EYE-S1000
I0503 16:40:21.604142 32106 utils.cc:30] Only one MYNT EYE device, select index: 0
I0503 16:40:21.615054 32106 get_device_info.cc:10] Device name: MYNT-EYE-S1000
I0503 16:40:21.615113 32106 get_device_info.cc:11] Serial number: 0610243700090720
I0503 16:40:21.615129 32106 get_device_info.cc:12] Firmware version: 2.0
I0503 16:40:21.615139 32106 get_device_info.cc:13] Hardware version: 2.0
I0503 16:40:21.615146 32106 get_device_info.cc:14] Spec version: 1.0
I0503 16:40:21.615155 32106 get_device_info.cc:15] Lens type: 0000
I0503 16:40:21.615164 32106 get_device_info.cc:16] IMU type: 0000
I0503 16:40:21.615171 32106 get_device_info.cc:17] Nominal baseline: 120
Complete code examples, see `get_device_info.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_device_info.cc>`_ .

View File

@ -0,0 +1,62 @@
.. _get_disparity:
Get disparity image
===================
Disparity image belongs to the upper layer of synthetic data. You need to start the ``EnableStreamData()`` beforehand, to get it through ``GetStreamData()``. In addition, it should be check not be empty before use.
For detailed process description, please see :ref:`get_stereo` :ref:`get_stereo_rectified` .
It is recommended to use plugin to calculate depth: the depth map will be better with a higher frame rate. Please see :ref:`get_with_plugin` .
.. tip::
The SetDisparityComputingMethodType method is used to change disparity computing method. Currently, BM and SGBM are available.
Reference code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
// api->EnableStreamData(Stream::DISPARITY);
api->EnableStreamData(Stream::DISPARITY_NORMALIZED);
api->SetDisparityComputingMethodType(DisparityComputingMethod::BM);
api->Start(Source::VIDEO_STREAMING);
cv::namedWindow("frame");
// cv::namedWindow("disparity");
cv::namedWindow("disparity_normalized");
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
cv::imshow("frame", img);
// auto &&disp_data = api->GetStreamData(Stream::DISPARITY);
// if (!disp_data.frame.empty()) {
// cv::imshow("disparity", disp_data.frame);
// }
auto &&disp_norm_data = api->GetStreamData(Stream::DISPARITY_NORMALIZED);
if (!disp_norm_data.frame.empty()) {
cv::imshow("disparity_normalized", disp_norm_data.frame); // CV_8UC1
}
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
api->Stop(Source::VIDEO_STREAMING);
The above code uses OpenCV to display the image. Select the display window, press ``ESC/Q`` to exit in the program.
Complete code examples, see `get_disparity.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_disparity.cc>`_ .

View File

@ -0,0 +1,119 @@
.. _get_from_callbacks:
Get data from callbacks
========================
API offers function ``SetStreamCallback()`` and ``SetMotionCallback()`` to set callbacks for various data.
.. attention::
Make sure to not block callback. If the data processing time is too long, use the callback as a data producer.
Reference code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
// Attention: must not block the callbacks.
// Get left image from callback
std::atomic_uint left_count(0);
api->SetStreamCallback(
Stream::LEFT, [&left_count](const api::StreamData &data) {
CHECK_NOTNULL(data.img);
++left_count;
});
// Get depth image from callback
api->EnableStreamData(Stream::DEPTH);
std::atomic_uint depth_count(0);
cv::Mat depth;
std::mutex depth_mtx;
api->SetStreamCallback(
Stream::DEPTH,
[&depth_count, &depth, &depth_mtx](const api::StreamData &data) {
UNUSED(data)
++depth_count;
{
std::lock_guard<std::mutex> _(depth_mtx);
depth = data.frame;
}
});
// Get motion data from callback
std::atomic_uint imu_count(0);
std::shared_ptr<mynteye::ImuData> imu;
std::mutex imu_mtx;
api->SetMotionCallback(
[&imu_count, &imu, &imu_mtx](const api::MotionData &data) {
CHECK_NOTNULL(data.imu);
++imu_count;
{
std::lock_guard<std::mutex> _(imu_mtx);
imu = data.imu;
}
});
api->Start(Source::ALL);
CVPainter painter;
cv::namedWindow("frame");
cv::namedWindow("depth");
unsigned int depth_num = 0;
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
// Concat left and right as img
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
// Draw img data and size
painter.DrawImgData(img, *left_data.img);
// Draw imu data
if (imu) {
std::lock_guard<std::mutex> _(imu_mtx);
painter.DrawImuData(img, *imu);
}
// Draw counts
std::ostringstream ss;
ss << "left: " << left_count << ", depth: " << depth_count
<< ", imu: " << imu_count;
painter.DrawText(img, ss.str(), CVPainter::BOTTOM_RIGHT);
// Show img
cv::imshow("frame", img);
// Show depth
if (!depth.empty()) {
// Is the depth a new one?
if (depth_num != depth_count || depth_num == 0) {
std::lock_guard<std::mutex> _(depth_mtx);
depth_num = depth_count;
// LOG(INFO) << "depth_num: " << depth_num;
ss.str("");
ss.clear();
ss << "depth: " << depth_count;
painter.DrawText(depth, ss.str());
cv::imshow("depth", depth); // CV_16UC1
}
}
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
api->Stop(Source::ALL);
OpenCV is used to display images and data above. When the window is selected, pressing ``ESC/Q`` will exit program.
Complete code examples, see `get_from_callbacks.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_from_callbacks.cc>`_ .

View File

@ -0,0 +1,39 @@
.. _get_img_params:
Get image calibration parameters
================================
Use ``GetIntrinsics()`` & ``GetExtrinsics()`` to get image calibration parameters.
.. tip::
The detailed meaning of parameters can reference the files in ``tools/writer/config`` , of these
the image calibration parameters of S2100/S210A are in ``tools/writer/config/S210A``
the image calibration parameters of S1030 are in ``tools/writer/config/S1030``
Reference code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
LOG(INFO) << "Intrinsics left: {" << *api->GetIntrinsicsBase(Stream::LEFT)
<< "}";
LOG(INFO) << "Intrinsics right: {" << *api->GetIntrinsicsBase(Stream::RIGHT)
<< "}";
LOG(INFO) << "Extrinsics right to left: {"
<< api->GetExtrinsics(Stream::RIGHT, Stream::LEFT) << "}";
Reference result on Linux:
.. code-block:: bash
$ ./samples/_output/bin/tutorials/get_img_params
I0510 15:00:22.643263 6980 utils.cc:26] Detecting MYNT EYE devices
I0510 15:00:23.138811 6980 utils.cc:33] MYNT EYE devices:
I0510 15:00:23.138849 6980 utils.cc:37] index: 0, name: MYNT-EYE-S1000
I0510 15:00:23.138855 6980 utils.cc:43] Only one MYNT EYE device, select index: 0
I0510 15:00:23.210491 6980 get_img_params.cc:23] Intrinsics left: {width: 752, height: 480, fx: 736.38305001095545776, fy: 723.50066150722432212, cx: 356.91961817119693023, cy: 217.27271340923883258, model: 0, coeffs: [-0.54898645145016478, 0.52837141203888638, 0.00000000000000000, 0.00000000000000000, 0.00000000000000000]}
I0510 15:00:23.210551 6980 get_img_params.cc:24] Intrinsics right: {width: 752, height: 480, fx: 736.38305001095545776, fy: 723.50066150722432212, cx: 456.68367112303980093, cy: 250.70083335536796199, model: 0, coeffs: [-0.51012886039889305, 0.38764476500996770, 0.00000000000000000, 0.00000000000000000, 0.00000000000000000]}
I0510 15:00:23.210577 6980 get_img_params.cc:26] Extrinsics left to right: {rotation: [0.99701893306553813, -0.00095378124886237, -0.07715139279485062, 0.00144939967628305, 0.99997867219985104, 0.00636823256494144, 0.07714367342455503, -0.00646107164115277, 0.99699905125522237], translation: [-118.88991734400046596, -0.04560580387053091, -3.95313736911933855]}
Complete code examples, see `get_img_params.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_img_params.cc>`_ .

66
docs/src/data/get_imu.rst Normal file
View File

@ -0,0 +1,66 @@
.. _get_imu_data:
Get IMU data
=============
The API offers ``Start()`` / ``Stop()`` function to start/stop capturing data. You can set the argument to``Source::MOTION_TRACKING`` to capture IMU data only, or set it to ``Source::ALL`` to capture both image and IMU data.
During capturing data, you need ``EnableMotionDatas()`` to enable caching in order to get IMU data from ``GetMotionDatas()`` . Otherwise, IMU data is only available through the callback interface, see :ref:`get_from_callbacks` .
Sample code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
// Enable this will cache the motion datas until you get them.
api->EnableMotionDatas();
api->Start(Source::ALL);
CVPainter painter;
cv::namedWindow("frame");
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
auto &&motion_datas = api->GetMotionDatas();
/*
for (auto &&data : motion_datas) {
LOG(INFO) << "Imu frame_id: " << data.imu->frame_id
<< ", timestamp: " << data.imu->timestamp
<< ", accel_x: " << data.imu->accel[0]
<< ", accel_y: " << data.imu->accel[1]
<< ", accel_z: " << data.imu->accel[2]
<< ", gyro_x: " << data.imu->gyro[0]
<< ", gyro_y: " << data.imu->gyro[1]
<< ", gyro_z: " << data.imu->gyro[2]
<< ", temperature: " << data.imu->temperature;
}
*/
painter.DrawImgData(img, *left_data.img);
if (!motion_datas.empty()) {
painter.DrawImuData(img, *motion_datas[0].imu);
}
cv::imshow("frame", img);
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
api->Stop(Source::ALL);
OpenCV is used to display image and data. When window is selected, press ``ESC/Q`` to exit program.
Complete code examples, see `get_imu.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_imu.cc>`_ .

View File

@ -0,0 +1,109 @@
.. _get_imu_correspondence:
Get IMU data with timestamp correspondence
===========================================
If wanna get image with timestamp in the middle of IMU datas, you could call `EnableTimestampCorrespondence()`` to enable this feature.
Reference code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
// Enable motion datas with timestamp correspondence of some stream
api->EnableTimestampCorrespondence(Stream::LEFT);
api->Start(Source::ALL);
cv::namedWindow("frame");
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
auto img_stamp = left_data.img->timestamp;
LOG(INFO) << "Img timestamp: " << img_stamp
<< ", diff_prev=" << (img_stamp - prev_img_stamp);
prev_img_stamp = img_stamp;
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
auto &&motion_datas = api->GetMotionDatas();
LOG(INFO) << "Imu count: " << motion_datas.size();
for (auto &&data : motion_datas) {
auto imu_stamp = data.imu->timestamp;
LOG(INFO) << "Imu timestamp: " << imu_stamp
<< ", diff_prev=" << (imu_stamp - prev_imu_stamp)
<< ", diff_img=" << (1.f + imu_stamp - img_stamp);
prev_imu_stamp = imu_stamp;
}
LOG(INFO);
cv::imshow("frame", img);
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
api->Stop(Source::ALL);
Reference result on Linux:
.. code-block:: bash
$ ./samples/_output/bin/tutorials/get_imu_correspondence
I/utils.cc:30 Detecting MYNT EYE devices
I/utils.cc:40 MYNT EYE devices:
I/utils.cc:43 index: 0, name: MYNT-EYE-S1030, sn: 0281351000090807
I/utils.cc:51 Only one MYNT EYE device, select index: 0
I/synthetic.cc:126 camera calib model: kannala_brandt
I/utils.cc:79 MYNT EYE devices:
I/utils.cc:82 index: 0, request: width: 752, height: 480, format: Format::YUYV, fps: 60
I/utils.cc:87 Only one stream request, select index: 0
I/get_imu_correspondence.cc:50 Img timestamp: 171323050, diff_prev=39990
I/get_imu_correspondence.cc:58 Imu count: 13
I/get_imu_correspondence.cc:61 Imu timestamp: 171318710, diff_prev=171318710, diff_img=-4352
I/get_imu_correspondence.cc:61 Imu timestamp: 171320730, diff_prev=2020, diff_img=-2320
I/get_imu_correspondence.cc:61 Imu timestamp: 171322750, diff_prev=2020, diff_img=-304
I/get_imu_correspondence.cc:61 Imu timestamp: 171324770, diff_prev=2020, diff_img=1712
I/get_imu_correspondence.cc:61 Imu timestamp: 171326790, diff_prev=2020, diff_img=3728
I/get_imu_correspondence.cc:61 Imu timestamp: 171328800, diff_prev=2010, diff_img=5744
I/get_imu_correspondence.cc:61 Imu timestamp: 171330810, diff_prev=2010, diff_img=7760
I/get_imu_correspondence.cc:61 Imu timestamp: 171332840, diff_prev=2030, diff_img=9776
I/get_imu_correspondence.cc:61 Imu timestamp: 171334860, diff_prev=2020, diff_img=11808
I/get_imu_correspondence.cc:61 Imu timestamp: 171336880, diff_prev=2020, diff_img=13824
I/get_imu_correspondence.cc:61 Imu timestamp: 171338900, diff_prev=2020, diff_img=15840
I/get_imu_correspondence.cc:61 Imu timestamp: 171340920, diff_prev=2020, diff_img=17872
I/get_imu_correspondence.cc:61 Imu timestamp: 171342930, diff_prev=2010, diff_img=19872
I/get_imu_correspondence.cc:66
I/get_imu_correspondence.cc:50 Img timestamp: 171403040, diff_prev=79990
I/get_imu_correspondence.cc:58 Imu count: 20
I/get_imu_correspondence.cc:61 Imu timestamp: 171383310, diff_prev=40380, diff_img=-19728
I/get_imu_correspondence.cc:61 Imu timestamp: 171385330, diff_prev=2020, diff_img=-17712
I/get_imu_correspondence.cc:61 Imu timestamp: 171387350, diff_prev=2020, diff_img=-15696
I/get_imu_correspondence.cc:61 Imu timestamp: 171389370, diff_prev=2020, diff_img=-13664
I/get_imu_correspondence.cc:61 Imu timestamp: 171391380, diff_prev=2010, diff_img=-11664
I/get_imu_correspondence.cc:61 Imu timestamp: 171393390, diff_prev=2010, diff_img=-9648
I/get_imu_correspondence.cc:61 Imu timestamp: 171395420, diff_prev=2030, diff_img=-7616
I/get_imu_correspondence.cc:61 Imu timestamp: 171397440, diff_prev=2020, diff_img=-5600
I/get_imu_correspondence.cc:61 Imu timestamp: 171399460, diff_prev=2020, diff_img=-3584
I/get_imu_correspondence.cc:61 Imu timestamp: 171401480, diff_prev=2020, diff_img=-1568
I/get_imu_correspondence.cc:61 Imu timestamp: 171403500, diff_prev=2020, diff_img=464
I/get_imu_correspondence.cc:61 Imu timestamp: 171405510, diff_prev=2010, diff_img=2464
I/get_imu_correspondence.cc:61 Imu timestamp: 171407520, diff_prev=2010, diff_img=4480
I/get_imu_correspondence.cc:61 Imu timestamp: 171409540, diff_prev=2020, diff_img=6496
I/get_imu_correspondence.cc:61 Imu timestamp: 171411570, diff_prev=2030, diff_img=8528
I/get_imu_correspondence.cc:61 Imu timestamp: 171413590, diff_prev=2020, diff_img=10544
I/get_imu_correspondence.cc:61 Imu timestamp: 171415610, diff_prev=2020, diff_img=12576
I/get_imu_correspondence.cc:61 Imu timestamp: 171417630, diff_prev=2020, diff_img=14592
I/get_imu_correspondence.cc:61 Imu timestamp: 171419650, diff_prev=2020, diff_img=16608
I/get_imu_correspondence.cc:61 Imu timestamp: 171421660, diff_prev=2010, diff_img=18624
Complete code examples, see `get_imu_correspondence.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_imu_correspondence.cc>`_ .

View File

@ -0,0 +1,18 @@
.. _get_imu_params:
Get IMU calibration parameters
==============================
Use ``GetMotionIntrinsics()`` & ``GetMotionExtrinsics()`` to get current IMU calibration parameters.
Reference commands:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
LOG(INFO) << "Motion intrinsics: {" << api->GetMotionIntrinsics() << "}";
LOG(INFO) << "Motion extrinsics left to imu: {"
<< api->GetMotionExtrinsics(Stream::LEFT) << "}";
Complete code examples, see `get_imu_params.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_imu_params.cc>`_ .

View File

@ -0,0 +1,57 @@
.. _get_points:
Get point image
================
Point images belongs to upper layer of synthetic data. To get this kind of data through ``GetStreamData()``, you need to start the ``EnableStreamData()`` beforehand. It should be check not empty before use.
For detail process description, please see :ref:`get_stereo` :ref:`get_stereo_rectified` .
It is recommended to use plugin to calculate depth: the depth map will be better with a higher frame rate. Please see :ref:`get_with_plugin` for detail.
Sample code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
api->EnableStreamData(Stream::POINTS);
api->Start(Source::VIDEO_STREAMING);
cv::namedWindow("frame");
PCViewer pcviewer;
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
cv::imshow("frame", img);
auto &&points_data = api->GetStreamData(Stream::POINTS);
if (!points_data.frame.empty()) {
pcviewer.Update(points_data.frame);
}
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
if (pcviewer.WasStopped()) {
break;
}
}
api->Stop(Source::VIDEO_STREAMING);
`PCL <https://github.com/PointCloudLibrary/pcl>`_ is used to display point images above. Program will close when point image window is closed.
Complete code examples, see `get_points.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_points.cc>`_ .
.. attention::
Sample code only compiles when `PCL <https://github.com/PointCloudLibrary/pcl>`_ is ready. If your PCL was installed in a different directory, please set ``CMAKE_PREFIX_PATH`` in `tutorials/CMakeLists.txt <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/CMakeLists.txt>`_ to the path of ``PCLConfig.cmake`` . You can find ``CMAKE_PREFIX_PATH`` near ``find_package(PCL)`` .

View File

@ -0,0 +1,40 @@
.. _get_stereo:
Get original binocular image
=============================
Use ``Start()`` or ``Stop()`` , to start or stop data capturing. If you only need the image data, use ``Source::VIDEO_STREAMING`` .
When data capturing starts, call ``WaitForStreams()`` function. Once data capturing begins, use ``GetStreamData()`` to get your data.
Reference commands:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
api->Start(Source::VIDEO_STREAMING);
cv::namedWindow("frame");
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
cv::imshow("frame", img);
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
api->Stop(Source::VIDEO_STREAMING);
The above code uses OpenCV to display the image. When the display window is selected, pressing ``ESC/Q`` will end the program.
Complete code examples, see `get_stereo.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_stereo.cc>`_ .

View File

@ -0,0 +1,51 @@
.. _get_stereo_rectified:
Get stereo camera correction image
==================================
The ``GetStreamData()`` API provided can only get the raw data of the hardware, for example, the stereo camera raw image.
The stereo camera correction image belongs to the upper layer of synthetic data. For such data, you need to enable ``EnableStreamData()`` before you can get ``GetStreamData()``.
In addition, ``WaitForStreams()`` waits for the key of the raw data. At the beginning when the synthetic data may still being processed, the value taken out will be null, so it needs to check not empty.
.. tip::
If you want the synthetic data once it is generated, see :ref:`get_from_callbacks`.
Reference code snippet:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
api->EnableStreamData(Stream::LEFT_RECTIFIED);
api->EnableStreamData(Stream::RIGHT_RECTIFIED);
api->Start(Source::VIDEO_STREAMING);
cv::namedWindow("frame");
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT_RECTIFIED);
auto &&right_data = api->GetStreamData(Stream::RIGHT_RECTIFIED);
if (!left_data.frame.empty() && !right_data.frame.empty()) {
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
cv::imshow("frame", img);
}
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
api->Stop(Source::VIDEO_STREAMING);
OpenCV is used to display the image above. Select the display window, press ``ESC/Q`` to exit the program.
Complete code examples, see `get_stereo_rectified.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_stereo_rectified.cc>`_ .

View File

@ -0,0 +1,96 @@
.. _get_with_plugin:
Using the plugin to get data
============================
API provides a ``EnablePlugin()`` function to enable plugins under a path.
Official provided plugins for calculating binocular parallax are now available in the `MYNTEYE_BOX <http://www.myntai.com/mynteye/s/download>`_ located in the ``Plugins`` directory.
.. code-block:: none
Plugins/
├─linux-x86_64/
│ ├─libplugin_b_ocl1.2_opencv3.4.0.so
│ ├─libplugin_g_cuda9.1_opencv2.4.13.5.so
│ ├─libplugin_g_cuda9.1_opencv3.3.1.so
│ └─libplugin_g_cuda9.1_opencv3.4.0.so
├─tegra-armv8/
└─win-x86_64/
* The ``linux-x86_64`` directory shows the system and architecture.
* You can find your CPU architecture from system information or ``uname -a``.
* The library name ``libplugin_*`` shows the plugin identity and the third party dependency.
* ``b`` ``g`` is a plugin identifier, indicating that different algorithms are used.
* ``ocl1.2`` shows it dependence on ``OpenCL 1.2``, if it exists.
* ``cuda9.1`` shows it dependence on ``CUDA 9.1``, if it exists.
* ``opencv3.4.0`` shows it dependence on ``OpenCV 3.4.0``, if it exists.
* ``mynteye2.0.0`` shows it dependency on ``MYNT EYE SDK 2.0.0``, if it exists.
First, select the plugins that you are going to use depending on your situation. If you relying on third parties, please install a corresponding version.
Then, enable the plugin with the following code:
.. code-block:: c++
auto &&api = API::Create(argc, argv);
api->EnablePlugin("plugins/linux-x86_64/libplugin_g_cuda9.1_opencv3.4.0.so");
The path can be an absolute path or a relative path (relative to the current working directory).
Finally, just call the API to get the data as before.
.. tip::
If the plugin is not enabled, ``api->Start(Source::VIDEO_STREAMING);`` will automatically find the appropriate plug-in in the ``<sdk>/plugins/<platform>`` directory to load.
In other words, you can move the plug-in directory of the current platform into the ``< SDK > / plugins`` directory. To automatically load the official plugin, install the corresponding ``CUDA`` ``OpenCV`` plugin dependency, recompiling and then run ``API`` layer interface program.
Before running, please execute the following commands to ensure that the plugin's dependency library can be searched:
.. code-block:: bash
# Linux
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# /usr/local/lib means the path of dependency library
# macOS
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
# /usr/local/lib means the path of dependency library
# Windows
set PATH=C:\opencv\x64\vc14\bin;%PATH%
# add to PATH of system environment
In addition, the following command can be executed to check whether the dependency Library of the plug-in can be searched:
.. code-block:: bash
# Linux
ldd *.so
# *.so means plugin path
# macOS
otool -L *.dylib
# *.dylib means plugin path
# Windows
# please download Dependency Walker open DLL .
If the plugin's dependent library is not found, it will report an error \"Open plugin failed\" when loading.
Complete code sample, see `get_with_plugin.cc <https://github.com/slightech/MYNT-EYE-S-SDK/blob/master/samples/tutorials/data/get_with_plugin.cc>`_ .
.. tip::
Linux can also add a dependency library path to the system environment, so that the compiled program can run directly. (does not require ``export LD_LIBRARY_PATH`` in the terminal then run again).
* Create a ``/etc/ld.so.conf.d/libmynteye.conf`` file and write the dependent library path.
* Execute the ``sudo /sbin/ldconfig`` command in the terminal and refresh the cache.
.. literalinclude:: ../../files/libmynteye.conf
:caption: e.g. libmynteye.conf

Some files were not shown because too many files have changed in this diff Show More