Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbf789b174 | ||
|
|
66c9af58fc | ||
|
|
375acb534c | ||
|
|
28204d5c0a | ||
|
|
c9483c2aca | ||
|
|
45b4fdeedf | ||
|
|
455b5b931e | ||
|
|
8ab9b42896 | ||
|
|
3258e969ee | ||
|
|
cc74b2663b | ||
|
|
e270e99340 | ||
|
|
0c92f770f2 | ||
|
|
5a9fffe3ed | ||
|
|
384ff028a8 | ||
|
|
0f9bdd5cf2 | ||
|
|
54165b1acb | ||
|
|
087ef28da1 | ||
|
|
b2bd1f389d | ||
|
|
6a82b06b84 | ||
|
|
518416ac4d | ||
|
|
c53dd50730 | ||
|
|
4892f52158 | ||
|
|
3dc21c0378 | ||
|
|
0153261447 | ||
|
|
25f72dd74f | ||
|
|
438ba6481d | ||
|
|
922bf624e7 | ||
|
|
9014f3df57 | ||
|
|
c2f04c487e | ||
|
|
725a8c2e57 | ||
|
|
d04078068a | ||
|
|
9567546894 | ||
|
|
27eb9e6cb2 | ||
|
|
c5b054c864 | ||
|
|
becccd9b8f | ||
|
|
1c1503aae2 | ||
|
|
d3a67b7d29 | ||
|
|
a119b36f72 | ||
|
|
24ca757c92 | ||
|
|
92b38291ee | ||
|
|
377f9b21f1 | ||
|
|
591bbdd3e6 | ||
|
|
68e413e5e2 | ||
|
|
3e42060ff1 | ||
|
|
40b7acd5c3 |
@@ -14,7 +14,7 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(mynteye VERSION 2.0.0 LANGUAGES C CXX)
|
||||
project(mynteye VERSION 2.0.1 LANGUAGES C CXX)
|
||||
|
||||
include(cmake/Common.cmake)
|
||||
|
||||
@@ -48,23 +48,6 @@ LIST(APPEND CMAKE_PREFIX_PATH third_party/glog/_build)
|
||||
find_package(glog REQUIRED)
|
||||
message(STATUS "Found glog: ${glog_VERSION}")
|
||||
|
||||
if(WITH_API)
|
||||
include(cmake/DetectOpenCV.cmake)
|
||||
endif()
|
||||
|
||||
find_package(Boost COMPONENTS filesystem)
|
||||
if(Boost_FOUND)
|
||||
set(WITH_BOOST_FILESYSTEM true)
|
||||
add_definitions(-DWITH_FILESYSTEM)
|
||||
add_definitions(-DWITH_BOOST_FILESYSTEM)
|
||||
message(STATUS "With boost filesystem: ${Boost_VERSION}")
|
||||
#message(STATUS " Boost_LIBRARIES: ${Boost_LIBRARIES}")
|
||||
elseif(OS_WIN)
|
||||
add_definitions(-DWITH_FILESYSTEM)
|
||||
add_definitions(-DWITH_NATIVE_FILESYSTEM)
|
||||
message(STATUS "With native filesystem")
|
||||
endif()
|
||||
|
||||
LIST(APPEND CMAKE_MODULE_PATH cmake)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
@@ -254,32 +237,7 @@ install(EXPORT ${MYNTEYE_NAME}-targets
|
||||
|
||||
## build.info
|
||||
|
||||
macro(set_default_value VARIABLE DEFAULT)
|
||||
if(NOT ${VARIABLE})
|
||||
set(${VARIABLE} ${DEFAULT})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(set_version_values VARIABLE)
|
||||
string(REPLACE "." ";" __version_list "${${VARIABLE}}")
|
||||
list(LENGTH __version_list __len)
|
||||
if(${__len} GREATER 0)
|
||||
list(GET __version_list 0 ${VARIABLE}_MAJOR)
|
||||
endif()
|
||||
if(${__len} GREATER 1)
|
||||
list(GET __version_list 1 ${VARIABLE}_MINOR)
|
||||
endif()
|
||||
if(${__len} GREATER 2)
|
||||
list(GET __version_list 2 ${VARIABLE}_PATCH)
|
||||
endif()
|
||||
if(${__len} GREATER 3)
|
||||
list(GET __version_list 3 ${VARIABLE}_TWEAK)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
find_package(CUDA QUIET)
|
||||
|
||||
set_version_values(CMAKE_CXX_COMPILER_VERSION)
|
||||
# set default int values for yaml file (build.info)
|
||||
set_default_value(CMAKE_CXX_COMPILER_VERSION_MAJOR 0)
|
||||
set_default_value(CMAKE_CXX_COMPILER_VERSION_MINOR 0)
|
||||
set_default_value(CMAKE_CXX_COMPILER_VERSION_PATCH 0)
|
||||
|
||||
21
Makefile
21
Makefile
@@ -16,6 +16,12 @@ include CommonDefs.mk
|
||||
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
MKFILE_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
|
||||
|
||||
# CMAKE_INSTALL_PREFIX:
|
||||
# https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
|
||||
#
|
||||
# UNIX: /usr/local
|
||||
# Windows: c:/Program Files/${PROJECT_NAME}
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
help:
|
||||
@@ -54,7 +60,10 @@ opendoc: apidoc
|
||||
[ -f "$$html" ] && $(SH) ./scripts/open.sh $$html; \
|
||||
done
|
||||
|
||||
.PHONY: apidoc opendoc
|
||||
cleandoc:
|
||||
@$(call rm,./doc/_output/)
|
||||
|
||||
.PHONY: apidoc opendoc cleandoc
|
||||
|
||||
# deps
|
||||
|
||||
@@ -80,7 +89,8 @@ init: submodules
|
||||
|
||||
build: third_party
|
||||
@$(call echo,Make $@)
|
||||
@$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install)
|
||||
@$(call cmake_build,./_build,..)
|
||||
@# @$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install)
|
||||
|
||||
.PHONY: build
|
||||
|
||||
@@ -112,10 +122,10 @@ ifeq ($(HOST_OS),Win)
|
||||
ifneq ($(HOST_NAME),MinGW)
|
||||
@cd ./_build; msbuild.exe INSTALL.vcxproj /property:Configuration=Release
|
||||
else
|
||||
@cd ./_build; make install
|
||||
@cd ./_build; sudo make install
|
||||
endif
|
||||
else
|
||||
@cd ./_build; make install
|
||||
@cd ./_build; sudo make install
|
||||
endif
|
||||
|
||||
.PHONY: install
|
||||
@@ -225,8 +235,7 @@ cleanlog:
|
||||
@$(call rm_f,*ERROR*)
|
||||
@$(call rm_f,*FATAL*)
|
||||
|
||||
cleanall: clean
|
||||
@$(call rm,./doc/_output/)
|
||||
cleanall: clean cleandoc
|
||||
@$(call rm,./test/gtest/_build/)
|
||||
@$(call rm,./third_party/glog/_build/)
|
||||
@$(FIND) . -type f -name ".DS_Store" -print0 | xargs -0 rm -f
|
||||
|
||||
13
README.md
13
README.md
@@ -1,5 +1,7 @@
|
||||
# MYNT® EYE SDK
|
||||
|
||||
[](https://github.com/slightech/MYNT-EYE-SDK-2)
|
||||
|
||||
## Overview
|
||||
|
||||
MYNT® EYE SDK 2.0 is a cross-platform library for MYNT® EYE cameras.
|
||||
@@ -15,16 +17,19 @@ Please follow the guide doc to install the SDK on different platforms.
|
||||
## Documentations
|
||||
|
||||
* [API Doc](https://github.com/slightech/MYNT-EYE-SDK-2/releases): API reference, some guides and data spec.
|
||||
* en: [](https://github.com/slightech/MYNT-EYE-SDK-2/files/2203869/mynt-eye-sdk-apidoc-2.0.1-rc0-en.pdf) [](https://github.com/slightech/MYNT-EYE-SDK-2/files/2203870/mynt-eye-sdk-apidoc-2.0.1-rc0-html-en.zip) [](https://slightech.github.io/MYNT-EYE-SDK-2/)
|
||||
* zh-Hans: [](https://github.com/slightech/MYNT-EYE-SDK-2/files/2203872/mynt-eye-sdk-apidoc-2.0.1-rc0-zh-Hans.pdf) [](https://github.com/slightech/MYNT-EYE-SDK-2/files/2203874/mynt-eye-sdk-apidoc-2.0.1-rc0-html-zh-Hans.zip) [](http://doc.myntai.com/resource/api/mynt-eye-sdk-apidoc-2.0.1-rc0-html-zh-Hans/mynt-eye-sdk-apidoc-2.0.1-rc0-html-zh-Hans/index.html)
|
||||
* [Guide Doc](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/releases): How to install and start using the SDK.
|
||||
* en: [](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/files/2203877/mynt-eye-sdk-guide-2.0.1-rc0-en.pdf) [](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/files/2203879/mynt-eye-sdk-guide-2.0.1-rc0-html-en.zip) [](https://slightech.github.io/MYNT-EYE-SDK-2-Guide/)
|
||||
* zh-Hans: [](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/files/2203880/mynt-eye-sdk-guide-2.0.1-rc0-zh-Hans.pdf) [](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/files/2203881/mynt-eye-sdk-guide-2.0.1-rc0-html-zh-Hans.zip) [](http://doc.myntai.com/resource/sdk/mynt-eye-sdk-guide-2.0.1-rc0-html-zh-Hans/mynt-eye-sdk-guide-2.0.1-rc0-html-zh-Hans/index.html )
|
||||
|
||||
> Supported languages: `zh-Hans`.
|
||||
> Supported languages: `en`, `zh-Hans`.
|
||||
|
||||
## Firmwares
|
||||
|
||||
[Google Drive]: https://drive.google.com/drive/folders/1tdFCcTBMNcImEGZ39tdOZmlX2SHKCr2f
|
||||
[百度网盘]: https://pan.baidu.com/s/1yPQDp2r0x4jvNwn2UjlMUQ
|
||||
[MYNTEYE_BOX]: http://doc.myntai.com/mynteye/s/download
|
||||
|
||||
Get firmwares from our online disks: [Google Drive][], [百度网盘][]. The latest version is `2.0.0-rc`.
|
||||
Get firmwares from our online disks: [MYNTEYE_BOX][]. The latest version is `2.0.1`.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -12,7 +12,125 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/IncludeGuard.cmake)
|
||||
cmake_include_guard()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/Utils.cmake)
|
||||
|
||||
|
||||
# build components
|
||||
|
||||
option(WITH_API "Build with API layer, need OpenCV" ON)
|
||||
|
||||
message(STATUS "Options:")
|
||||
message(STATUS " WITH_API: ${WITH_API}")
|
||||
option(WITH_DEVICE_INFO_REQUIRED "Build with device info required" ON)
|
||||
|
||||
# 3rdparty components
|
||||
|
||||
option(WITH_BOOST "Include Boost support" ON)
|
||||
|
||||
|
||||
# packages
|
||||
|
||||
if(WITH_API)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/DetectOpenCV.cmake)
|
||||
endif()
|
||||
|
||||
if(WITH_DEVICE_INFO_REQUIRED)
|
||||
add_definitions(-DWITH_DEVICE_INFO_REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_BOOST)
|
||||
find_package(Boost COMPONENTS filesystem)
|
||||
if(Boost_FOUND)
|
||||
set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
|
||||
set(WITH_FILESYSTEM TRUE)
|
||||
set(WITH_BOOST_FILESYSTEM TRUE)
|
||||
add_definitions(-DWITH_FILESYSTEM)
|
||||
add_definitions(-DWITH_BOOST_FILESYSTEM)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT WITH_FILESYSTEM)
|
||||
if(MSVC OR MSYS OR MINGW) # win
|
||||
set(WITH_FILESYSTEM TRUE)
|
||||
set(WITH_NATIVE_FILESYSTEM TRUE)
|
||||
add_definitions(-DWITH_FILESYSTEM)
|
||||
add_definitions(-DWITH_NATIVE_FILESYSTEM)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(CUDA QUIET)
|
||||
|
||||
# summary
|
||||
|
||||
set_version_values(CMAKE_CXX_COMPILER_VERSION)
|
||||
|
||||
status("")
|
||||
status("Platform:")
|
||||
status(" HOST_OS: ${HOST_OS}")
|
||||
status(" HOST_NAME: ${HOST_NAME}")
|
||||
status(" HOST_ARCH: ${HOST_ARCH}")
|
||||
status(" HOST_COMPILER: ${CMAKE_CXX_COMPILER_ID}")
|
||||
status(" COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
status(" COMPILER_VERSION_MAJOR: ${CMAKE_CXX_COMPILER_VERSION_MAJOR}")
|
||||
status(" COMPILER_VERSION_MINOR: ${CMAKE_CXX_COMPILER_VERSION_MINOR}")
|
||||
status(" COMPILER_VERSION_PATCH: ${CMAKE_CXX_COMPILER_VERSION_PATCH}")
|
||||
status(" COMPILER_VERSION_TWEAK: ${CMAKE_CXX_COMPILER_VERSION_TWEAK}")
|
||||
if(CUDA_FOUND)
|
||||
status(" CUDA_VERSION: ${CUDA_VERSION}")
|
||||
status(" CUDA_VERSION_MAJOR: ${CUDA_VERSION_MAJOR}")
|
||||
status(" CUDA_VERSION_MINOR: ${CUDA_VERSION_MINOR}")
|
||||
status(" CUDA_VERSION_STRING: ${CUDA_VERSION_STRING}")
|
||||
endif()
|
||||
if(OpenCV_FOUND)
|
||||
status(" OpenCV_VERSION: ${OpenCV_VERSION}")
|
||||
status(" OpenCV_VERSION_MAJOR: ${OpenCV_VERSION_MAJOR}")
|
||||
status(" OpenCV_VERSION_MINOR: ${OpenCV_VERSION_MINOR}")
|
||||
status(" OpenCV_VERSION_PATCH: ${OpenCV_VERSION_PATCH}")
|
||||
status(" OpenCV_VERSION_TWEAK: ${OpenCV_VERSION_TWEAK}")
|
||||
status(" OpenCV_VERSION_STATUS: ${OpenCV_VERSION_STATUS}")
|
||||
status(" OpenCV_WITH_WORLD: ${WITH_OPENCV_WORLD}")
|
||||
endif()
|
||||
if(mynteye_VERSION)
|
||||
status(" MYNTEYE_VERSION: ${mynteye_VERSION}")
|
||||
status(" MYNTEYE_VERSION_MAJOR: ${mynteye_VERSION_MAJOR}")
|
||||
status(" MYNTEYE_VERSION_MINOR: ${mynteye_VERSION_MINOR}")
|
||||
status(" MYNTEYE_VERSION_PATCH: ${mynteye_VERSION_PATCH}")
|
||||
status(" MYNTEYE_VERSION_TWEAK: ${mynteye_VERSION_TWEAK}")
|
||||
endif()
|
||||
|
||||
status("")
|
||||
status("Options:")
|
||||
status(" WITH_API: ${WITH_API}")
|
||||
if(WITH_API)
|
||||
if(OpenCV_FOUND)
|
||||
status(" OpenCV: YES")
|
||||
status(" OpenCV_VERSION: ${OpenCV_VERSION}")
|
||||
status(" OpenCV_WORLD: " IF WITH_OPENCV_WORLD "YES" ELSE "NO")
|
||||
else()
|
||||
status(" OpenCV: NO")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
status(" WITH_DEVICE_INFO_REQUIRED: ${WITH_DEVICE_INFO_REQUIRED}")
|
||||
|
||||
status(" WITH_BOOST: ${WITH_BOOST}")
|
||||
if(WITH_BOOST)
|
||||
if(Boost_FOUND)
|
||||
status(" Boost: YES")
|
||||
status(" Boost_VERSION: ${Boost_VERSION_STRING}")
|
||||
#status(" Boost_LIBRARIES: ${Boost_LIBRARIES}")
|
||||
else()
|
||||
status(" Boost: NO")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
status("")
|
||||
status("Features:")
|
||||
status(" Filesystem: "
|
||||
IF WITH_BOOST_FILESYSTEM "boost"
|
||||
ELIF WITH_NATIVE_FILESYSTEM "native"
|
||||
ELSE "none"
|
||||
)
|
||||
|
||||
status("")
|
||||
|
||||
@@ -49,3 +49,88 @@ macro(make_executable NAME)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# set_default_value(VARIABLE DEFAULT)
|
||||
macro(set_default_value VARIABLE DEFAULT)
|
||||
if(NOT ${VARIABLE})
|
||||
set(${VARIABLE} ${DEFAULT})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# set_version_values(VARIABLE)
|
||||
macro(set_version_values VARIABLE)
|
||||
string(REPLACE "." ";" __version_list "${${VARIABLE}}")
|
||||
list(LENGTH __version_list __len)
|
||||
if(${__len} GREATER 0)
|
||||
list(GET __version_list 0 ${VARIABLE}_MAJOR)
|
||||
endif()
|
||||
if(${__len} GREATER 1)
|
||||
list(GET __version_list 1 ${VARIABLE}_MINOR)
|
||||
endif()
|
||||
if(${__len} GREATER 2)
|
||||
list(GET __version_list 2 ${VARIABLE}_PATCH)
|
||||
endif()
|
||||
if(${__len} GREATER 3)
|
||||
list(GET __version_list 3 ${VARIABLE}_TWEAK)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# status(TEXT [IF cond text [ELIF cond text] [ELSE cond text]])
|
||||
macro(status TEXT)
|
||||
set(options)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs IF ELIF ELSE)
|
||||
cmake_parse_arguments(THIS "${options}" "${oneValueArgs}"
|
||||
"${multiValueArgs}" ${ARGN})
|
||||
|
||||
#message(STATUS "TEXT: ${TEXT}")
|
||||
#message(STATUS "THIS_IF: ${THIS_IF}")
|
||||
#message(STATUS "THIS_ELIF: ${THIS_ELIF}")
|
||||
#message(STATUS "THIS_ELSE: ${THIS_ELSE}")
|
||||
|
||||
set(__msg_list "${TEXT}")
|
||||
set(__continue TRUE)
|
||||
|
||||
if(__continue AND DEFINED THIS_IF)
|
||||
#message(STATUS "-- THIS_IF: ${THIS_IF}")
|
||||
list(LENGTH THIS_IF __if_len)
|
||||
if(${__if_len} GREATER 1)
|
||||
list(GET THIS_IF 0 __if_cond)
|
||||
if(${__if_cond})
|
||||
list(REMOVE_AT THIS_IF 0)
|
||||
list(APPEND __msg_list ${THIS_IF})
|
||||
set(__continue FALSE)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "status() IF must have cond and text, >= 2 items")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(__continue AND DEFINED THIS_ELIF)
|
||||
#message(STATUS "-- THIS_ELIF: ${THIS_ELIF}")
|
||||
list(LENGTH THIS_ELIF __elif_len)
|
||||
if(${__elif_len} GREATER 1)
|
||||
list(GET THIS_ELIF 0 __elif_cond)
|
||||
if(${__elif_cond})
|
||||
list(REMOVE_AT THIS_ELIF 0)
|
||||
list(APPEND __msg_list ${THIS_ELIF})
|
||||
set(__continue FALSE)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "status() ELIF must have cond and text, >= 2 items")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(__continue AND DEFINED THIS_ELSE)
|
||||
#message(STATUS "-- THIS_ELSE: ${THIS_ELSE}")
|
||||
list(LENGTH THIS_ELSE __else_len)
|
||||
if(${__else_len} GREATER 0)
|
||||
list(APPEND __msg_list ${THIS_ELSE})
|
||||
else()
|
||||
message(FATAL_ERROR "status() ELSE must have text, >= 1 items")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" "" __msg_list "${__msg_list}")
|
||||
message(STATUS "${__msg_list}")
|
||||
endmacro()
|
||||
|
||||
11
doc/build.sh
11
doc/build.sh
@@ -40,8 +40,8 @@ OUTPUT="$BASE_DIR/_output"
|
||||
_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
|
||||
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
|
||||
@@ -54,8 +54,13 @@ for lang in "${LANGS[@]}"; do
|
||||
doxygen $DOXYFILE
|
||||
if [ $pdflatex_FOUND ] && [ -f "$OUTPUT/$lang/latex/Makefile" ]; then
|
||||
_echo_in "doxygen make latex"
|
||||
version=`cat $DOXYFILE | grep -m1 "^PROJECT_NUMBER\s*=" | \
|
||||
sed -E "s/^.*=[[:space:]]*(.*)[[:space:]]*$/\1/g"`
|
||||
filename="mynt-eye-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" "../mynteye-apidoc.pdf"
|
||||
[ -f "refman.pdf" ] && mv "refman.pdf" "../$filename"
|
||||
fi
|
||||
_echo_d "doxygen completed"
|
||||
else
|
||||
|
||||
2494
doc/en/api.doxyfile
Normal file
2494
doc/en/api.doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
11
doc/en/mainpage.md
Normal file
11
doc/en/mainpage.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# MYNT EYE 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
|
||||
26
doc/en/spec_control_api.md
Normal file
26
doc/en/spec_control_api.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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 | √ | 0x21 | XU_CAM_CTRL | values: {10,15,20,25,30,35,40,45,50,55} |
|
||||
| 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 | |
|
||||
53
doc/en/spec_control_channel.md
Normal file
53
doc/en/spec_control_channel.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# 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 |
|
||||
14
doc/en/spec_hardware_info.md
Normal file
14
doc/en/spec_hardware_info.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# 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 |
|
||||
20
doc/en/spec_image_data.md
Normal file
20
doc/en/spec_image_data.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# 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.
|
||||
23
doc/en/spec_image_params.md
Normal file
23
doc/en/spec_image_params.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 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 |
|
||||
42
doc/en/spec_imu_data.md
Normal file
42
doc/en/spec_imu_data.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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℃**.
|
||||
23
doc/en/spec_imu_params.md
Normal file
23
doc/en/spec_imu_params.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 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 |
|
||||
4
doc/en/specs_ctrl.md
Normal file
4
doc/en/specs_ctrl.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Device Control Specification {#specs_ctrl}
|
||||
|
||||
* @subpage spec_control_api
|
||||
* @subpage spec_control_channel
|
||||
7
doc/en/specs_data.md
Normal file
7
doc/en/specs_data.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# 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
|
||||
@@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.8.13
|
||||
# Doxyfile 1.8.14
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@@ -20,8 +20,8 @@
|
||||
# This tag specifies the encoding used for all characters in the config file
|
||||
# that follow. The default is UTF-8 which is also the encoding used for all text
|
||||
# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
|
||||
# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
|
||||
# for the list of possible encodings.
|
||||
# built into libc) for the transcoding. See
|
||||
# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
|
||||
# The default value is: UTF-8.
|
||||
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
@@ -38,7 +38,7 @@ PROJECT_NAME = "MYNT EYE SDK"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2.0.0-rc
|
||||
PROJECT_NUMBER = 2.0.1-rc1
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@@ -236,7 +236,8 @@ TAB_SIZE = 2
|
||||
# will allow you to put the command \sideeffect (or @sideeffect) in the
|
||||
# documentation, which will result in a user-defined paragraph with heading
|
||||
# "Side Effects:". You can put \n's in the value part of an alias to insert
|
||||
# newlines.
|
||||
# newlines (in the resulting output). You can put ^^ in the value part of an
|
||||
# alias to insert a newline as if a physical newline was in the original file.
|
||||
|
||||
ALIASES =
|
||||
|
||||
@@ -337,7 +338,7 @@ BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
|
||||
# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
|
||||
# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
|
||||
# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
|
||||
# will parse them like normal C++ but will assume all classes use public instead
|
||||
# of private inheritance when no explicit protection keyword is present.
|
||||
# The default value is: NO.
|
||||
@@ -708,7 +709,7 @@ LAYOUT_FILE =
|
||||
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
|
||||
# the reference definitions. This must be a list of .bib files. The .bib
|
||||
# extension is automatically appended if omitted. This requires the bibtex tool
|
||||
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
|
||||
# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
|
||||
# For LaTeX the style of the bibliography can be controlled using
|
||||
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
|
||||
# search path. See also \cite for info how to create references.
|
||||
@@ -791,14 +792,6 @@ WARN_LOGFILE =
|
||||
# Note: If this tag is empty the current directory is searched.
|
||||
|
||||
INPUT = mainpage.md \
|
||||
guides.md \
|
||||
guide_build_linux.md \
|
||||
guide_build_win.md \
|
||||
guide_samples.md \
|
||||
guide_tools.md \
|
||||
guide_log.md \
|
||||
guide_opencv.md \
|
||||
guide_ros.md \
|
||||
specs_data.md \
|
||||
spec_hardware_info.md \
|
||||
spec_image_params.md \
|
||||
@@ -813,7 +806,7 @@ INPUT = mainpage.md \
|
||||
# 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
|
||||
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
||||
# documentation (see: http://www.gnu.org/software/libiconv) for the list of
|
||||
# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
|
||||
# possible encodings.
|
||||
# The default value is: UTF-8.
|
||||
|
||||
@@ -1061,7 +1054,7 @@ SOURCE_TOOLTIPS = YES
|
||||
# If the USE_HTAGS tag is set to YES then the references to source code will
|
||||
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
|
||||
# source browser. The htags tool is part of GNU's global source tagging system
|
||||
# (see http://www.gnu.org/software/global/global.html). You will need version
|
||||
# (see https://www.gnu.org/software/global/global.html). You will need version
|
||||
# 4.8.6 or higher.
|
||||
#
|
||||
# To use it do the following:
|
||||
@@ -1206,7 +1199,7 @@ HTML_EXTRA_FILES =
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the style sheet and background images according to
|
||||
# this color. Hue is specified as an angle on a colorwheel, see
|
||||
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
||||
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
||||
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
|
||||
# purple, and 360 is red again.
|
||||
# Minimum value: 0, maximum value: 359, default value: 220.
|
||||
@@ -1242,6 +1235,17 @@ HTML_COLORSTYLE_GAMMA = 80
|
||||
|
||||
HTML_TIMESTAMP = NO
|
||||
|
||||
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
|
||||
# documentation will contain a main index with vertical navigation menus that
|
||||
# are dynamically created via Javascript. If disabled, the navigation index will
|
||||
# consists of multiple levels of tabs that are statically embedded in every HTML
|
||||
# page. Disable this option to support browsers that do not have Javascript,
|
||||
# like the Qt help browser.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_DYNAMIC_MENUS = YES
|
||||
|
||||
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
||||
# documentation will contain sections that can be hidden and shown after the
|
||||
# page has loaded.
|
||||
@@ -1265,12 +1269,12 @@ HTML_INDEX_NUM_ENTRIES = 100
|
||||
|
||||
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
|
||||
# generated that can be used as input for Apple's Xcode 3 integrated development
|
||||
# environment (see: http://developer.apple.com/tools/xcode/), introduced with
|
||||
# environment (see: https://developer.apple.com/tools/xcode/), introduced with
|
||||
# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
|
||||
# Makefile in the HTML output directory. Running make will produce the docset in
|
||||
# that directory and running make install will install the docset in
|
||||
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
|
||||
# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
|
||||
# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html
|
||||
# for more information.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
@@ -1386,7 +1390,7 @@ QCH_FILE =
|
||||
|
||||
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
||||
# Project output. For more information please see Qt Help Project / Namespace
|
||||
# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
|
||||
# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace).
|
||||
# The default value is: org.doxygen.Project.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
@@ -1394,8 +1398,7 @@ QHP_NAMESPACE = com.slightech.mynteye
|
||||
|
||||
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
||||
# Help Project output. For more information please see Qt Help Project / Virtual
|
||||
# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
|
||||
# folders).
|
||||
# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders).
|
||||
# The default value is: doc.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
@@ -1403,23 +1406,21 @@ QHP_VIRTUAL_FOLDER = doc
|
||||
|
||||
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
||||
# filter to add. For more information please see Qt Help Project / Custom
|
||||
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
|
||||
# filters).
|
||||
# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_NAME =
|
||||
|
||||
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
|
||||
# custom filter to add. For more information please see Qt Help Project / Custom
|
||||
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
|
||||
# filters).
|
||||
# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
|
||||
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
|
||||
# project's filter section matches. Qt Help Project / Filter Attributes (see:
|
||||
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
|
||||
# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
@@ -1512,7 +1513,7 @@ EXT_LINKS_IN_WINDOW = NO
|
||||
|
||||
FORMULA_FONTSIZE = 10
|
||||
|
||||
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
|
||||
# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
|
||||
# generated for formulas are transparent PNGs. Transparent PNGs are not
|
||||
# supported properly for IE 6.0, but are supported on all modern browsers.
|
||||
#
|
||||
@@ -1524,7 +1525,7 @@ FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
|
||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||
# http://www.mathjax.org) which uses client side Javascript for the rendering
|
||||
# https://www.mathjax.org) which uses client side Javascript for the rendering
|
||||
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
|
||||
# installed or if you want to formulas look prettier in the HTML output. When
|
||||
# enabled you may also need to install MathJax separately and configure the path
|
||||
@@ -1551,11 +1552,11 @@ MATHJAX_FORMAT = HTML-CSS
|
||||
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
|
||||
# Content Delivery Network so you can quickly see the result without installing
|
||||
# MathJax. However, it is strongly recommended to install a local copy of
|
||||
# MathJax from http://www.mathjax.org before deployment.
|
||||
# The default value is: http://cdn.mathjax.org/mathjax/latest.
|
||||
# MathJax from https://www.mathjax.org before deployment.
|
||||
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/.
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
|
||||
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
|
||||
|
||||
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
|
||||
# extension names that should be enabled during MathJax rendering. For example
|
||||
@@ -1613,7 +1614,7 @@ SERVER_BASED_SEARCH = NO
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see: http://xapian.org/).
|
||||
# Xapian (see: https://xapian.org/).
|
||||
#
|
||||
# See the section "External Indexing and Searching" for details.
|
||||
# The default value is: NO.
|
||||
@@ -1626,7 +1627,7 @@ EXTERNAL_SEARCH = NO
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see: http://xapian.org/). See the section "External Indexing and
|
||||
# Xapian (see: https://xapian.org/). See the section "External Indexing and
|
||||
# Searching" for details.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
@@ -1815,7 +1816,7 @@ LATEX_SOURCE_CODE = NO
|
||||
|
||||
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
||||
# bibliography, e.g. plainnat, or ieeetr. See
|
||||
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
||||
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
||||
# The default value is: plain.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
@@ -1998,9 +1999,9 @@ DOCBOOK_PROGRAMLISTING = NO
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
|
||||
# AutoGen Definitions (see http://autogen.sf.net) file that captures the
|
||||
# structure of the code including all documentation. Note that this feature is
|
||||
# still experimental and incomplete at the moment.
|
||||
# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
|
||||
# the structure of the code including all documentation. Note that this feature
|
||||
# is still experimental and incomplete at the moment.
|
||||
# The default value is: NO.
|
||||
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# MYNT EYE SDK {#mainpage}
|
||||
|
||||
* API 模块
|
||||
* <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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 控制 API 说明 {#spec_contorl_api}
|
||||
# 控制 API 说明 {#spec_control_api}
|
||||
|
||||
控制有两种实现方式,一是通过 UVC 标准协议,二是通过 UVC 拓展通道自定义协议。
|
||||
|
||||
@@ -8,21 +8,21 @@
|
||||
| :----- | :----- | :-------- | :-------- | :-------- | :-------- | :----------- | :----------- | :----- |
|
||||
| 增益 | gain | 2 | 24 | 0 | 48 | √ | 0x12 | 关闭自动曝光,手动设定的参数 |
|
||||
| 亮度 | brightness/exposure_time | 2 | 120 | 0 | 240 | √ | 0x14 | 关闭自动曝光,手动设定的参数 |
|
||||
| 对比度 | contrast/black_level_calibration | 2 | 127 | 0 | 255 | √ | 0x10 | |
|
||||
| 对比度 | contrast/black_level_calibration | 2 | 127 | 0 | 255 | √ | 0x10 | 关闭自动曝光,手动设定的参数 |
|
||||
|
||||
> UVC 标准协议实现的控制,有现成的 API 进行 Get & Set ,包括 Min, Max, Default 。
|
||||
|
||||
## 自定义协议
|
||||
|
||||
| 名称 | 字段 | 字节数 | 默认值 | 最小值 | 最大值 | 是否储存 | Flash 地址 | 所属通道 | 通道地址 | 说明 |
|
||||
| :----- | :----- | :-------- | :-------- | :-------- | :-------- | :----------- | :----------- | :----------- | :----------- | :----- |
|
||||
| 图像帧率 | frame_rate | 2 | 25 | 10 | 60 | √ | 0x21 | XU_CAM_CTRL | 0x0100 | 步进为5,即有效值为{10,15,20,25,30,35,40,45,50,55,60} |
|
||||
| IMU 频率 | imu_frequency | 2 | 200 | 100 | 500 | √ | 0x23 | XU_CAM_CTRL | 0x0100 | 有效值为{100,200,250,333,500} |
|
||||
| 曝光模式 | exposure_mode | 1 | 0 | 0 | 1 | √ | 0x0F | XU_CAM_CTRL | 0x0100 | 0:开启自动曝光; 1:关闭 |
|
||||
| 最大增益 | max_gain | 2 | 48 | 0 | 48 | √ | 0x1D | XU_CAM_CTRL | 0x0100 | 开始自动曝光,可设定的阈值 |
|
||||
| 最大曝光时间 | max_exposure_time | 2 | 240 | 0 | 240 | √ | 0x1B | XU_CAM_CTRL | 0x0100 | 开始自动曝光,可设定的阈值 |
|
||||
| 期望亮度 | desired_brightness | 2 | 192 | 0 | 255 | √ | 0x19 | XU_CAM_CTRL | 0x0100 | |
|
||||
| IR 控制 | ir_control | 1 | 0 | 0 | 160 | × | - | XU_CAM_CTRL | 0x0100 | |
|
||||
| HDR 模式 | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 0x0100 | 0:10-bit;1:12-bit |
|
||||
| 零漂标定 | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | 0x0200 | |
|
||||
| 擦除芯片 | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | 0x0200 | |
|
||||
| 名称 | 字段 | 字节数 | 默认值 | 最小值 | 最大值 | 是否储存 | Flash 地址 | 所属通道 | 说明 |
|
||||
| :----- | :----- | :-------- | :-------- | :-------- | :-------- | :----------- | :----------- | :----------- | :----- |
|
||||
| 图像帧率 | frame_rate | 2 | 25 | 10 | √ | 0x21 | XU_CAM_CTRL | 步进为5,即有效值为{10,15,20,25,30,35,40,45,50,55} |
|
||||
| IMU 频率 | imu_frequency | 2 | 200 | 100 | 500 | √ | 0x23 | XU_CAM_CTRL | 有效值为{100,200,250,333,500} |
|
||||
| 曝光模式 | exposure_mode | 1 | 0 | 0 | 1 | √ | 0x0F | XU_CAM_CTRL | 0:开启自动曝光; 1:关闭 |
|
||||
| 最大增益 | max_gain | 2 | 48 | 0 | 48 | √ | 0x1D | XU_CAM_CTRL | 开始自动曝光,可设定的阈值 |
|
||||
| 最大曝光时间 | max_exposure_time | 2 | 240 | 0 | 240 | √ | 0x1B | XU_CAM_CTRL | 开始自动曝光,可设定的阈值 |
|
||||
| 期望亮度 | desired_brightness | 2 | 192 | 0 | 255 | √ | 0x19 | XU_CAM_CTRL | 开始自动曝光,可设定的阈值 |
|
||||
| IR 控制 | ir_control | 1 | 0 | 0 | 160 | × | - | XU_CAM_CTRL | |
|
||||
| HDR 模式 | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 0:10-bit;1:12-bit |
|
||||
| 零漂标定 | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | |
|
||||
| 擦除芯片 | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 拓展通道说明 {#spec_contorl_channel}
|
||||
# 拓展通道说明 {#spec_control_channel}
|
||||
|
||||
| 名称 | 字段 | 地址 | 带宽 | 说明 |
|
||||
| :----- | :----- | :----- | :----- | :----- |
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
## 半双工通道
|
||||
|
||||
半双工通道是那些仅需 Get 或 Set 的控制通道,如请求零漂矫正。
|
||||
半双工通道是那些仅需 Set 的控制通道,如请求零漂矫正。
|
||||
|
||||
## IMU 通道
|
||||
|
||||
@@ -25,18 +25,18 @@
|
||||
用来读写硬件信息、图像参数、 IMU 参数的通道。
|
||||
|
||||
| Name | Header | Size | File | Checksum |
|
||||
| :--- | :- | :--- | :--- | :-------- |
|
||||
| :--- | :----- | :--- | :--- | :-------- |
|
||||
| 字节数 | 1 | 2 | - | 1 |
|
||||
| 类型 | uint8_t | uint16_t | - | uint8_t |
|
||||
| 描述 | 标识 | 文件内容大小 | 文件内容 | 校验码(文件内容所有字节异或) |
|
||||
|
||||
| Header bit | Description |
|
||||
| :--------- | :---------- |
|
||||
| 0 | 0: Get; 1: Set |
|
||||
| 1~4 | 未定义 |
|
||||
| 5 | IMU 参数 |
|
||||
| 6 | 图像参数 |
|
||||
| 7 | 硬件信息 |
|
||||
| Header Bit Subscript | Description |
|
||||
| :------------------- | :---------- |
|
||||
| 0 | 硬件信息 |
|
||||
| 1 | 图像参数 |
|
||||
| 2 | IMU 参数 |
|
||||
| 3~6 | 未定义 |
|
||||
| 7 | 0: Get; 1: Set |
|
||||
|
||||
### 文件内容包
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
## 图像数据包
|
||||
|
||||
| Name | Header | Size | Frame ID | Timestamp | Exposure Time | Checksum |
|
||||
| :--- | :----- | :--- | :------ | :-------- | :----------- | :------- |
|
||||
| :--- | :----- | :--- | :------- | :-------- | :------------ | :------- |
|
||||
| 字节数 | 1 | 1 | 2 | 4 | 2 | 1 |
|
||||
| 类型 | uint8_t | uint8_t | uint16_t | uint32_t | uint16_t | uint8_t |
|
||||
| 描述 | 0x3B | 0x08 (数据内容大小) | 帧 ID | 时间戳 | 曝光时间 | 校验码(数据内容所有字节异或) |
|
||||
|
||||
* 数据包校验不过,会丢弃该帧。
|
||||
* 时间的单位精度为: 0.01 ms / 10 us 。
|
||||
* 时间单位的精度为: 0.01 ms / 10 us 。
|
||||
* 4 字节能表示的最大时间约是 11.9 小时,溢出后将重累计。
|
||||
* 时间累计是从上电时从开始,而不是从打开时开始。
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
| 畸变模型 | model | - | 1 | uint8_t; pinhole,... |
|
||||
| 畸变参数 | coeffs[5] | - | 40 | double; k1,k2,p1,p2,k3 |
|
||||
|
||||
> 图像内参不同分辨率会不同。如果多分辨率的话,就会有多个。
|
||||
> 图像分辨率不同,内参不同。多分辨率的话,需有多个内参。
|
||||
|
||||
## 图像外参
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ IMU 包/小包,是一组 IMU 数据。
|
||||
### IMU 段
|
||||
|
||||
| Name | Offset | Frame ID | Accelerometer | Temperature | Gyroscope |
|
||||
| :--- | :----- | :------ | :------------ | :---------- | :-------- |
|
||||
| :--- | :----- | :------- | :------------ | :---------- | :-------- |
|
||||
| 字节数 | 2 | 2 | 6 | 2 | 6 |
|
||||
| 类型 | int16_t | uint16_t | int16_t * 3 | int16_t | int16_t * 3 |
|
||||
| Description | 相对基准时间戳的偏移量 | 图像帧 ID | 加速度计 x y z 三轴的值 | IMU 的温度 | 陀螺仪 x y z 三轴的值 |
|
||||
| 描述 | 相对基准时间戳的偏移量 | 图像帧 ID | 加速度计 x y z 三轴的值 | IMU 的温度 | 陀螺仪 x y z 三轴的值 |
|
||||
|
||||
* 加速度计和陀螺仪的计量值换算成物理值公式: **real = data * range / 0x10000** 。
|
||||
* 加速度计量程默认值为 **8 g** ,陀螺仪量程默认值为 **1000 deg/s** 。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 设备控制说明 {#specs_ctrl}
|
||||
|
||||
* @subpage spec_contorl_api
|
||||
* @subpage spec_contorl_channel
|
||||
* @subpage spec_control_api
|
||||
* @subpage spec_control_channel
|
||||
|
||||
@@ -25,14 +25,30 @@ struct glog_init {
|
||||
glog_init(int argc, char *argv[]) {
|
||||
(void)argc;
|
||||
|
||||
// FLAGS_logtostderr = true;
|
||||
FLAGS_alsologtostderr = true;
|
||||
// Set whether log messages go to stderr instead of logfiles
|
||||
FLAGS_logtostderr = true;
|
||||
|
||||
// Set whether log messages go to stderr in addition to logfiles.
|
||||
// FLAGS_alsologtostderr = true;
|
||||
|
||||
// Set color messages logged to stderr (if supported by terminal).
|
||||
FLAGS_colorlogtostderr = true;
|
||||
|
||||
// FLAGS_log_dir = ".";
|
||||
// Log suppression level: messages logged at a lower level than this
|
||||
// are suppressed.
|
||||
FLAGS_minloglevel = google::GLOG_INFO;
|
||||
|
||||
// If specified, logfiles are written into this directory instead of the
|
||||
// default logging directory.
|
||||
FLAGS_log_dir = ".";
|
||||
|
||||
// Sets the maximum log file size (in MB).
|
||||
FLAGS_max_log_size = 1024;
|
||||
|
||||
// Sets whether to avoid logging to the disk if the disk is full.
|
||||
FLAGS_stop_logging_if_full_disk = true;
|
||||
|
||||
// Show all VLOG(m) messages for m <= this.
|
||||
// FLAGS_v = 2;
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
@@ -58,7 +58,7 @@ MYNTEYE_API_VERSION_CHECK( \
|
||||
# define MYNTEYE_USE_NAMESPACE
|
||||
#endif
|
||||
|
||||
constexpr char MYNTEYE_SDK_ROOT_DIR[] = "@MYNTEYE_SDK_ROOT_DIR@";
|
||||
constexpr char MYNTEYE_SDK_INSTALL_DIR[] = "@MYNTEYE_SDK_INSTALL_DIR@";
|
||||
const char MYNTEYE_SDK_ROOT_DIR[] = "@MYNTEYE_SDK_ROOT_DIR@";
|
||||
const char MYNTEYE_SDK_INSTALL_DIR[] = "@MYNTEYE_SDK_INSTALL_DIR@";
|
||||
|
||||
#endif // MYNTEYE_MYNTEYE_H_
|
||||
|
||||
@@ -144,7 +144,7 @@ enum class Option : std::uint8_t {
|
||||
/**
|
||||
* Image frame rate, must set IMU_FREQUENCY together
|
||||
*
|
||||
* values: {10,15,20,25,30,35,40,45,50,55,60}, default: 25
|
||||
* values: {10,15,20,25,30,35,40,45,50,55}, default: 25
|
||||
*/
|
||||
FRAME_RATE,
|
||||
/**
|
||||
|
||||
@@ -79,4 +79,6 @@ add_subdirectory(uvc)
|
||||
|
||||
# tutorials
|
||||
|
||||
if(WITH_API)
|
||||
add_subdirectory(tutorials)
|
||||
endif()
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
|
||||
#include "mynteye/api.h"
|
||||
|
||||
#define WIN_FLAGS \
|
||||
cv::WINDOW_AUTOSIZE | cv::WINDOW_KEEPRATIO | cv::WINDOW_GUI_NORMAL
|
||||
|
||||
namespace {
|
||||
|
||||
class DepthRegion {
|
||||
@@ -159,9 +156,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
api->Start(Source::VIDEO_STREAMING);
|
||||
|
||||
cv::namedWindow("frame", WIN_FLAGS);
|
||||
cv::namedWindow("depth", WIN_FLAGS);
|
||||
cv::namedWindow("region", WIN_FLAGS);
|
||||
cv::namedWindow("frame");
|
||||
cv::namedWindow("depth");
|
||||
cv::namedWindow("region");
|
||||
|
||||
DepthRegion depth_region(3);
|
||||
auto depth_info = [](
|
||||
|
||||
@@ -63,7 +63,7 @@ macro(make_executable2 NAME)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(WITH_API)
|
||||
# packages
|
||||
|
||||
# If you install PCL to different directory, please set CMAKE_PREFIX_PATH to find it.
|
||||
#LIST(APPEND CMAKE_PREFIX_PATH /usr/local/share)
|
||||
@@ -124,10 +124,10 @@ make_executable2(ctrl_manual_exposure
|
||||
)
|
||||
make_executable2(ctrl_infrared SRCS control/infrared.cc WITH_OPENCV)
|
||||
|
||||
endif()
|
||||
|
||||
# intermediate level
|
||||
|
||||
make_executable2(get_all_device_info SRCS intermediate/get_all_device_info.cc WITH_OPENCV)
|
||||
|
||||
if(PCL_FOUND)
|
||||
|
||||
if(OpenCV_VERSION VERSION_LESS 4.0)
|
||||
|
||||
@@ -30,7 +30,7 @@ int main(int argc, char *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, 60
|
||||
// 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);
|
||||
|
||||
@@ -25,8 +25,8 @@ int main(int argc, char *argv[]) {
|
||||
LOG(INFO) << "Intrinsics left: {" << api->GetIntrinsics(Stream::LEFT) << "}";
|
||||
LOG(INFO) << "Intrinsics right: {" << api->GetIntrinsics(Stream::RIGHT)
|
||||
<< "}";
|
||||
LOG(INFO) << "Extrinsics left to right: {"
|
||||
<< api->GetExtrinsics(Stream::LEFT, Stream::RIGHT) << "}";
|
||||
LOG(INFO) << "Extrinsics right to left: {"
|
||||
<< api->GetExtrinsics(Stream::RIGHT, Stream::LEFT) << "}";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
50
samples/tutorials/intermediate/get_all_device_info.cc
Normal file
50
samples/tutorials/intermediate/get_all_device_info.cc
Normal file
@@ -0,0 +1,50 @@
|
||||
// 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.
|
||||
#include "mynteye/context.h"
|
||||
#include "mynteye/device.h"
|
||||
#include "mynteye/glog_init.h"
|
||||
|
||||
MYNTEYE_USE_NAMESPACE
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
glog_init _(argc, argv);
|
||||
|
||||
LOG(INFO) << "Detecting MYNT EYE devices";
|
||||
Context context;
|
||||
auto &&devices = context.devices();
|
||||
|
||||
size_t n = devices.size();
|
||||
if (n <= 0) {
|
||||
LOG(ERROR) << "No MYNT EYE devices :(";
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
auto &&device = devices[i];
|
||||
LOG(INFO) << "MYNT EYE device index: " << i;
|
||||
LOG(INFO) << " Device name: " << device->GetInfo(Info::DEVICE_NAME);
|
||||
LOG(INFO) << " Serial number: " << device->GetInfo(Info::SERIAL_NUMBER);
|
||||
LOG(INFO) << " Firmware version: "
|
||||
<< device->GetInfo(Info::FIRMWARE_VERSION);
|
||||
LOG(INFO) << " Hardware version: "
|
||||
<< device->GetInfo(Info::HARDWARE_VERSION);
|
||||
LOG(INFO) << " Spec version: " << device->GetInfo(Info::SPEC_VERSION);
|
||||
LOG(INFO) << " Lens type: " << device->GetInfo(Info::LENS_TYPE);
|
||||
LOG(INFO) << " IMU type: " << device->GetInfo(Info::IMU_TYPE);
|
||||
LOG(INFO) << " Nominal baseline: "
|
||||
<< device->GetInfo(Info::NOMINAL_BASELINE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -21,9 +21,6 @@
|
||||
#include "util/cv_painter.h"
|
||||
#include "util/pc_viewer.h"
|
||||
|
||||
#define WIN_FLAGS \
|
||||
cv::WINDOW_AUTOSIZE | cv::WINDOW_KEEPRATIO | cv::WINDOW_GUI_NORMAL
|
||||
|
||||
namespace {
|
||||
|
||||
class DepthRegion {
|
||||
@@ -162,9 +159,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
api->Start(Source::VIDEO_STREAMING);
|
||||
|
||||
cv::namedWindow("frame", WIN_FLAGS);
|
||||
cv::namedWindow("depth", WIN_FLAGS);
|
||||
cv::namedWindow("region", WIN_FLAGS);
|
||||
cv::namedWindow("frame");
|
||||
cv::namedWindow("depth");
|
||||
cv::namedWindow("region");
|
||||
|
||||
DepthRegion depth_region(3);
|
||||
auto depth_info = [](
|
||||
|
||||
@@ -24,11 +24,17 @@ source "$BASE_DIR/common/host.sh"
|
||||
|
||||
PYTHON="python"
|
||||
if [ "$HOST_OS" = "Win" ]; then
|
||||
# default python on MSYS
|
||||
PYTHON="python2"
|
||||
if ! _detect_cmd $PYTHON; then
|
||||
PYTHON="python2" # try python2 on MSYS
|
||||
fi
|
||||
fi
|
||||
|
||||
_detect $PYTHON
|
||||
_detect $PYTHON 1
|
||||
|
||||
PYTHON_FOUND="${PYTHON}_FOUND"
|
||||
if [ -z "${!PYTHON_FOUND}" ]; then
|
||||
_echo_en "$PYTHON not found"
|
||||
fi
|
||||
|
||||
if [ "$HOST_OS" = "Linux" ]; then
|
||||
_detect_install() {
|
||||
@@ -137,13 +143,21 @@ fi
|
||||
|
||||
# detect pip
|
||||
if ! _detect_cmd pip; then
|
||||
if [ -n "${!PYTHON_FOUND}" ]; then
|
||||
_echo_sn "Install pip"
|
||||
[ -f "get-pip.py" ] || curl -O https://bootstrap.pypa.io/get-pip.py
|
||||
$SUDO $PYTHON get-pip.py
|
||||
else
|
||||
_echo_en "Skipped install pip, as $PYTHON not found"
|
||||
fi
|
||||
fi
|
||||
# pip install
|
||||
if _detect_cmd pip; then
|
||||
_echo_d "pip install --upgrade autopep8 cpplint pylint requests"
|
||||
$SUDO pip install --upgrade autopep8 cpplint pylint requests
|
||||
else
|
||||
_echo_en "Skipped pip install packages, as pip not found"
|
||||
fi
|
||||
|
||||
## realpath
|
||||
|
||||
@@ -168,8 +182,12 @@ ROOT_DIR=$(realpath "$BASE_DIR/..")
|
||||
|
||||
## init
|
||||
|
||||
if [ -n "${!PYTHON_FOUND}" ]; then
|
||||
_echo_s "Init git hooks"
|
||||
$PYTHON "$ROOT_DIR/tools/linter/init-git-hooks.py"
|
||||
else
|
||||
_echo_en "Skipped init git hooks, as $PYTHON not found"
|
||||
fi
|
||||
|
||||
## cmake version
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "api/plugin.h"
|
||||
#include "api/synthetic.h"
|
||||
#include "device/device.h"
|
||||
#include "device/device_s.h"
|
||||
#include "internal/dl.h"
|
||||
|
||||
#if defined(WITH_FILESYSTEM) && defined(WITH_NATIVE_FILESYSTEM)
|
||||
@@ -73,12 +74,14 @@ bool dir_exists(const fs::path &p) {
|
||||
|
||||
bool file_exists(const std::string &p) {
|
||||
DWORD attrs = GetFileAttributes(p.c_str());
|
||||
return (attrs != INVALID_FILE_ATTRIBUTES && !(attrs & FILE_ATTRIBUTE_DIRECTORY));
|
||||
return (attrs != INVALID_FILE_ATTRIBUTES) &&
|
||||
!(attrs & FILE_ATTRIBUTE_DIRECTORY);
|
||||
}
|
||||
|
||||
bool dir_exists(const std::string &p) {
|
||||
DWORD attrs = GetFileAttributes(p.c_str());
|
||||
return (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY));
|
||||
return (attrs != INVALID_FILE_ATTRIBUTES) &&
|
||||
(attrs & FILE_ATTRIBUTE_DIRECTORY);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -207,9 +210,29 @@ std::vector<std::string> get_plugin_paths() {
|
||||
|
||||
} // namespace
|
||||
|
||||
API::API(std::shared_ptr<Device> device)
|
||||
: device_(device), synthetic_(new Synthetic(this)) {
|
||||
API::API(std::shared_ptr<Device> device) : device_(device) {
|
||||
VLOG(2) << __func__;
|
||||
if (std::dynamic_pointer_cast<StandardDevice>(device_) != nullptr) {
|
||||
bool in_l_ok, in_r_ok, ex_r2l_ok;
|
||||
device_->GetIntrinsics(Stream::LEFT, &in_l_ok);
|
||||
device_->GetIntrinsics(Stream::RIGHT, &in_r_ok);
|
||||
device_->GetExtrinsics(Stream::RIGHT, Stream::LEFT, &ex_r2l_ok);
|
||||
if (!in_l_ok || !in_r_ok || !ex_r2l_ok) {
|
||||
#if defined(WITH_DEVICE_INFO_REQUIRED)
|
||||
LOG(FATAL)
|
||||
#else
|
||||
LOG(WARNING)
|
||||
#endif
|
||||
<< "Image params not found, but we need it to process the "
|
||||
"images. Please `make tools` and use `img_params_writer` "
|
||||
"to write the image params. If you update the SDK from "
|
||||
"1.x, the `SN*.conf` is the file contains them. Besides, "
|
||||
"you could also calibrate them by yourself. Read the guide "
|
||||
"doc (https://github.com/slightech/MYNT-EYE-SDK-2-Guide) "
|
||||
"to learn more.";
|
||||
}
|
||||
}
|
||||
synthetic_.reset(new Synthetic(this));
|
||||
}
|
||||
|
||||
API::~API() {
|
||||
|
||||
@@ -246,12 +246,12 @@ class MYNTEYE_API API {
|
||||
void DisableStreamData(const Stream &stream);
|
||||
|
||||
/**
|
||||
* Get the datas of stream.
|
||||
* @note default cache 4 datas at most.
|
||||
* Get the latest data of stream.
|
||||
*/
|
||||
api::StreamData GetStreamData(const Stream &stream);
|
||||
/**
|
||||
* Get the latest data of stream.
|
||||
* Get the datas of stream.
|
||||
* @note default cache 4 datas at most.
|
||||
*/
|
||||
std::vector<api::StreamData> GetStreamDatas(const Stream &stream);
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
const char DepthProcessor::NAME[] = "DepthProcessor";
|
||||
|
||||
DepthProcessor::DepthProcessor(std::int32_t proc_period)
|
||||
: Processor(std::move(proc_period)) {
|
||||
VLOG(2) << __func__ << ": proc_period=" << proc_period;
|
||||
|
||||
@@ -23,7 +23,7 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
class DepthProcessor : public Processor {
|
||||
public:
|
||||
static constexpr auto &&NAME = "DepthProcessor";
|
||||
static const char NAME[];
|
||||
|
||||
explicit DepthProcessor(std::int32_t proc_period = 0);
|
||||
virtual ~DepthProcessor();
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
const char DisparityNormalizedProcessor::NAME[] =
|
||||
"DisparityNormalizedProcessor";
|
||||
|
||||
DisparityNormalizedProcessor::DisparityNormalizedProcessor(
|
||||
std::int32_t proc_period)
|
||||
: Processor(std::move(proc_period)) {
|
||||
|
||||
@@ -23,7 +23,7 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
class DisparityNormalizedProcessor : public Processor {
|
||||
public:
|
||||
static constexpr auto &&NAME = "DisparityNormalizedProcessor";
|
||||
static const char NAME[];
|
||||
|
||||
explicit DisparityNormalizedProcessor(std::int32_t proc_period = 0);
|
||||
virtual ~DisparityNormalizedProcessor();
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
const char DisparityProcessor::NAME[] = "DisparityProcessor";
|
||||
|
||||
DisparityProcessor::DisparityProcessor(std::int32_t proc_period)
|
||||
: Processor(std::move(proc_period)) {
|
||||
VLOG(2) << __func__ << ": proc_period=" << proc_period;
|
||||
|
||||
@@ -29,7 +29,7 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
class DisparityProcessor : public Processor {
|
||||
public:
|
||||
static constexpr auto &&NAME = "DisparityProcessor";
|
||||
static const char NAME[];
|
||||
|
||||
explicit DisparityProcessor(std::int32_t proc_period = 0);
|
||||
virtual ~DisparityProcessor();
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "mynteye/mynteye.h"
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
@@ -29,6 +31,7 @@ struct MYNTEYE_API Object {
|
||||
virtual ~Object() = default;
|
||||
|
||||
virtual Object *Clone() const = 0;
|
||||
virtual bool DecValidity() const = 0;
|
||||
|
||||
/** Cast the obj to T pointer */
|
||||
template <typename T>
|
||||
@@ -41,6 +44,11 @@ struct MYNTEYE_API Object {
|
||||
static const T *Cast(const Object *obj) {
|
||||
return dynamic_cast<const T *>(obj);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static std::shared_ptr<T> Cast(const std::shared_ptr<Object> &obj) {
|
||||
return std::dynamic_pointer_cast<T>(obj);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -58,6 +66,10 @@ struct MYNTEYE_API ObjMat : public Object {
|
||||
mat->value = value.clone();
|
||||
return mat;
|
||||
}
|
||||
|
||||
bool DecValidity() const {
|
||||
return !value.empty();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -80,6 +92,10 @@ struct MYNTEYE_API ObjMat2 : public Object {
|
||||
mat2->second = second.clone();
|
||||
return mat2;
|
||||
}
|
||||
|
||||
bool DecValidity() const {
|
||||
return !first.empty() && !second.empty();
|
||||
}
|
||||
};
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
const char PointsProcessor::NAME[] = "PointsProcessor";
|
||||
|
||||
PointsProcessor::PointsProcessor(cv::Mat Q, std::int32_t proc_period)
|
||||
: Processor(std::move(proc_period)), Q_(std::move(Q)) {
|
||||
VLOG(2) << __func__ << ": proc_period=" << proc_period;
|
||||
|
||||
@@ -25,7 +25,7 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
class PointsProcessor : public Processor {
|
||||
public:
|
||||
static constexpr auto &&NAME = "PointsProcessor";
|
||||
static const char NAME[];
|
||||
|
||||
explicit PointsProcessor(cv::Mat Q, std::int32_t proc_period = 0);
|
||||
virtual ~PointsProcessor();
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <exception>
|
||||
#include <utility>
|
||||
|
||||
#include "internal/strings.h"
|
||||
#include "internal/times.h"
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
@@ -128,6 +130,10 @@ bool Processor::Process(const Object &in) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!in.DecValidity()) {
|
||||
LOG(WARNING) << Name() << " process with invalid input";
|
||||
return false;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(mtx_input_ready_);
|
||||
input_.reset(in.Clone());
|
||||
@@ -137,9 +143,9 @@ bool Processor::Process(const Object &in) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Object *Processor::GetOutput() {
|
||||
std::shared_ptr<Object> Processor::GetOutput() {
|
||||
std::lock_guard<std::mutex> lk(mtx_result_);
|
||||
return output_result_.get();
|
||||
return std::shared_ptr<Object>(std::move(output_result_));
|
||||
}
|
||||
|
||||
std::uint64_t Processor::GetDroppedCount() {
|
||||
@@ -192,6 +198,7 @@ void Processor::Run() {
|
||||
pre_callback_(input_.get());
|
||||
}
|
||||
bool ok = false;
|
||||
try {
|
||||
if (callback_) {
|
||||
if (callback_(input_.get(), output_.get(), parent_)) {
|
||||
ok = true;
|
||||
@@ -201,6 +208,12 @@ void Processor::Run() {
|
||||
} else {
|
||||
ok = OnProcess(input_.get(), output_.get(), parent_);
|
||||
}
|
||||
// CV_Assert(false);
|
||||
} catch (const std::exception &e) {
|
||||
std::string msg(e.what());
|
||||
strings::rtrim(msg);
|
||||
LOG(ERROR) << Name() << " process error \"" << msg << "\"";
|
||||
}
|
||||
if (!ok) {
|
||||
VLOG(2) << Name() << " process failed";
|
||||
continue;
|
||||
|
||||
@@ -65,7 +65,7 @@ class Processor /*: public std::enable_shared_from_this<Processor>*/ {
|
||||
* Returns the last output.
|
||||
* @note Returns null if not output now.
|
||||
*/
|
||||
Object *GetOutput();
|
||||
std::shared_ptr<Object> GetOutput();
|
||||
|
||||
std::uint64_t GetDroppedCount();
|
||||
|
||||
|
||||
@@ -24,13 +24,15 @@
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
const char RectifyProcessor::NAME[] = "RectifyProcessor";
|
||||
|
||||
RectifyProcessor::RectifyProcessor(
|
||||
std::shared_ptr<Device> device, std::int32_t proc_period)
|
||||
: Processor(std::move(proc_period)) {
|
||||
VLOG(2) << __func__ << ": proc_period=" << proc_period;
|
||||
InitParams(
|
||||
device->GetIntrinsics(Stream::LEFT), device->GetIntrinsics(Stream::RIGHT),
|
||||
device->GetExtrinsics(Stream::LEFT, Stream::RIGHT));
|
||||
device->GetExtrinsics(Stream::RIGHT, Stream::LEFT));
|
||||
}
|
||||
|
||||
RectifyProcessor::~RectifyProcessor() {
|
||||
@@ -56,7 +58,7 @@ bool RectifyProcessor::OnProcess(
|
||||
}
|
||||
|
||||
void RectifyProcessor::InitParams(
|
||||
Intrinsics in_left, Intrinsics in_right, Extrinsics ex_left_to_right) {
|
||||
Intrinsics in_left, Intrinsics in_right, Extrinsics ex_right_to_left) {
|
||||
cv::Size size{in_left.width, in_left.height};
|
||||
|
||||
cv::Mat M1 =
|
||||
@@ -68,12 +70,12 @@ void RectifyProcessor::InitParams(
|
||||
cv::Mat D1(1, 5, CV_64F, in_left.coeffs);
|
||||
cv::Mat D2(1, 5, CV_64F, in_right.coeffs);
|
||||
cv::Mat R =
|
||||
(cv::Mat_<double>(3, 3) << ex_left_to_right.rotation[0][0],
|
||||
ex_left_to_right.rotation[0][1], ex_left_to_right.rotation[0][2],
|
||||
ex_left_to_right.rotation[1][0], ex_left_to_right.rotation[1][1],
|
||||
ex_left_to_right.rotation[1][2], ex_left_to_right.rotation[2][0],
|
||||
ex_left_to_right.rotation[2][1], ex_left_to_right.rotation[2][2]);
|
||||
cv::Mat T(3, 1, CV_64F, ex_left_to_right.translation);
|
||||
(cv::Mat_<double>(3, 3) << ex_right_to_left.rotation[0][0],
|
||||
ex_right_to_left.rotation[0][1], ex_right_to_left.rotation[0][2],
|
||||
ex_right_to_left.rotation[1][0], ex_right_to_left.rotation[1][1],
|
||||
ex_right_to_left.rotation[1][2], ex_right_to_left.rotation[2][0],
|
||||
ex_right_to_left.rotation[2][1], ex_right_to_left.rotation[2][2]);
|
||||
cv::Mat T(3, 1, CV_64F, ex_right_to_left.translation);
|
||||
|
||||
VLOG(2) << "InitParams size: " << size;
|
||||
VLOG(2) << "M1: " << M1;
|
||||
|
||||
@@ -29,7 +29,7 @@ class Device;
|
||||
|
||||
class RectifyProcessor : public Processor {
|
||||
public:
|
||||
static constexpr auto &&NAME = "RectifyProcessor";
|
||||
static const char NAME[];
|
||||
|
||||
RectifyProcessor(
|
||||
std::shared_ptr<Device> device, std::int32_t proc_period = 0);
|
||||
@@ -47,7 +47,7 @@ class RectifyProcessor : public Processor {
|
||||
|
||||
private:
|
||||
void InitParams(
|
||||
Intrinsics in_left, Intrinsics in_right, Extrinsics ex_left_to_right);
|
||||
Intrinsics in_left, Intrinsics in_right, Extrinsics ex_right_to_left);
|
||||
};
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
@@ -49,6 +49,15 @@ api::StreamData data2api(const device::StreamData &data) {
|
||||
return {data.img, frame2mat(data.frame), data.frame};
|
||||
}
|
||||
|
||||
void process_childs(
|
||||
const std::shared_ptr<Processor> &proc, const std::string &name,
|
||||
const Object &obj) {
|
||||
auto &&processor = find_processor<Processor>(proc, name);
|
||||
for (auto child : processor->GetChilds()) {
|
||||
child->Process(obj);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Synthetic::Synthetic(API *api) : api_(api), plugin_(nullptr) {
|
||||
@@ -146,30 +155,30 @@ api::StreamData Synthetic::GetStreamData(const Stream &stream) {
|
||||
auto &&device = api_->device();
|
||||
return data2api(device->GetLatestStreamData(stream));
|
||||
} else if (mode == MODE_SYNTHETIC) {
|
||||
switch (stream) {
|
||||
case Stream::LEFT_RECTIFIED: {
|
||||
if (stream == Stream::LEFT_RECTIFIED || stream == Stream::RIGHT_RECTIFIED) {
|
||||
static std::shared_ptr<ObjMat2> output = nullptr;
|
||||
auto &&processor = find_processor<RectifyProcessor>(processor_);
|
||||
Object *out = processor->GetOutput();
|
||||
auto &&out = processor->GetOutput();
|
||||
if (out != nullptr) {
|
||||
ObjMat2 *output = Object::Cast<ObjMat2>(out);
|
||||
return {nullptr, output->first, nullptr};
|
||||
// Obtain the output, out will be nullptr if get again immediately.
|
||||
output = Object::Cast<ObjMat2>(out);
|
||||
}
|
||||
VLOG(2) << "Rectify not ready now";
|
||||
} break;
|
||||
case Stream::RIGHT_RECTIFIED: {
|
||||
auto &&processor = find_processor<RectifyProcessor>(processor_);
|
||||
Object *out = processor->GetOutput();
|
||||
if (out != nullptr) {
|
||||
ObjMat2 *output = Object::Cast<ObjMat2>(out);
|
||||
if (output != nullptr) {
|
||||
if (stream == Stream::LEFT_RECTIFIED) {
|
||||
return {nullptr, output->first, nullptr};
|
||||
} else {
|
||||
return {nullptr, output->second, nullptr};
|
||||
}
|
||||
}
|
||||
VLOG(2) << "Rectify not ready now";
|
||||
} break;
|
||||
return {};
|
||||
}
|
||||
switch (stream) {
|
||||
case Stream::DISPARITY: {
|
||||
auto &&processor = find_processor<DisparityProcessor>(processor_);
|
||||
Object *out = processor->GetOutput();
|
||||
auto &&out = processor->GetOutput();
|
||||
if (out != nullptr) {
|
||||
ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
auto &&output = Object::Cast<ObjMat>(out);
|
||||
return {nullptr, output->value, nullptr};
|
||||
}
|
||||
VLOG(2) << "Disparity not ready now";
|
||||
@@ -177,27 +186,27 @@ api::StreamData Synthetic::GetStreamData(const Stream &stream) {
|
||||
case Stream::DISPARITY_NORMALIZED: {
|
||||
auto &&processor =
|
||||
find_processor<DisparityNormalizedProcessor>(processor_);
|
||||
Object *out = processor->GetOutput();
|
||||
auto &&out = processor->GetOutput();
|
||||
if (out != nullptr) {
|
||||
ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
auto &&output = Object::Cast<ObjMat>(out);
|
||||
return {nullptr, output->value, nullptr};
|
||||
}
|
||||
VLOG(2) << "Disparity normalized not ready now";
|
||||
} break;
|
||||
case Stream::POINTS: {
|
||||
auto &&processor = find_processor<PointsProcessor>(processor_);
|
||||
Object *out = processor->GetOutput();
|
||||
auto &&out = processor->GetOutput();
|
||||
if (out != nullptr) {
|
||||
ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
auto &&output = Object::Cast<ObjMat>(out);
|
||||
return {nullptr, output->value, nullptr};
|
||||
}
|
||||
VLOG(2) << "Points not ready now";
|
||||
} break;
|
||||
case Stream::DEPTH: {
|
||||
auto &&processor = find_processor<DepthProcessor>(processor_);
|
||||
Object *out = processor->GetOutput();
|
||||
auto &&out = processor->GetOutput();
|
||||
if (out != nullptr) {
|
||||
ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
auto &&output = Object::Cast<ObjMat>(out);
|
||||
return {nullptr, output->value, nullptr};
|
||||
}
|
||||
VLOG(2) << "Depth not ready now";
|
||||
@@ -437,60 +446,50 @@ void Synthetic::InitProcessors() {
|
||||
|
||||
void Synthetic::ProcessNativeStream(
|
||||
const Stream &stream, const api::StreamData &data) {
|
||||
bool done = false;
|
||||
if (stream == Stream::LEFT || stream == Stream::RIGHT) {
|
||||
static api::StreamData left_data, right_data;
|
||||
if (stream == Stream::LEFT) {
|
||||
left_data = data;
|
||||
done = true;
|
||||
} else if (stream == Stream::RIGHT) {
|
||||
right_data = data;
|
||||
done = true;
|
||||
}
|
||||
if (done && left_data.img && right_data.img &&
|
||||
if (left_data.img && right_data.img &&
|
||||
left_data.img->frame_id == right_data.img->frame_id) {
|
||||
auto &&processor = find_processor<RectifyProcessor>(processor_);
|
||||
processor->Process(ObjMat2{left_data.frame, right_data.frame});
|
||||
}
|
||||
if (done)
|
||||
return;
|
||||
|
||||
auto &&process_childs = [this, &stream](
|
||||
const std::string &name, const Object &obj) {
|
||||
auto &&processor = find_processor<Processor>(processor_, name);
|
||||
for (auto child : processor->GetChilds()) {
|
||||
child->Process(obj);
|
||||
}
|
||||
};
|
||||
|
||||
if (stream == Stream::LEFT_RECTIFIED || stream == Stream::RIGHT_RECTIFIED) {
|
||||
static api::StreamData left_rect_data, right_rect_data;
|
||||
if (stream == Stream::LEFT_RECTIFIED) {
|
||||
left_rect_data = data;
|
||||
done = true;
|
||||
} else if (stream == Stream::RIGHT_RECTIFIED) {
|
||||
right_rect_data = data;
|
||||
done = true;
|
||||
}
|
||||
if (done && left_rect_data.img && right_rect_data.img &&
|
||||
if (left_rect_data.img && right_rect_data.img &&
|
||||
left_rect_data.img->frame_id == right_rect_data.img->frame_id) {
|
||||
process_childs(
|
||||
RectifyProcessor::NAME,
|
||||
processor_, RectifyProcessor::NAME,
|
||||
ObjMat2{left_rect_data.frame, right_rect_data.frame});
|
||||
}
|
||||
if (done)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (stream) {
|
||||
case Stream::DISPARITY: {
|
||||
process_childs(DisparityProcessor::NAME, ObjMat{data.frame});
|
||||
process_childs(processor_, DisparityProcessor::NAME, ObjMat{data.frame});
|
||||
} break;
|
||||
case Stream::DISPARITY_NORMALIZED: {
|
||||
process_childs(DisparityNormalizedProcessor::NAME, ObjMat{data.frame});
|
||||
process_childs(
|
||||
processor_, DisparityNormalizedProcessor::NAME, ObjMat{data.frame});
|
||||
} break;
|
||||
case Stream::POINTS: {
|
||||
process_childs(PointsProcessor::NAME, ObjMat{data.frame});
|
||||
process_childs(processor_, PointsProcessor::NAME, ObjMat{data.frame});
|
||||
} break;
|
||||
case Stream::DEPTH: {
|
||||
process_childs(DepthProcessor::NAME, ObjMat{data.frame});
|
||||
process_childs(processor_, DepthProcessor::NAME, ObjMat{data.frame});
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
@@ -54,6 +55,27 @@ struct DeviceModel {
|
||||
}
|
||||
};
|
||||
|
||||
bool CheckSupports(
|
||||
const Device *const device, const Stream &stream, bool fatal = true) {
|
||||
if (device->Supports(stream)) {
|
||||
return true;
|
||||
} else {
|
||||
auto &&supports = stream_supports_map.at(device->GetModel());
|
||||
std::ostringstream ss;
|
||||
std::copy(
|
||||
supports.begin(), supports.end(),
|
||||
std::ostream_iterator<Stream>(ss, ", "));
|
||||
if (fatal) {
|
||||
LOG(FATAL) << "Unsupported stream: " << stream
|
||||
<< ". Please use these: " << ss.str();
|
||||
} else {
|
||||
LOG(WARNING) << "Unsupported stream: " << stream
|
||||
<< ". Please use these: " << ss.str();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Device::Device(const Model &model, std::shared_ptr<uvc::device> device)
|
||||
@@ -176,21 +198,47 @@ std::string Device::GetInfo(const Info &info) const {
|
||||
}
|
||||
|
||||
Intrinsics Device::GetIntrinsics(const Stream &stream) const {
|
||||
bool ok;
|
||||
return GetIntrinsics(stream, &ok);
|
||||
}
|
||||
|
||||
Extrinsics Device::GetExtrinsics(const Stream &from, const Stream &to) const {
|
||||
bool ok;
|
||||
return GetExtrinsics(from, to, &ok);
|
||||
}
|
||||
|
||||
MotionIntrinsics Device::GetMotionIntrinsics() const {
|
||||
bool ok;
|
||||
return GetMotionIntrinsics(&ok);
|
||||
}
|
||||
|
||||
Extrinsics Device::GetMotionExtrinsics(const Stream &from) const {
|
||||
bool ok;
|
||||
return GetMotionExtrinsics(from, &ok);
|
||||
}
|
||||
|
||||
Intrinsics Device::GetIntrinsics(const Stream &stream, bool *ok) const {
|
||||
try {
|
||||
*ok = true;
|
||||
return stream_intrinsics_.at(stream);
|
||||
} catch (const std::out_of_range &e) {
|
||||
*ok = false;
|
||||
LOG(WARNING) << "Intrinsics of " << stream << " not found";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Extrinsics Device::GetExtrinsics(const Stream &from, const Stream &to) const {
|
||||
Extrinsics Device::GetExtrinsics(
|
||||
const Stream &from, const Stream &to, bool *ok) const {
|
||||
try {
|
||||
*ok = true;
|
||||
return stream_from_extrinsics_.at(from).at(to);
|
||||
} catch (const std::out_of_range &e) {
|
||||
try {
|
||||
*ok = true;
|
||||
return stream_from_extrinsics_.at(to).at(from).Inverse();
|
||||
} catch (const std::out_of_range &e) {
|
||||
*ok = false;
|
||||
LOG(WARNING) << "Extrinsics from " << from << " to " << to
|
||||
<< " not found";
|
||||
return {};
|
||||
@@ -198,19 +246,23 @@ Extrinsics Device::GetExtrinsics(const Stream &from, const Stream &to) const {
|
||||
}
|
||||
}
|
||||
|
||||
MotionIntrinsics Device::GetMotionIntrinsics() const {
|
||||
MotionIntrinsics Device::GetMotionIntrinsics(bool *ok) const {
|
||||
if (motion_intrinsics_) {
|
||||
*ok = true;
|
||||
return *motion_intrinsics_;
|
||||
} else {
|
||||
*ok = false;
|
||||
LOG(WARNING) << "Motion intrinsics not found";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Extrinsics Device::GetMotionExtrinsics(const Stream &from) const {
|
||||
Extrinsics Device::GetMotionExtrinsics(const Stream &from, bool *ok) const {
|
||||
try {
|
||||
*ok = true;
|
||||
return motion_from_extrinsics_.at(from);
|
||||
} catch (const std::out_of_range &e) {
|
||||
*ok = false;
|
||||
LOG(WARNING) << "Motion extrinsics from " << from << " not found";
|
||||
return {};
|
||||
}
|
||||
@@ -275,8 +327,7 @@ bool Device::RunOptionAction(const Option &option) const {
|
||||
|
||||
void Device::SetStreamCallback(
|
||||
const Stream &stream, stream_callback_t callback, bool async) {
|
||||
if (!Supports(stream)) {
|
||||
LOG(WARNING) << "Unsupported stream: " << stream;
|
||||
if (!CheckSupports(this, stream, false)) {
|
||||
return;
|
||||
}
|
||||
if (callback) {
|
||||
@@ -284,7 +335,7 @@ void Device::SetStreamCallback(
|
||||
if (async)
|
||||
stream_async_callbacks_[stream] =
|
||||
std::make_shared<stream_async_callback_t>(
|
||||
to_string(stream), callback);
|
||||
to_string(stream), callback); // max_data_size = 1
|
||||
} else {
|
||||
stream_callbacks_.erase(stream);
|
||||
stream_async_callbacks_.erase(stream);
|
||||
@@ -296,7 +347,8 @@ void Device::SetMotionCallback(motion_callback_t callback, bool async) {
|
||||
if (callback) {
|
||||
if (async)
|
||||
motion_async_callback_ =
|
||||
std::make_shared<motion_async_callback_t>("motion", callback, true);
|
||||
std::make_shared<motion_async_callback_t>("motion", callback, 1000);
|
||||
// will drop old motion datas after callback cost > 2 s (1000 / 500 Hz)
|
||||
} else {
|
||||
motion_async_callback_ = nullptr;
|
||||
}
|
||||
@@ -351,6 +403,7 @@ void Device::WaitForStreams() {
|
||||
std::vector<device::StreamData> Device::GetStreamDatas(const Stream &stream) {
|
||||
CHECK(video_streaming_);
|
||||
CHECK_NOTNULL(streams_);
|
||||
CheckSupports(this, stream);
|
||||
std::lock_guard<std::mutex> _(mtx_streams_);
|
||||
return streams_->GetStreamDatas(stream);
|
||||
}
|
||||
@@ -358,6 +411,7 @@ std::vector<device::StreamData> Device::GetStreamDatas(const Stream &stream) {
|
||||
device::StreamData Device::GetLatestStreamData(const Stream &stream) {
|
||||
CHECK(video_streaming_);
|
||||
CHECK_NOTNULL(streams_);
|
||||
CheckSupports(this, stream);
|
||||
std::lock_guard<std::mutex> _(mtx_streams_);
|
||||
return streams_->GetLatestStreamData(stream);
|
||||
}
|
||||
@@ -488,8 +542,13 @@ void Device::ReadAllInfos() {
|
||||
Channels::img_params_t img_params;
|
||||
Channels::imu_params_t imu_params;
|
||||
if (!channels_->GetFiles(device_info_.get(), &img_params, &imu_params)) {
|
||||
LOG(FATAL) << "Read device infos failed. Please upgrade your firmware to "
|
||||
"the latest version.";
|
||||
#if defined(WITH_DEVICE_INFO_REQUIRED)
|
||||
LOG(FATAL)
|
||||
#else
|
||||
LOG(WARNING)
|
||||
#endif
|
||||
<< "Read device infos failed. Please upgrade your firmware to the "
|
||||
"latest version.";
|
||||
}
|
||||
VLOG(2) << "Device info: {name: " << device_info_->name
|
||||
<< ", serial_number: " << device_info_->serial_number
|
||||
@@ -506,11 +565,11 @@ void Device::ReadAllInfos() {
|
||||
if (img_params.ok) {
|
||||
SetIntrinsics(Stream::LEFT, img_params.in_left);
|
||||
SetIntrinsics(Stream::RIGHT, img_params.in_right);
|
||||
SetExtrinsics(Stream::LEFT, Stream::RIGHT, img_params.ex_left_to_right);
|
||||
SetExtrinsics(Stream::RIGHT, Stream::LEFT, img_params.ex_right_to_left);
|
||||
VLOG(2) << "Intrinsics left: {" << GetIntrinsics(Stream::LEFT) << "}";
|
||||
VLOG(2) << "Intrinsics right: {" << GetIntrinsics(Stream::RIGHT) << "}";
|
||||
VLOG(2) << "Extrinsics left to right: {"
|
||||
<< GetExtrinsics(Stream::LEFT, Stream::RIGHT) << "}";
|
||||
VLOG(2) << "Extrinsics right to left: {"
|
||||
<< GetExtrinsics(Stream::RIGHT, Stream::LEFT) << "}";
|
||||
} else {
|
||||
LOG(WARNING) << "Intrinsics & extrinsics not exist";
|
||||
}
|
||||
|
||||
@@ -140,6 +140,24 @@ class MYNTEYE_API Device {
|
||||
*/
|
||||
Extrinsics GetMotionExtrinsics(const Stream &from) const;
|
||||
|
||||
/**
|
||||
* Get the intrinsics of stream.
|
||||
*/
|
||||
Intrinsics GetIntrinsics(const Stream &stream, bool *ok) const;
|
||||
/**
|
||||
* Get the extrinsics from one stream to another.
|
||||
*/
|
||||
Extrinsics GetExtrinsics(
|
||||
const Stream &from, const Stream &to, bool *ok) const;
|
||||
/**
|
||||
* Get the intrinsics of motion.
|
||||
*/
|
||||
MotionIntrinsics GetMotionIntrinsics(bool *ok) const;
|
||||
/**
|
||||
* Get the extrinsics from one stream to motion.
|
||||
*/
|
||||
Extrinsics GetMotionExtrinsics(const Stream &from, bool *ok) const;
|
||||
|
||||
/**
|
||||
* Set the intrinsics of stream.
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,8 @@ class AsyncCallback {
|
||||
public:
|
||||
using callback_t = std::function<void(Data data)>;
|
||||
|
||||
AsyncCallback(std::string name, callback_t callback, bool concat = false);
|
||||
AsyncCallback(
|
||||
std::string name, callback_t callback, std::size_t max_data_size = 0);
|
||||
~AsyncCallback();
|
||||
|
||||
void PushData(Data data);
|
||||
@@ -50,8 +51,8 @@ class AsyncCallback {
|
||||
std::thread thread_;
|
||||
|
||||
std::uint32_t count_;
|
||||
bool concat_;
|
||||
std::vector<Data> datas_;
|
||||
std::size_t max_data_size_;
|
||||
};
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
@@ -24,11 +24,11 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
template <class Data>
|
||||
AsyncCallback<Data>::AsyncCallback(
|
||||
std::string name, callback_t callback, bool concat)
|
||||
std::string name, callback_t callback, std::size_t max_data_size)
|
||||
: name_(std::move(name)),
|
||||
callback_(std::move(callback)),
|
||||
count_(0),
|
||||
concat_(concat) {
|
||||
max_data_size_(max_data_size) {
|
||||
VLOG(2) << __func__;
|
||||
running_ = true;
|
||||
thread_ = std::thread(&AsyncCallback<Data>::Run, this);
|
||||
@@ -51,8 +51,10 @@ AsyncCallback<Data>::~AsyncCallback() {
|
||||
template <class Data>
|
||||
void AsyncCallback<Data>::PushData(Data data) {
|
||||
std::lock_guard<std::mutex> _(mtx_);
|
||||
if (!concat_) {
|
||||
if (max_data_size_ <= 0) {
|
||||
datas_.clear();
|
||||
} else if (max_data_size_ == datas_.size()) { // >= 1
|
||||
datas_.erase(datas_.begin());
|
||||
}
|
||||
datas_.push_back(data);
|
||||
++count_;
|
||||
|
||||
@@ -224,7 +224,7 @@ void Channels::SetControlValue(const Option &option, std::int32_t value) {
|
||||
} break;
|
||||
case Option::FRAME_RATE: {
|
||||
if (!in_range() ||
|
||||
!in_values({10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60}))
|
||||
!in_values({10, 15, 20, 25, 30, 35, 40, 45, 50, 55}))
|
||||
break;
|
||||
XuCamCtrlSet(option, value);
|
||||
} break;
|
||||
@@ -515,7 +515,7 @@ std::size_t from_data(
|
||||
std::size_t i = 0;
|
||||
i += from_data(&img_params->in_left, data + i, spec_version);
|
||||
i += from_data(&img_params->in_right, data + i, spec_version);
|
||||
i += from_data(&img_params->ex_left_to_right, data + i, spec_version);
|
||||
i += from_data(&img_params->ex_right_to_left, data + i, spec_version);
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -787,7 +787,7 @@ std::size_t to_data(
|
||||
std::size_t i = 3; // skip id, size
|
||||
i += to_data(&img_params->in_left, data + i, spec_version);
|
||||
i += to_data(&img_params->in_right, data + i, spec_version);
|
||||
i += to_data(&img_params->ex_left_to_right, data + i, spec_version);
|
||||
i += to_data(&img_params->ex_right_to_left, data + i, spec_version);
|
||||
// others
|
||||
std::size_t size = i - 3;
|
||||
data[0] = Channels::FID_IMG_PARAMS;
|
||||
|
||||
@@ -72,7 +72,7 @@ class MYNTEYE_API Channels {
|
||||
bool ok;
|
||||
Intrinsics in_left;
|
||||
Intrinsics in_right;
|
||||
Extrinsics ex_left_to_right;
|
||||
Extrinsics ex_right_to_left;
|
||||
} img_params_t;
|
||||
|
||||
typedef struct ImuParams {
|
||||
|
||||
@@ -36,8 +36,9 @@ std::shared_ptr<Device> select() {
|
||||
LOG(INFO) << "MYNT EYE devices:";
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
auto &&device = devices[i];
|
||||
auto &&name = device->GetInfo(Info::DEVICE_NAME);
|
||||
LOG(INFO) << " index: " << i << ", name: " << name;
|
||||
LOG(INFO) << " index: " << i
|
||||
<< ", name: " << device->GetInfo(Info::DEVICE_NAME)
|
||||
<< ", sn: " << device->GetInfo(Info::SERIAL_NUMBER);
|
||||
}
|
||||
|
||||
std::shared_ptr<Device> device = nullptr;
|
||||
@@ -99,9 +100,6 @@ float get_real_exposure_time(
|
||||
case 55:
|
||||
real_max = 16.325;
|
||||
break;
|
||||
case 60:
|
||||
real_max = 15;
|
||||
break;
|
||||
default:
|
||||
LOG(ERROR) << "Invalid frame rate: " << frame_rate;
|
||||
return exposure_time;
|
||||
|
||||
2
third_party/glog
vendored
2
third_party/glog
vendored
Submodule third_party/glog updated: a97d6b0e1c...8d7a107d68
@@ -22,7 +22,7 @@ in_right:
|
||||
model: 0
|
||||
coeffs: [ -5.1012886039889305e-01, 3.8764476500996770e-01, 0., 0.,
|
||||
0. ]
|
||||
ex_left_to_right:
|
||||
ex_right_to_left:
|
||||
rotation: [ 9.9701893306553813e-01, -9.5378124886236681e-04,
|
||||
-7.7151392794850615e-02, 1.4493996762830500e-03,
|
||||
9.9997867219985104e-01, 6.3682325649414354e-03,
|
||||
|
||||
@@ -72,7 +72,7 @@ bool DeviceWriter::WriteImgParams(const img_params_t ¶ms) {
|
||||
LOG(INFO) << "Write img params success";
|
||||
LOG(INFO) << "Intrinsics left: {" << params.in_left << "}";
|
||||
LOG(INFO) << "Intrinsics right: {" << params.in_right << "}";
|
||||
LOG(INFO) << "Extrinsics left to right: {" << params.ex_left_to_right
|
||||
LOG(INFO) << "Extrinsics right to left: {" << params.ex_right_to_left
|
||||
<< "}";
|
||||
return true;
|
||||
} else {
|
||||
@@ -185,8 +185,8 @@ bool DeviceWriter::SaveImgParams(
|
||||
return false;
|
||||
}
|
||||
fs << "in_left" << std::vector<Intrinsics>{params.in_left} << "in_right"
|
||||
<< std::vector<Intrinsics>{params.in_right} << "ex_left_to_right"
|
||||
<< params.ex_left_to_right;
|
||||
<< std::vector<Intrinsics>{params.in_right} << "ex_right_to_left"
|
||||
<< params.ex_right_to_left;
|
||||
fs.release();
|
||||
return true;
|
||||
}
|
||||
@@ -213,7 +213,7 @@ void DeviceWriter::SaveAllInfos(const std::string &dir) {
|
||||
SaveImgParams(
|
||||
{false, device_->GetIntrinsics(Stream::LEFT),
|
||||
device_->GetIntrinsics(Stream::RIGHT),
|
||||
device_->GetExtrinsics(Stream::LEFT, Stream::RIGHT)},
|
||||
device_->GetExtrinsics(Stream::RIGHT, Stream::LEFT)},
|
||||
dir + OS_SEP "img.params");
|
||||
auto &&m_in = device_->GetMotionIntrinsics();
|
||||
SaveImuParams(
|
||||
@@ -311,8 +311,8 @@ DeviceWriter::dev_info_t DeviceWriter::LoadDeviceInfo(
|
||||
LOG(FATAL) << "Failed to load file: " << filepath;
|
||||
}
|
||||
DeviceInfo info;
|
||||
info.lens_type = Type(fs["lens_type"].string());
|
||||
info.imu_type = Type(fs["imu_type"].string());
|
||||
info.lens_type = Type(std::string(fs["lens_type"]));
|
||||
info.imu_type = Type(std::string(fs["imu_type"]));
|
||||
fs["nominal_baseline"] >> info.nominal_baseline;
|
||||
fs.release();
|
||||
return info;
|
||||
@@ -348,11 +348,11 @@ DeviceWriter::img_params_t DeviceWriter::LoadImgParams(
|
||||
|
||||
to_intrinsics(w, h, m, M1, D1, ¶ms.in_left);
|
||||
to_intrinsics(w, h, m, M2, D2, ¶ms.in_right);
|
||||
to_extrinsics(R, T, ¶ms.ex_left_to_right);
|
||||
to_extrinsics(R, T, ¶ms.ex_right_to_left);
|
||||
} else {
|
||||
fs["in_left"][0] >> params.in_left;
|
||||
fs["in_right"][0] >> params.in_right;
|
||||
fs["ex_left_to_right"] >> params.ex_left_to_right;
|
||||
fs["ex_right_to_left"] >> params.ex_right_to_left;
|
||||
}
|
||||
|
||||
fs.release();
|
||||
|
||||
@@ -99,7 +99,7 @@ def main():
|
||||
# set_option_value
|
||||
|
||||
def set_rate(frame_rate=25, imu_frequency=500): # pylint: disable=unused-variable
|
||||
# FRAME_RATE values: 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60
|
||||
# FRAME_RATE values: 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
|
||||
api.set_option_value(mynteye.FRAME_RATE, frame_rate)
|
||||
# IMU_FREQUENCY values: 100, 200, 250, 333, 500
|
||||
api.set_option_value(mynteye.IMU_FREQUENCY, imu_frequency)
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<arg name="contrast" default="-1" />
|
||||
<!-- <arg name="contrast" default="127" /> -->
|
||||
|
||||
<!-- frame_rate range: {10,15,20,25,30,35,40,45,50,55,60} -->
|
||||
<!-- frame_rate range: {10,15,20,25,30,35,40,45,50,55} -->
|
||||
<arg name="frame_rate" default="-1" />
|
||||
<!-- <arg name="frame_rate" default="25" /> -->
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ Visualization Manager:
|
||||
Min Value: 0
|
||||
Name: Left
|
||||
Normalize Range: true
|
||||
Queue Size: 2
|
||||
Queue Size: 1
|
||||
Transport Hint: raw
|
||||
Unreliable: false
|
||||
Value: true
|
||||
@@ -73,7 +73,7 @@ Visualization Manager:
|
||||
Min Value: 0
|
||||
Name: Right
|
||||
Normalize Range: true
|
||||
Queue Size: 2
|
||||
Queue Size: 1
|
||||
Transport Hint: raw
|
||||
Unreliable: false
|
||||
Value: true
|
||||
@@ -87,7 +87,7 @@ Visualization Manager:
|
||||
Min Value: 0
|
||||
Name: LeftRect
|
||||
Normalize Range: true
|
||||
Queue Size: 2
|
||||
Queue Size: 1
|
||||
Transport Hint: raw
|
||||
Unreliable: false
|
||||
Value: true
|
||||
@@ -99,7 +99,7 @@ Visualization Manager:
|
||||
Min Value: 0
|
||||
Name: RightRect
|
||||
Normalize Range: true
|
||||
Queue Size: 2
|
||||
Queue Size: 1
|
||||
Transport Hint: raw
|
||||
Unreliable: false
|
||||
Value: true
|
||||
@@ -117,7 +117,7 @@ Visualization Manager:
|
||||
Min Value: 0
|
||||
Name: Disparity
|
||||
Normalize Range: true
|
||||
Queue Size: 2
|
||||
Queue Size: 1
|
||||
Transport Hint: raw
|
||||
Unreliable: false
|
||||
Value: true
|
||||
@@ -129,7 +129,7 @@ Visualization Manager:
|
||||
Min Value: 0
|
||||
Name: DisparityNorm
|
||||
Normalize Range: true
|
||||
Queue Size: 2
|
||||
Queue Size: 1
|
||||
Transport Hint: raw
|
||||
Unreliable: false
|
||||
Value: true
|
||||
@@ -143,7 +143,7 @@ Visualization Manager:
|
||||
Min Value: 0
|
||||
Name: Depth
|
||||
Normalize Range: true
|
||||
Queue Size: 2
|
||||
Queue Size: 1
|
||||
Transport Hint: raw
|
||||
Unreliable: false
|
||||
Value: true
|
||||
@@ -167,7 +167,7 @@ Visualization Manager:
|
||||
Min Intensity: 0
|
||||
Name: Points
|
||||
Position Transformer: XYZ
|
||||
Queue Size: 10
|
||||
Queue Size: 1
|
||||
Selectable: true
|
||||
Size (Pixels): 3
|
||||
Size (m): 0.00999999978
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <tf/tf.h>
|
||||
#include <tf2_ros/static_transform_broadcaster.h>
|
||||
|
||||
#include <opencv2/calib3d/calib3d.hpp>
|
||||
|
||||
#include <mynt_eye_ros_wrapper/GetInfo.h>
|
||||
#include <mynt_eye_ros_wrapper/Temp.h>
|
||||
|
||||
@@ -71,6 +73,20 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
}
|
||||
}
|
||||
|
||||
ros::Time hardTimeToSoftTime(double _hard_time) {
|
||||
static bool isInited = false;
|
||||
static double soft_time_begin(0), hard_time_begin(0);
|
||||
|
||||
if (false == isInited) {
|
||||
soft_time_begin = ros::Time::now().toSec();
|
||||
hard_time_begin = _hard_time;
|
||||
isInited = true;
|
||||
}
|
||||
|
||||
return ros::Time(
|
||||
soft_time_begin + (_hard_time - hard_time_begin) * 0.00001f);
|
||||
}
|
||||
|
||||
void onInit() override {
|
||||
initDevice();
|
||||
NODELET_FATAL_COND(api_ == nullptr, "No MYNT EYE device selected :(");
|
||||
@@ -94,7 +110,12 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
for (auto &&it = stream_names.begin(); it != stream_names.end(); ++it) {
|
||||
stream_topics[it->first] = it->second;
|
||||
private_nh_.getParam(it->second + "_topic", stream_topics[it->first]);
|
||||
|
||||
// if published init
|
||||
is_published_[it->first] = false;
|
||||
}
|
||||
is_motion_published_ = false;
|
||||
is_started_ = false;
|
||||
|
||||
std::string imu_topic = "imu";
|
||||
std::string temp_topic = "temp";
|
||||
@@ -150,20 +171,17 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
|
||||
for (auto &&it = stream_names.begin(); it != stream_names.end(); ++it) {
|
||||
auto &&topic = stream_topics[it->first];
|
||||
if (it->first == Stream::LEFT || it->first == Stream::RIGHT) { // camera
|
||||
camera_publishers_[it->first] = it_mynteye.advertiseCamera(topic, 1);
|
||||
} else if (it->first == Stream::POINTS) { // pointcloud
|
||||
if (it->first == Stream::POINTS) { // pointcloud
|
||||
points_publisher_ = nh_.advertise<sensor_msgs::PointCloud2>(topic, 1);
|
||||
} else { // image
|
||||
image_publishers_[it->first] = it_mynteye.advertise(topic, 1);
|
||||
} else { // camera
|
||||
camera_publishers_[it->first] = it_mynteye.advertiseCamera(topic, 1);
|
||||
}
|
||||
NODELET_INFO_STREAM("Advertized on topic " << topic);
|
||||
}
|
||||
|
||||
camera_encodings_ = {{Stream::LEFT, enc::MONO8},
|
||||
{Stream::RIGHT, enc::MONO8}};
|
||||
|
||||
image_encodings_ = {{Stream::LEFT_RECTIFIED, enc::MONO8},
|
||||
{Stream::RIGHT, enc::MONO8},
|
||||
{Stream::LEFT_RECTIFIED, enc::MONO8},
|
||||
{Stream::RIGHT_RECTIFIED, enc::MONO8},
|
||||
{Stream::DISPARITY, enc::MONO8}, // float
|
||||
{Stream::DISPARITY_NORMALIZED, enc::MONO8},
|
||||
@@ -178,9 +196,9 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
// stream toggles
|
||||
|
||||
for (auto &&it = stream_names.begin(); it != stream_names.end(); ++it) {
|
||||
if (it->first == Stream::LEFT || it->first == Stream::RIGHT) { // camera
|
||||
continue;
|
||||
} else { // image, pointcloud
|
||||
if (it->first == Stream::LEFT || it->first == Stream::RIGHT) {
|
||||
continue; // native streams
|
||||
} else {
|
||||
if (!api_->Supports(it->first))
|
||||
continue;
|
||||
bool enabled = false;
|
||||
@@ -200,8 +218,10 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
NODELET_INFO_STREAM("Advertized service " << DEVICE_INFO_SERVICE);
|
||||
|
||||
publishStaticTransforms();
|
||||
while (private_nh_.ok()) {
|
||||
publishTopics();
|
||||
}
|
||||
}
|
||||
|
||||
bool getInfo(
|
||||
mynt_eye_ros_wrapper::GetInfo::Request &req, // NOLINT
|
||||
@@ -240,12 +260,11 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
}
|
||||
|
||||
void publishTopics() {
|
||||
if (camera_publishers_[Stream::LEFT].getNumSubscribers() > 0 &&
|
||||
!is_published_[Stream::LEFT]) {
|
||||
api_->SetStreamCallback(
|
||||
Stream::LEFT, [this](const api::StreamData &data) {
|
||||
static double ros_time_beg = ros::Time::now().toSec();
|
||||
static double img_time_beg = data.img->timestamp;
|
||||
ros::Time stamp(
|
||||
ros_time_beg + (data.img->timestamp - img_time_beg) * 0.00001f);
|
||||
ros::Time stamp = hardTimeToSoftTime(data.img->timestamp);
|
||||
|
||||
// static double img_time_prev = -1;
|
||||
// NODELET_INFO_STREAM("ros_time_beg: " << FULL_PRECISION <<
|
||||
@@ -254,7 +273,8 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
// << ((data.img->timestamp - img_time_beg) * 0.00001f)
|
||||
// << ", img_time_diff: " << FULL_PRECISION
|
||||
// << ((img_time_prev < 0) ? 0
|
||||
// : (data.img->timestamp - img_time_prev) * 0.01f) << " ms");
|
||||
// : (data.img->timestamp - img_time_prev) * 0.01f) << "
|
||||
// ms");
|
||||
// img_time_prev = data.img->timestamp;
|
||||
|
||||
++left_count_;
|
||||
@@ -265,51 +285,63 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
<< ", timestamp: " << data.img->timestamp
|
||||
<< ", exposure_time: " << data.img->exposure_time);
|
||||
});
|
||||
is_published_[Stream::LEFT] = true;
|
||||
}
|
||||
|
||||
if (camera_publishers_[Stream::RIGHT].getNumSubscribers() > 0 &&
|
||||
!is_published_[Stream::RIGHT]) {
|
||||
api_->SetStreamCallback(
|
||||
Stream::RIGHT, [this](const api::StreamData &data) {
|
||||
static double ros_time_beg = ros::Time::now().toSec();
|
||||
static double img_time_beg = data.img->timestamp;
|
||||
ros::Time stamp(
|
||||
ros_time_beg + (data.img->timestamp - img_time_beg) * 0.00001f);
|
||||
ros::Time stamp = hardTimeToSoftTime(data.img->timestamp);
|
||||
|
||||
++right_count_;
|
||||
publishCamera(Stream::RIGHT, data, right_count_, stamp);
|
||||
NODELET_DEBUG_STREAM(
|
||||
Stream::RIGHT << ", count: " << right_count_
|
||||
<< ", frame_id: " << data.img->frame_id
|
||||
<< ", timestamp: " << data.img->timestamp
|
||||
Stream::RIGHT
|
||||
<< ", count: " << right_count_ << ", frame_id: "
|
||||
<< data.img->frame_id << ", timestamp: " << data.img->timestamp
|
||||
<< ", exposure_time: " << data.img->exposure_time);
|
||||
});
|
||||
is_published_[Stream::RIGHT] = true;
|
||||
}
|
||||
|
||||
std::vector<Stream> image_streams{
|
||||
std::vector<Stream> other_streams{
|
||||
Stream::LEFT_RECTIFIED, Stream::RIGHT_RECTIFIED, Stream::DISPARITY,
|
||||
Stream::DISPARITY_NORMALIZED, Stream::DEPTH};
|
||||
|
||||
for (auto &&stream : image_streams) {
|
||||
for (auto &&stream : other_streams) {
|
||||
if (camera_publishers_[stream].getNumSubscribers() == 0 &&
|
||||
is_published_[stream]) {
|
||||
continue;
|
||||
}
|
||||
api_->SetStreamCallback(
|
||||
stream, [this, stream](const api::StreamData &data) {
|
||||
// data.img is null, not hard timestamp
|
||||
static std::size_t count = 0;
|
||||
++count;
|
||||
publishImage(stream, data, count, ros::Time::now());
|
||||
publishCamera(stream, data, count, ros::Time::now());
|
||||
});
|
||||
is_published_[stream] = true;
|
||||
}
|
||||
|
||||
if (camera_publishers_[Stream::POINTS].getNumSubscribers() > 0 &&
|
||||
!is_published_[Stream::POINTS]) {
|
||||
api_->SetStreamCallback(
|
||||
Stream::POINTS, [this](const api::StreamData &data) {
|
||||
static std::size_t count = 0;
|
||||
++count;
|
||||
publishPoints(data, count, ros::Time::now());
|
||||
});
|
||||
is_published_[Stream::POINTS] = true;
|
||||
}
|
||||
|
||||
if (!is_motion_published_) {
|
||||
api_->SetMotionCallback([this](const api::MotionData &data) {
|
||||
static double ros_time_beg = ros::Time::now().toSec();
|
||||
static double imu_time_beg = data.imu->timestamp;
|
||||
ros::Time stamp(
|
||||
ros_time_beg + (data.imu->timestamp - imu_time_beg) * 0.00001f);
|
||||
ros::Time stamp = hardTimeToSoftTime(data.imu->timestamp);
|
||||
|
||||
// static double imu_time_prev = -1;
|
||||
// NODELET_INFO_STREAM("ros_time_beg: " << FULL_PRECISION << ros_time_beg
|
||||
// NODELET_INFO_STREAM("ros_time_beg: " << FULL_PRECISION <<
|
||||
// ros_time_beg
|
||||
// << ", imu_time_elapsed: " << FULL_PRECISION
|
||||
// << ((data.imu->timestamp - imu_time_beg) * 0.00001f)
|
||||
// << ", imu_time_diff: " << FULL_PRECISION
|
||||
@@ -333,16 +365,21 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
// Sleep 1ms, otherwise publish may drop some datas.
|
||||
ros::Duration(0.001).sleep();
|
||||
});
|
||||
is_motion_published_ = true;
|
||||
}
|
||||
|
||||
time_beg_ = ros::Time::now().toSec();
|
||||
if (!is_started_) {
|
||||
api_->Start(Source::ALL);
|
||||
is_started_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void publishCamera(
|
||||
const Stream &stream, const api::StreamData &data, std::uint32_t seq,
|
||||
ros::Time stamp) {
|
||||
if (camera_publishers_[stream].getNumSubscribers() == 0)
|
||||
return;
|
||||
// if (camera_publishers_[stream].getNumSubscribers() == 0)
|
||||
// return;
|
||||
std_msgs::Header header;
|
||||
header.seq = seq;
|
||||
header.stamp = stamp;
|
||||
@@ -358,6 +395,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
camera_publishers_[stream].publish(msg, info);
|
||||
}
|
||||
|
||||
/*
|
||||
void publishImage(
|
||||
const Stream &stream, const api::StreamData &data, std::uint32_t seq,
|
||||
ros::Time stamp) {
|
||||
@@ -375,11 +413,12 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
cv_bridge::CvImage(header, image_encodings_[stream], img).toImageMsg();
|
||||
image_publishers_[stream].publish(msg);
|
||||
}
|
||||
*/
|
||||
|
||||
void publishPoints(
|
||||
const api::StreamData &data, std::uint32_t seq, ros::Time stamp) {
|
||||
if (points_publisher_.getNumSubscribers() == 0)
|
||||
return;
|
||||
// if (points_publisher_.getNumSubscribers() == 0)
|
||||
// return;
|
||||
|
||||
auto &&in = api_->GetIntrinsics(Stream::LEFT);
|
||||
|
||||
@@ -413,9 +452,9 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
for (std::size_t x = 0; x < in.width; ++x) {
|
||||
auto &&point = data.frame.at<cv::Vec3f>(y, x);
|
||||
|
||||
*iter_x = point[0];
|
||||
*iter_y = point[1];
|
||||
*iter_z = point[2];
|
||||
*iter_x = point[0] * 0.001;
|
||||
*iter_y = point[1] * 0.001;
|
||||
*iter_z = point[2] * 0.001;
|
||||
|
||||
*iter_r = static_cast<uint8_t>(255);
|
||||
*iter_g = static_cast<uint8_t>(255);
|
||||
@@ -529,6 +568,43 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
}
|
||||
|
||||
api_ = API::Create(device);
|
||||
|
||||
computeRectTransforms();
|
||||
}
|
||||
|
||||
void computeRectTransforms() {
|
||||
ROS_ASSERT(api_);
|
||||
auto &&in_left = api_->GetIntrinsics(Stream::LEFT);
|
||||
auto &&in_right = api_->GetIntrinsics(Stream::RIGHT);
|
||||
auto &&ex_right_to_left = api_->GetExtrinsics(Stream::RIGHT, Stream::LEFT);
|
||||
|
||||
cv::Size size{in_left.width, in_left.height};
|
||||
|
||||
cv::Mat M1 =
|
||||
(cv::Mat_<double>(3, 3) << in_left.fx, 0, in_left.cx, 0, in_left.fy,
|
||||
in_left.cy, 0, 0, 1);
|
||||
cv::Mat M2 =
|
||||
(cv::Mat_<double>(3, 3) << in_right.fx, 0, in_right.cx, 0, in_right.fy,
|
||||
in_right.cy, 0, 0, 1);
|
||||
cv::Mat D1(1, 5, CV_64F, in_left.coeffs);
|
||||
cv::Mat D2(1, 5, CV_64F, in_right.coeffs);
|
||||
cv::Mat R =
|
||||
(cv::Mat_<double>(3, 3) << ex_right_to_left.rotation[0][0],
|
||||
ex_right_to_left.rotation[0][1], ex_right_to_left.rotation[0][2],
|
||||
ex_right_to_left.rotation[1][0], ex_right_to_left.rotation[1][1],
|
||||
ex_right_to_left.rotation[1][2], ex_right_to_left.rotation[2][0],
|
||||
ex_right_to_left.rotation[2][1], ex_right_to_left.rotation[2][2]);
|
||||
cv::Mat T(3, 1, CV_64F, ex_right_to_left.translation);
|
||||
|
||||
cv::stereoRectify(
|
||||
M1, D1, M2, D2, size, R, T, left_r_, right_r_, left_p_, right_p_, q_,
|
||||
cv::CALIB_ZERO_DISPARITY, 0, size, &left_roi_, &right_roi_);
|
||||
|
||||
NODELET_DEBUG_STREAM("left_r: " << left_r_);
|
||||
NODELET_DEBUG_STREAM("right_r: " << right_r_);
|
||||
NODELET_DEBUG_STREAM("left_p: " << left_p_);
|
||||
NODELET_DEBUG_STREAM("right_p: " << right_p_);
|
||||
NODELET_DEBUG_STREAM("q: " << q_);
|
||||
}
|
||||
|
||||
sensor_msgs::CameraInfoPtr getCameraInfo(const Stream &stream) {
|
||||
@@ -536,10 +612,16 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
return camera_info_ptrs_[stream];
|
||||
}
|
||||
|
||||
// http://docs.ros.org/kinetic/api/sensor_msgs/html/msg/CameraInfo.html
|
||||
sensor_msgs::CameraInfo *camera_info = new sensor_msgs::CameraInfo();
|
||||
camera_info_ptrs_[stream] = sensor_msgs::CameraInfoPtr(camera_info);
|
||||
|
||||
auto &&in = api_->GetIntrinsics(stream);
|
||||
Intrinsics in;
|
||||
if (stream == Stream::RIGHT || stream == Stream::RIGHT_RECTIFIED) {
|
||||
in = api_->GetIntrinsics(Stream::RIGHT);
|
||||
} else {
|
||||
in = api_->GetIntrinsics(Stream::LEFT);
|
||||
}
|
||||
|
||||
camera_info->header.frame_id = frame_ids_[stream];
|
||||
camera_info->width = in.width;
|
||||
@@ -557,26 +639,14 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
// [fx' 0 cx' Tx]
|
||||
// P = [ 0 fy' cy' Ty]
|
||||
// [ 0 0 1 0]
|
||||
camera_info->P.at(0) = camera_info->K.at(0);
|
||||
camera_info->P.at(1) = 0;
|
||||
camera_info->P.at(2) = camera_info->K.at(2);
|
||||
camera_info->P.at(3) = 0;
|
||||
|
||||
camera_info->P.at(4) = 0;
|
||||
camera_info->P.at(5) = camera_info->K.at(4);
|
||||
camera_info->P.at(6) = camera_info->K.at(5);
|
||||
camera_info->P.at(7) = 0;
|
||||
|
||||
camera_info->P.at(8) = 0;
|
||||
camera_info->P.at(9) = 0;
|
||||
camera_info->P.at(10) = 1;
|
||||
camera_info->P.at(11) = 0;
|
||||
|
||||
if (stream == Stream::RIGHT) {
|
||||
auto &&ex = api_->GetExtrinsics(stream, Stream::LEFT);
|
||||
camera_info->P.at(3) = ex.translation[0];
|
||||
camera_info->P.at(7) = ex.translation[1];
|
||||
camera_info->P.at(11) = ex.translation[2];
|
||||
cv::Mat p = left_p_;
|
||||
if (stream == Stream::RIGHT || stream == Stream::RIGHT_RECTIFIED) {
|
||||
p = right_p_;
|
||||
}
|
||||
for (int i = 0; i < p.rows; i++) {
|
||||
for (int j = 0; j < p.cols; j++) {
|
||||
camera_info->P.at(i * p.cols + j) = p.at<double>(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
camera_info->distortion_model = "plumb_bob";
|
||||
@@ -754,16 +824,14 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
ros::NodeHandle nh_;
|
||||
ros::NodeHandle private_nh_;
|
||||
|
||||
// camera: LEFT, RIGHT
|
||||
// camera:
|
||||
// LEFT, RIGHT, LEFT_RECTIFIED, RIGHT_RECTIFIED,
|
||||
// DISPARITY, DISPARITY_NORMALIZED,
|
||||
// DEPTH
|
||||
std::map<Stream, image_transport::CameraPublisher> camera_publishers_;
|
||||
std::map<Stream, sensor_msgs::CameraInfoPtr> camera_info_ptrs_;
|
||||
std::map<Stream, std::string> camera_encodings_;
|
||||
|
||||
// image: LEFT_RECTIFIED, RIGHT_RECTIFIED, DISPARITY, DISPARITY_NORMALIZED,
|
||||
// DEPTH
|
||||
std::map<Stream, image_transport::Publisher> image_publishers_;
|
||||
std::map<Stream, std::string> image_encodings_;
|
||||
|
||||
// pointcloud: POINTS
|
||||
ros::Publisher points_publisher_;
|
||||
|
||||
@@ -787,10 +855,18 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
|
||||
std::shared_ptr<API> api_;
|
||||
|
||||
// rectification transforms
|
||||
cv::Mat left_r_, right_r_, left_p_, right_p_, q_;
|
||||
cv::Rect left_roi_, right_roi_;
|
||||
|
||||
double time_beg_ = -1;
|
||||
std::size_t left_count_ = 0;
|
||||
std::size_t right_count_ = 0;
|
||||
std::size_t imu_count_ = 0;
|
||||
|
||||
std::map<Stream, bool> is_published_;
|
||||
bool is_motion_published_;
|
||||
bool is_started_;
|
||||
};
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
Reference in New Issue
Block a user