Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
d5bdce4f75 | ||
|
|
7ed11b01ff | ||
|
|
9caf979d4c | ||
|
|
9b91304f0b | ||
|
|
0286da50c6 | ||
|
|
3e96e56d8b | ||
|
|
9451fdd90c | ||
|
|
9bb99499a2 | ||
|
|
ddb5cb46b7 | ||
|
|
0af640015b | ||
|
|
064b536822 | ||
|
|
209617dd24 | ||
|
|
ac88a68ebc | ||
|
|
ee6d9f5a3b | ||
|
|
09fb4c04df | ||
|
|
22ea971407 | ||
|
|
87458482d9 |
@@ -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,19 +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 "Found boost filesystem: ${Boost_VERSION}")
|
||||
#message(STATUS " Boost_LIBRARIES: ${Boost_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
LIST(APPEND CMAKE_MODULE_PATH cmake)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
@@ -72,8 +59,13 @@ set(MYNTEYE_NAME ${PROJECT_NAME})
|
||||
set(MYNTEYE_NAMESPACE "mynteye")
|
||||
message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}")
|
||||
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" MYNTEYE_SDK_ROOT_DIR)
|
||||
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" MYNTEYE_SDK_INSTALL_DIR)
|
||||
if(MSVC)
|
||||
string(REPLACE "/" "\\\\" MYNTEYE_SDK_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
string(REPLACE "/" "\\\\" MYNTEYE_SDK_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||
else()
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" MYNTEYE_SDK_ROOT_DIR)
|
||||
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" MYNTEYE_SDK_INSTALL_DIR)
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
include/mynteye/mynteye.h.in
|
||||
@@ -243,7 +235,23 @@ install(EXPORT ${MYNTEYE_NAME}-targets
|
||||
DESTINATION ${MYNTEYE_CMAKE_INSTALLDIR}
|
||||
)
|
||||
|
||||
find_package(CUDA QUIET)
|
||||
## build.info
|
||||
|
||||
# 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)
|
||||
set_default_value(CMAKE_CXX_COMPILER_VERSION_TWEAK 0)
|
||||
set_default_value(CUDA_VERSION_MAJOR 0)
|
||||
set_default_value(CUDA_VERSION_MINOR 0)
|
||||
set_default_value(OpenCV_VERSION_MAJOR 0)
|
||||
set_default_value(OpenCV_VERSION_MINOR 0)
|
||||
set_default_value(OpenCV_VERSION_PATCH 0)
|
||||
set_default_value(OpenCV_VERSION_TWEAK 0)
|
||||
set_default_value(${PROJECT_NAME}_VERSION_MAJOR 0)
|
||||
set_default_value(${PROJECT_NAME}_VERSION_MINOR 0)
|
||||
set_default_value(${PROJECT_NAME}_VERSION_PATCH 0)
|
||||
set_default_value(${PROJECT_NAME}_VERSION_TWEAK 0)
|
||||
|
||||
configure_file(
|
||||
cmake/templates/build.info.in
|
||||
|
||||
8
Makefile
8
Makefile
@@ -54,7 +54,10 @@ opendoc: apidoc
|
||||
[ -f "$$html" ] && $(SH) ./scripts/open.sh $$html; \
|
||||
done
|
||||
|
||||
.PHONY: apidoc opendoc
|
||||
cleandoc:
|
||||
@$(call rm,./doc/_output/)
|
||||
|
||||
.PHONY: apidoc opendoc cleandoc
|
||||
|
||||
# deps
|
||||
|
||||
@@ -225,8 +228,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
|
||||
|
||||
@@ -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,7 +17,9 @@ 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.
|
||||
* zh-Hans: [](https://github.com/slightech/MYNT-EYE-SDK-2/files/2083629/mynt-eye-sdk-apidoc-2.0.0-rc-zh-Hans.pdf) [](https://github.com/slightech/MYNT-EYE-SDK-2/files/2083631/mynt-eye-sdk-apidoc-2.0.0-rc-html-zh-Hans.zip) [](https://slightech.github.io/MYNT-EYE-SDK-2/)
|
||||
* [Guide Doc](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/releases): How to install and start using the SDK.
|
||||
* zh-Hans: [](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/files/2083740/mynt-eye-sdk-guide-2.0.0-rc-zh-Hans.pdf) [](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/files/2083745/mynt-eye-sdk-guide-2.0.0-rc-html-zh-Hans.zip) [](https://slightech.github.io/MYNT-EYE-SDK-2-Guide/)
|
||||
|
||||
> Supported languages: `zh-Hans`.
|
||||
|
||||
@@ -24,7 +28,7 @@ Please follow the guide doc to install the SDK on different platforms.
|
||||
[Google Drive]: https://drive.google.com/drive/folders/1tdFCcTBMNcImEGZ39tdOZmlX2SHKCr2f
|
||||
[百度网盘]: https://pan.baidu.com/s/1yPQDp2r0x4jvNwn2UjlMUQ
|
||||
|
||||
Get firmwares from our online disks: [Google Drive][], [百度网盘][]. The latest version is `2.0.0-rc2`.
|
||||
Get firmwares from our online disks: [Google Drive][], [百度网盘][]. The latest version is `2.0.0-rc`.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -50,15 +50,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/TargetArch.cmake)
|
||||
target_architecture(HOST_ARCH)
|
||||
message(STATUS "HOST_ARCH: ${HOST_ARCH}")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
execute_process(COMMAND gcc -dumpversion COMMAND cut -c 1-3 COMMAND tr -d '\n' OUTPUT_VARIABLE GCC_VERSION)
|
||||
string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONMENTS ${GCC_VERSION})
|
||||
list(GET GCC_VERSION_COMPONMENTS 0 GCC_VERSION_MAJOR)
|
||||
list(GET GCC_VERSION_COMPONMENTS 1 GCC_VERSION_MINOR)
|
||||
message(STATUS "GCC_VERSION: ${GCC_VERSION}")
|
||||
#message(STATUS "GCC_VERSION_MAJOR: ${GCC_VERSION_MAJOR}")
|
||||
#message(STATUS "GCC_VERSION_MINOR: ${GCC_VERSION_MINOR}")
|
||||
endif()
|
||||
# CMAKE_CXX_COMPILER_ID
|
||||
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
|
||||
# CMAKE_CXX_COMPILER_VERSION
|
||||
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_VERSION.html
|
||||
|
||||
# set_outdir(ARCHIVE_OUTPUT_DIRECTORY
|
||||
# LIBRARY_OUTPUT_DIRECTORY
|
||||
@@ -75,17 +70,27 @@ macro(set_outdir ARCHIVE_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY RUNTIME_OUTPU
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
set(__exe2bat_relative_path false)
|
||||
|
||||
macro(exe2bat exe_name exe_dir dll_search_paths)
|
||||
message(STATUS "Generating ${exe_name}.bat")
|
||||
set(__exe_name ${exe_name})
|
||||
set(__dll_relative_search_paths "")
|
||||
foreach(path ${dll_search_paths})
|
||||
file(RELATIVE_PATH __relative_path "${exe_dir}" "${path}")
|
||||
file(TO_NATIVE_PATH ${__relative_path} __relative_path)
|
||||
list(APPEND __dll_relative_search_paths ${__relative_path})
|
||||
endforeach()
|
||||
#message(STATUS __dll_relative_search_paths: "${__dll_relative_search_paths}")
|
||||
set(__dll_search_paths "${__dll_relative_search_paths}")
|
||||
if(__exe2bat_relative_path)
|
||||
set(__dll_relative_search_paths "")
|
||||
foreach(path ${dll_search_paths})
|
||||
file(RELATIVE_PATH __relative_path "${exe_dir}" "${path}")
|
||||
file(TO_NATIVE_PATH ${__relative_path} __relative_path)
|
||||
list(APPEND __dll_relative_search_paths ${__relative_path})
|
||||
endforeach()
|
||||
set(__dll_search_paths "${__dll_relative_search_paths}")
|
||||
else()
|
||||
set(__dll_native_search_paths "")
|
||||
foreach(path ${dll_search_paths})
|
||||
file(TO_NATIVE_PATH ${path} __native_path)
|
||||
list(APPEND __dll_native_search_paths ${__native_path})
|
||||
endforeach()
|
||||
set(__dll_search_paths "${__dll_native_search_paths}")
|
||||
endif()
|
||||
configure_file(
|
||||
"${CUR_DIR}/templates/exe.bat.in"
|
||||
"${exe_dir}/${__exe_name}.bat"
|
||||
|
||||
@@ -19,8 +19,15 @@ find_package(OpenCV REQUIRED)
|
||||
message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
|
||||
if(OpenCV_VERSION VERSION_LESS 3.0)
|
||||
add_definitions(-DUSE_OPENCV2)
|
||||
else()
|
||||
elseif(OpenCV_VERSION VERSION_LESS 4.0)
|
||||
add_definitions(-DUSE_OPENCV3)
|
||||
else()
|
||||
add_definitions(-DUSE_OPENCV4)
|
||||
endif()
|
||||
|
||||
list(FIND OpenCV_LIBS "opencv_world" __index)
|
||||
if(${__index} GREATER -1)
|
||||
set(WITH_OPENCV_WORLD TRUE)
|
||||
endif()
|
||||
|
||||
if(MSVC OR MSYS OR MINGW)
|
||||
|
||||
@@ -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("")
|
||||
|
||||
@@ -1,32 +1,65 @@
|
||||
# Based on the Qt 5 processor detection code, so should be very accurate
|
||||
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
|
||||
# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
|
||||
# http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/global/qprocessordetection.h
|
||||
# Currently handles arm (v5, v6, v7, v8), x86 (32/64), ia64, and ppc (32/64)
|
||||
|
||||
# Regarding POWER/PowerPC, just as is noted in the Qt source,
|
||||
# "There are many more known variants/revisions that we do not handle/detect."
|
||||
|
||||
set(archdetect_c_code "
|
||||
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
|
||||
#if defined(__ARM_ARCH_7__) \\
|
||||
|| defined(__ARM_ARCH_7A__) \\
|
||||
|| defined(__ARM_ARCH_7R__) \\
|
||||
|| defined(__ARM_ARCH_7M__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
|
||||
#error cmake_ARCH armv7
|
||||
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) \\
|
||||
|| defined(__aarch64__) || defined(__ARM64__)
|
||||
#if defined(__aarch64__) || defined(__ARM64__)
|
||||
#define cmake_ARM_64
|
||||
#else
|
||||
#define cmake_ARM_32
|
||||
#endif
|
||||
#if defined(__ARM_ARCH) && __ARM_ARCH > 1
|
||||
#define cmake_ARM __ARM_ARCH
|
||||
#elif defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM > 1
|
||||
#define cmake_ARM __TARGET_ARCH_ARM
|
||||
#elif defined(_M_ARM) && _M_ARM > 1
|
||||
#define cmake_ARM _M_ARM
|
||||
#elif defined(__ARM64_ARCH_8__) \\
|
||||
|| defined(__aarch64__) \\
|
||||
|| defined(__ARMv8__) \\
|
||||
|| defined(__ARMv8_A__)
|
||||
#define cmake_ARM 8
|
||||
#elif defined(__ARM_ARCH_7__) \\
|
||||
|| defined(__ARM_ARCH_7A__) \\
|
||||
|| defined(__ARM_ARCH_7R__) \\
|
||||
|| defined(__ARM_ARCH_7M__) \\
|
||||
|| defined(__ARM_ARCH_7S__) \\
|
||||
|| defined(_ARM_ARCH_7) \\
|
||||
|| defined(__CORE_CORTEXA__)
|
||||
#define cmake_ARM 7
|
||||
#elif defined(__ARM_ARCH_6__) \\
|
||||
|| defined(__ARM_ARCH_6J__) \\
|
||||
|| defined(__ARM_ARCH_6T2__) \\
|
||||
|| defined(__ARM_ARCH_6Z__) \\
|
||||
|| defined(__ARM_ARCH_6K__) \\
|
||||
|| defined(__ARM_ARCH_6ZK__) \\
|
||||
|| defined(__ARM_ARCH_6M__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
|
||||
#error cmake_ARCH armv6
|
||||
|| defined(__ARM_ARCH_6J__) \\
|
||||
|| defined(__ARM_ARCH_6T2__) \\
|
||||
|| defined(__ARM_ARCH_6Z__) \\
|
||||
|| defined(__ARM_ARCH_6K__) \\
|
||||
|| defined(__ARM_ARCH_6ZK__) \\
|
||||
|| defined(__ARM_ARCH_6M__)
|
||||
#define cmake_ARM 6
|
||||
#elif defined(__ARM_ARCH_5TEJ__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
|
||||
|| defined(__ARM_ARCH_5TE__)
|
||||
#define cmake_ARM 5
|
||||
#else
|
||||
#define cmake_ARM 0
|
||||
#endif
|
||||
#if cmake_ARM >= 8
|
||||
#error cmake_ARCH armv8
|
||||
#elif cmake_ARM >= 7
|
||||
#error cmake_ARCH armv7
|
||||
#elif cmake_ARM >= 6
|
||||
#error cmake_ARCH armv6
|
||||
#elif cmake_ARM >= 5
|
||||
#error cmake_ARCH armv5
|
||||
#else
|
||||
#error cmake_ARCH arm
|
||||
#if defined(cmake_ARM_64)
|
||||
#error cmake_ARCH arm64
|
||||
#else
|
||||
#error cmake_ARCH arm
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
|
||||
#error cmake_ARCH i386
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
HOST_OS: "@HOST_OS@"
|
||||
HOST_NAME: "@HOST_NAME@"
|
||||
HOST_ARCH: "@HOST_ARCH@"
|
||||
GCC_VERSION: "@GCC_VERSION@"
|
||||
GCC_VERSION_MAJOR: @GCC_VERSION_MAJOR@
|
||||
GCC_VERSION_MINOR: @GCC_VERSION_MINOR@
|
||||
HOST_COMPILER: "@CMAKE_CXX_COMPILER_ID@"
|
||||
COMPILER_VERSION: "@CMAKE_CXX_COMPILER_VERSION@"
|
||||
COMPILER_VERSION_MAJOR: @CMAKE_CXX_COMPILER_VERSION_MAJOR@
|
||||
COMPILER_VERSION_MINOR: @CMAKE_CXX_COMPILER_VERSION_MINOR@
|
||||
COMPILER_VERSION_PATCH: @CMAKE_CXX_COMPILER_VERSION_PATCH@
|
||||
COMPILER_VERSION_TWEAK: @CMAKE_CXX_COMPILER_VERSION_TWEAK@
|
||||
CUDA_VERSION: "@CUDA_VERSION@"
|
||||
CUDA_VERSION_MAJOR: @CUDA_VERSION_MAJOR@
|
||||
CUDA_VERSION_MINOR: @CUDA_VERSION_MINOR@
|
||||
@@ -16,6 +19,7 @@ OpenCV_VERSION_MINOR: @OpenCV_VERSION_MINOR@
|
||||
OpenCV_VERSION_PATCH: @OpenCV_VERSION_PATCH@
|
||||
OpenCV_VERSION_TWEAK: @OpenCV_VERSION_TWEAK@
|
||||
OpenCV_VERSION_STATUS: "@OpenCV_VERSION_STATUS@"
|
||||
OpenCV_WITH_WORLD: "@WITH_OPENCV_WORLD@"
|
||||
MYNTEYE_VERSION: "@mynteye_VERSION@"
|
||||
MYNTEYE_VERSION_MAJOR: @mynteye_VERSION_MAJOR@
|
||||
MYNTEYE_VERSION_MINOR: @mynteye_VERSION_MINOR@
|
||||
|
||||
@@ -7,7 +7,7 @@ if "%MY_PATH_SET_@__exe_name@%"=="" (
|
||||
set "PATH=@__dll_search_paths@;%PATH%"
|
||||
)
|
||||
|
||||
cd "%MY_DIR%"
|
||||
::cd "%MY_DIR%"
|
||||
"%MY_DIR%@__exe_name@.exe" %*
|
||||
cd "%MY_PWD%"
|
||||
::cd "%MY_PWD%"
|
||||
::pause >nul
|
||||
|
||||
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 | 60 | √ | 0x21 | XU_CAM_CTRL | values: {10,15,20,25,30,35,40,45,50,55,60} |
|
||||
| IMU frequency | imu_frequency | 2 | 200 | 100 | 500 | √ | 0x23 | XU_CAM_CTRL | values: {100,200,250,333,500} |
|
||||
| Exposure mode | exposure_mode | 1 | 0 | 0 | 1 | √ | 0x0F | XU_CAM_CTRL | 0: enable auto-exposure; 1: manual-exposure |
|
||||
| Max gain | max_gain | 2 | 48 | 0 | 48 | √ | 0x1D | XU_CAM_CTRL | valid if auto-exposure |
|
||||
| Max exposure time | max_exposure_time | 2 | 240 | 0 | 240 | √ | 0x1B | XU_CAM_CTRL | valid if auto-exposure |
|
||||
| Desired brightness | desired_brightness | 2 | 192 | 0 | 255 | √ | 0x19 | XU_CAM_CTRL | valid if auto-exposure |
|
||||
| IR control | ir_control | 1 | 0 | 0 | 160 | × | - | XU_CAM_CTRL | |
|
||||
| HDR mode | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 0: 10-bit; 1: 12-bit |
|
||||
| Zero drift calibration | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | |
|
||||
| Erase chip | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | |
|
||||
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-rc2
|
||||
PROJECT_NUMBER = 2.0.1-rc0
|
||||
|
||||
# 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 | 60 | √ | 0x21 | XU_CAM_CTRL | 步进为5,即有效值为{10,15,20,25,30,35,40,45,50,55,60} |
|
||||
| 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 |
|
||||
|
||||
### 文件内容包
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
| VID | vid | 0x04B4 | √ | × | 2 | |
|
||||
| PID | pid | 0x00F9 | √ | × | 2 | |
|
||||
| 设备名称 | name | MYNT-EYE-? | √ | √ Get | 16 | MYNT-EYE-S1000 |
|
||||
| 序列号 | serial_number | - | √ | √ Get | 16 | |
|
||||
| 序列号 | serial_number | - | √ | √ Get | 16 | |
|
||||
| 固件版本 | firmware_version | - | √ | √ Get | 2 | major,minor |
|
||||
| 硬件版本 | hardware_version | - | × | √ Get | 3 | major,minor,flag |
|
||||
| 协议版本 | spec_version | - | × | √ Get | 2 | major,minor |
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
## 图像数据包
|
||||
|
||||
| Name | Header | Size | FrameID | Timestamp | ExposureTime | Checksum |
|
||||
| :--- | :----- | :--- | :------ | :-------- | :----------- | :------- |
|
||||
| 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 |
|
||||
|
||||
> 图像内参不同分辨率会不同。如果多分辨率的话,就会有多个。
|
||||
> 图像分辨率不同,内参不同。多分辨率的话,需有多个内参。
|
||||
|
||||
## 图像外参
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ IMU 包/小包,是一组 IMU 数据。
|
||||
|
||||
### IMU 段
|
||||
|
||||
| Name | Offset | FrameID | Accelerometer | Temperature | Gyroscope |
|
||||
| :--- | :----- | :------ | :------------ | :---------- | :-------- |
|
||||
| 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
|
||||
|
||||
@@ -79,4 +79,6 @@ add_subdirectory(uvc)
|
||||
|
||||
# tutorials
|
||||
|
||||
add_subdirectory(tutorials)
|
||||
if(WITH_API)
|
||||
add_subdirectory(tutorials)
|
||||
endif()
|
||||
|
||||
@@ -30,8 +30,12 @@ make_executable(camera_a
|
||||
|
||||
## get_depth_with_region
|
||||
|
||||
if(OpenCV_VERSION VERSION_LESS 4.0)
|
||||
|
||||
make_executable(get_depth_with_region
|
||||
SRCS get_depth_with_region.cc
|
||||
LINK_LIBS mynteye ${OpenCV_LIBS}
|
||||
DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH}
|
||||
)
|
||||
|
||||
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)
|
||||
@@ -86,11 +86,13 @@ else()
|
||||
message(WARNING "PCL not found :(")
|
||||
endif()
|
||||
|
||||
# data
|
||||
# beginner level
|
||||
|
||||
make_executable2(get_device_info SRCS data/get_device_info.cc)
|
||||
make_executable2(get_img_params SRCS data/get_img_params.cc)
|
||||
make_executable2(get_imu_params SRCS data/get_imu_params.cc)
|
||||
## data
|
||||
|
||||
make_executable2(get_device_info SRCS data/get_device_info.cc WITH_OPENCV)
|
||||
make_executable2(get_img_params SRCS data/get_img_params.cc WITH_OPENCV)
|
||||
make_executable2(get_imu_params SRCS data/get_imu_params.cc WITH_OPENCV)
|
||||
|
||||
make_executable2(get_stereo SRCS data/get_stereo.cc WITH_OPENCV)
|
||||
make_executable2(get_stereo_rectified SRCS data/get_stereo_rectified.cc WITH_OPENCV)
|
||||
@@ -109,7 +111,7 @@ make_executable2(get_from_callbacks
|
||||
)
|
||||
make_executable2(get_with_plugin SRCS data/get_with_plugin.cc WITH_OPENCV)
|
||||
|
||||
# control
|
||||
## control
|
||||
|
||||
make_executable2(ctrl_framerate SRCS control/framerate.cc WITH_OPENCV)
|
||||
make_executable2(ctrl_auto_exposure
|
||||
@@ -122,4 +124,21 @@ make_executable2(ctrl_manual_exposure
|
||||
)
|
||||
make_executable2(ctrl_infrared SRCS control/infrared.cc WITH_OPENCV)
|
||||
|
||||
# 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)
|
||||
|
||||
make_executable2(get_depth_and_points
|
||||
SRCS intermediate/get_depth_and_points.cc util/cv_painter.cc util/pc_viewer.cc
|
||||
WITH_OPENCV WITH_PCL
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# advanced level
|
||||
|
||||
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;
|
||||
}
|
||||
241
samples/tutorials/intermediate/get_depth_and_points.cc
Normal file
241
samples/tutorials/intermediate/get_depth_and_points.cc
Normal file
@@ -0,0 +1,241 @@
|
||||
// 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 <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include "mynteye/api.h"
|
||||
|
||||
#include "util/cv_painter.h"
|
||||
#include "util/pc_viewer.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class DepthRegion {
|
||||
public:
|
||||
explicit DepthRegion(std::uint32_t n)
|
||||
: n_(std::move(n)), show_(false), selected_(false), point_(0, 0) {}
|
||||
|
||||
~DepthRegion() = default;
|
||||
|
||||
/**
|
||||
* 鼠标事件:默认不选中区域,随鼠标移动而显示。单击后,则会选中区域来显示。你可以再单击已选中区域或双击未选中区域,取消选中。
|
||||
*/
|
||||
void OnMouse(const int &event, const int &x, const int &y, const int &flags) {
|
||||
UNUSED(flags)
|
||||
if (event != CV_EVENT_MOUSEMOVE && event != CV_EVENT_LBUTTONDOWN) {
|
||||
return;
|
||||
}
|
||||
show_ = true;
|
||||
|
||||
if (event == CV_EVENT_MOUSEMOVE) {
|
||||
if (!selected_) {
|
||||
point_.x = x;
|
||||
point_.y = y;
|
||||
}
|
||||
} else if (event == CV_EVENT_LBUTTONDOWN) {
|
||||
if (selected_) {
|
||||
if (x >= static_cast<int>(point_.x - n_) &&
|
||||
x <= static_cast<int>(point_.x + n_) &&
|
||||
y >= static_cast<int>(point_.y - n_) &&
|
||||
y <= static_cast<int>(point_.y + n_)) {
|
||||
selected_ = false;
|
||||
}
|
||||
} else {
|
||||
selected_ = true;
|
||||
}
|
||||
point_.x = x;
|
||||
point_.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ShowElems(
|
||||
const cv::Mat &depth,
|
||||
std::function<std::string(const T &elem)> elem2string,
|
||||
int elem_space = 40,
|
||||
std::function<std::string(
|
||||
const cv::Mat &depth, const cv::Point &point, const std::uint32_t &n)>
|
||||
getinfo = nullptr) {
|
||||
if (!show_)
|
||||
return;
|
||||
|
||||
int space = std::move(elem_space);
|
||||
int n = 2 * n_ + 1;
|
||||
cv::Mat im(space * n, space * n, CV_8UC3, cv::Scalar(255, 255, 255));
|
||||
|
||||
int x, y;
|
||||
std::string str;
|
||||
int baseline = 0;
|
||||
for (int i = -n_; i <= n; ++i) {
|
||||
x = point_.x + i;
|
||||
if (x < 0 || x >= depth.cols)
|
||||
continue;
|
||||
for (int j = -n_; j <= n; ++j) {
|
||||
y = point_.y + j;
|
||||
if (y < 0 || y >= depth.rows)
|
||||
continue;
|
||||
|
||||
str = elem2string(depth.at<T>(y, x));
|
||||
|
||||
cv::Scalar color(0, 0, 0);
|
||||
if (i == 0 && j == 0)
|
||||
color = cv::Scalar(0, 0, 255);
|
||||
|
||||
cv::Size sz =
|
||||
cv::getTextSize(str, cv::FONT_HERSHEY_PLAIN, 1, 1, &baseline);
|
||||
|
||||
cv::putText(
|
||||
im, str, cv::Point(
|
||||
(i + n_) * space + (space - sz.width) / 2,
|
||||
(j + n_) * space + (space + sz.height) / 2),
|
||||
cv::FONT_HERSHEY_PLAIN, 1, color, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (getinfo) {
|
||||
std::string info = getinfo(depth, point_, n_);
|
||||
if (!info.empty()) {
|
||||
cv::Size sz =
|
||||
cv::getTextSize(info, cv::FONT_HERSHEY_PLAIN, 1, 1, &baseline);
|
||||
|
||||
cv::putText(
|
||||
im, info, cv::Point(5, 5 + sz.height), cv::FONT_HERSHEY_PLAIN, 1,
|
||||
cv::Scalar(255, 0, 255), 1);
|
||||
}
|
||||
}
|
||||
|
||||
cv::imshow("region", im);
|
||||
}
|
||||
|
||||
void DrawRect(cv::Mat &image) { // NOLINT
|
||||
if (!show_)
|
||||
return;
|
||||
std::uint32_t n = (n_ > 1) ? n_ : 1;
|
||||
n += 1; // outside the region
|
||||
cv::rectangle(
|
||||
image, cv::Point(point_.x - n, point_.y - n),
|
||||
cv::Point(point_.x + n, point_.y + n),
|
||||
selected_ ? cv::Scalar(0, 255, 0) : cv::Scalar(0, 0, 255), 1);
|
||||
}
|
||||
|
||||
private:
|
||||
std::uint32_t n_;
|
||||
bool show_;
|
||||
bool selected_;
|
||||
cv::Point point_;
|
||||
};
|
||||
|
||||
void OnDepthMouseCallback(int event, int x, int y, int flags, void *userdata) {
|
||||
DepthRegion *region = reinterpret_cast<DepthRegion *>(userdata);
|
||||
region->OnMouse(event, x, y, flags);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
MYNTEYE_USE_NAMESPACE
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
auto &&api = API::Create(argc, argv);
|
||||
if (!api)
|
||||
return 1;
|
||||
|
||||
api->SetOptionValue(Option::IR_CONTROL, 80);
|
||||
|
||||
api->EnableStreamData(Stream::DISPARITY_NORMALIZED);
|
||||
api->EnableStreamData(Stream::DEPTH);
|
||||
|
||||
api->Start(Source::VIDEO_STREAMING);
|
||||
|
||||
cv::namedWindow("frame");
|
||||
cv::namedWindow("depth");
|
||||
cv::namedWindow("region");
|
||||
|
||||
DepthRegion depth_region(3);
|
||||
auto depth_info = [](
|
||||
const cv::Mat &depth, const cv::Point &point, const std::uint32_t &n) {
|
||||
UNUSED(depth)
|
||||
std::ostringstream os;
|
||||
os << "depth pos: [" << point.y << ", " << point.x << "]"
|
||||
<< "±" << n << ", unit: mm";
|
||||
return os.str();
|
||||
};
|
||||
|
||||
CVPainter painter;
|
||||
PCViewer pcviewer;
|
||||
|
||||
while (true) {
|
||||
api->WaitForStreams();
|
||||
|
||||
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
||||
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
||||
|
||||
cv::Mat img;
|
||||
cv::hconcat(left_data.frame, right_data.frame, img);
|
||||
|
||||
painter.DrawImgData(img, *left_data.img);
|
||||
|
||||
cv::imshow("frame", img);
|
||||
|
||||
auto &&disp_data = api->GetStreamData(Stream::DISPARITY_NORMALIZED);
|
||||
auto &&depth_data = api->GetStreamData(Stream::DEPTH);
|
||||
if (!disp_data.frame.empty() && !depth_data.frame.empty()) {
|
||||
// Show disparity instead of depth, but show depth values in region.
|
||||
auto &&depth_frame = disp_data.frame;
|
||||
|
||||
#ifdef USE_OPENCV3
|
||||
// ColormapTypes
|
||||
// http://docs.opencv.org/master/d3/d50/group__imgproc__colormap.html#ga9a805d8262bcbe273f16be9ea2055a65
|
||||
cv::applyColorMap(depth_frame, depth_frame, cv::COLORMAP_JET);
|
||||
#endif
|
||||
|
||||
cv::setMouseCallback("depth", OnDepthMouseCallback, &depth_region);
|
||||
// Note: DrawRect will change some depth values to show the rect.
|
||||
depth_region.DrawRect(depth_frame);
|
||||
|
||||
cv::imshow("depth", depth_frame);
|
||||
|
||||
depth_region.ShowElems<ushort>(
|
||||
depth_data.frame,
|
||||
[](const ushort &elem) {
|
||||
if (elem >= 10000) {
|
||||
// Filter errors, or limit to valid range.
|
||||
//
|
||||
// reprojectImageTo3D(), missing values will set to 10000
|
||||
// https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga1bc1152bd57d63bc524204f21fde6e02
|
||||
return std::string("invalid");
|
||||
}
|
||||
return std::to_string(elem);
|
||||
},
|
||||
80, depth_info);
|
||||
}
|
||||
|
||||
auto &&points_data = api->GetStreamData(Stream::POINTS);
|
||||
if (!points_data.frame.empty()) {
|
||||
pcviewer.Update(points_data.frame);
|
||||
}
|
||||
|
||||
char key = static_cast<char>(cv::waitKey(1));
|
||||
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
|
||||
break;
|
||||
}
|
||||
if (pcviewer.WasStopped()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
api->Stop(Source::VIDEO_STREAMING);
|
||||
return 0;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ std::shared_ptr<pcl::visualization::PCLVisualizer> CustomColorVis(
|
||||
// viewer->addCoordinateSystem(1.0);
|
||||
viewer->addCoordinateSystem(1000.0);
|
||||
viewer->initCameraParameters();
|
||||
viewer->setCameraPosition(0, 0, -150, 0, 1, 0);
|
||||
viewer->setCameraPosition(0, 0, -150, 0, -1, 0);
|
||||
return (viewer);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
_echo_sn "Install pip"
|
||||
[ -f "get-pip.py" ] || curl -O https://bootstrap.pypa.io/get-pip.py
|
||||
$SUDO $PYTHON get-pip.py
|
||||
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
|
||||
_echo_d "pip install --upgrade autopep8 cpplint pylint requests"
|
||||
$SUDO pip install --upgrade autopep8 cpplint pylint requests
|
||||
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
|
||||
|
||||
_echo_s "Init git hooks"
|
||||
$PYTHON "$ROOT_DIR/tools/linter/init-git-hooks.py"
|
||||
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,15 +29,22 @@
|
||||
#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)
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef WITH_FILESYSTEM
|
||||
#if defined(WITH_FILESYSTEM)
|
||||
|
||||
#ifdef WITH_BOOST_FILESYSTEM
|
||||
#if defined(WITH_BOOST_FILESYSTEM)
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
@@ -61,6 +68,26 @@ bool dir_exists(const fs::path &p) {
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(WITH_NATIVE_FILESYSTEM)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
bool file_exists(const std::string &p) {
|
||||
DWORD attrs = GetFileAttributes(p.c_str());
|
||||
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);
|
||||
}
|
||||
|
||||
#else
|
||||
#error "Unsupported native filesystem"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
std::vector<std::string> get_plugin_paths() {
|
||||
@@ -69,7 +96,7 @@ std::vector<std::string> get_plugin_paths() {
|
||||
|
||||
cv::FileStorage fs(info_path, cv::FileStorage::READ);
|
||||
if (!fs.isOpened()) {
|
||||
// LOG(ERROR) << "build.info not found";
|
||||
LOG(WARNING) << "build.info not found: " << info_path;
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -83,19 +110,29 @@ std::vector<std::string> get_plugin_paths() {
|
||||
to_lower(host_name);
|
||||
std::string host_arch = fs["HOST_ARCH"];
|
||||
to_lower(host_arch);
|
||||
// std::string gcc_version = fs["GCC_VERSION"];
|
||||
int gcc_version_major = fs["GCC_VERSION_MAJOR"];
|
||||
// int gcc_version_minor = fs["GCC_VERSION_MINOR"];
|
||||
std::string host_compiler = fs["HOST_COMPILER"];
|
||||
to_lower(host_compiler);
|
||||
|
||||
// std::string compiler_version = fs["COMPILER_VERSION"];
|
||||
int compiler_version_major = fs["COMPILER_VERSION_MAJOR"];
|
||||
// int compiler_version_minor = fs["COMPILER_VERSION_MINOR"];
|
||||
// int compiler_version_patch = fs["COMPILER_VERSION_PATCH"];
|
||||
// int compiler_version_tweak = fs["COMPILER_VERSION_TWEAK"];
|
||||
|
||||
std::string cuda_version = fs["CUDA_VERSION"];
|
||||
// int cuda_version_major = fs["CUDA_VERSION_MAJOR"];
|
||||
// int cuda_version_minor = fs["CUDA_VERSION_MINOR"];
|
||||
// std::string cuda_version_string = fs["CUDA_VERSION_STRING"];
|
||||
|
||||
std::string opencv_version = fs["OpenCV_VERSION"];
|
||||
// int opencv_version_major = fs["OpenCV_VERSION_MAJOR"];
|
||||
// int opencv_version_minor = fs["OpenCV_VERSION_MINOR"];
|
||||
// int opencv_version_patch = fs["OpenCV_VERSION_PATCH"];
|
||||
// int opencv_version_tweak = fs["OpenCV_VERSION_TWEAK"];
|
||||
// std::string opencv_version_status = fs["OpenCV_VERSION_STATUS"];
|
||||
std::string opencv_with_world = fs["OpenCV_WITH_WORLD"];
|
||||
to_lower(opencv_with_world);
|
||||
|
||||
std::string mynteye_version = fs["MYNTEYE_VERSION"];
|
||||
// int mynteye_version_major = fs["MYNTEYE_VERSION_MAJOR"];
|
||||
// int mynteye_version_minor = fs["MYNTEYE_VERSION_MINOR"];
|
||||
@@ -107,7 +144,7 @@ std::vector<std::string> get_plugin_paths() {
|
||||
std::string lib_prefix;
|
||||
std::string lib_suffix;
|
||||
if (host_os == "linux") {
|
||||
if (gcc_version_major < 5)
|
||||
if (host_compiler != "gnu" || compiler_version_major < 5)
|
||||
return {};
|
||||
lib_prefix = "lib";
|
||||
lib_suffix = ".so";
|
||||
@@ -127,10 +164,13 @@ std::vector<std::string> get_plugin_paths() {
|
||||
// lib_prefix + "plugin_b_ocl" + ocl_version,
|
||||
lib_prefix + "plugin_g_cuda" + cuda_version,
|
||||
};
|
||||
std::string opencv_name("_opencv" + opencv_version);
|
||||
if (opencv_with_world == "true") {
|
||||
opencv_name.append("-world");
|
||||
}
|
||||
for (auto &&prefix : prefixes) {
|
||||
names.push_back(
|
||||
prefix + "_opencv" + opencv_version + "_mynteye" + mynteye_version);
|
||||
names.push_back(prefix + "_opencv" + opencv_version);
|
||||
names.push_back(prefix + opencv_name + "_mynteye" + mynteye_version);
|
||||
names.push_back(prefix + opencv_name);
|
||||
names.push_back(prefix);
|
||||
}
|
||||
for (auto &&name : names) {
|
||||
@@ -170,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_l2r_ok;
|
||||
device_->GetIntrinsics(Stream::LEFT, &in_l_ok);
|
||||
device_->GetIntrinsics(Stream::RIGHT, &in_r_ok);
|
||||
device_->GetExtrinsics(Stream::LEFT, Stream::RIGHT, &ex_l2r_ok);
|
||||
if (!in_l_ok || !in_r_ok || !ex_l2r_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() {
|
||||
@@ -301,9 +361,13 @@ void API::Start(const Source &source) {
|
||||
if (source == Source::VIDEO_STREAMING) {
|
||||
#ifdef WITH_FILESYSTEM
|
||||
if (!synthetic_->HasPlugin()) {
|
||||
auto &&plugin_paths = get_plugin_paths();
|
||||
if (plugin_paths.size() > 0) {
|
||||
EnablePlugin(plugin_paths[0]);
|
||||
try {
|
||||
auto &&plugin_paths = get_plugin_paths();
|
||||
if (plugin_paths.size() > 0) {
|
||||
EnablePlugin(plugin_paths[0]);
|
||||
}
|
||||
} catch (...) {
|
||||
LOG(WARNING) << "Incorrect yaml format: build.info";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -371,7 +435,9 @@ void API::EnablePlugin(const std::string &path) {
|
||||
|
||||
plugin_version_code_t *plugin_version_code =
|
||||
dl.Sym<plugin_version_code_t>("plugin_version_code");
|
||||
LOG(INFO) << "Enable plugin, version code: " << plugin_version_code();
|
||||
LOG(INFO) << "Enable plugin success";
|
||||
LOG(INFO) << " version code: " << plugin_version_code();
|
||||
LOG(INFO) << " path: " << path;
|
||||
|
||||
plugin_create_t *plugin_create = dl.Sym<plugin_create_t>("plugin_create");
|
||||
plugin_destroy_t *plugin_destroy = dl.Sym<plugin_destroy_t>("plugin_destroy");
|
||||
|
||||
@@ -30,6 +30,12 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||
class Device;
|
||||
class Synthetic;
|
||||
|
||||
namespace device {
|
||||
|
||||
class Frame;
|
||||
|
||||
} // namespace device
|
||||
|
||||
namespace api {
|
||||
|
||||
/**
|
||||
@@ -41,6 +47,8 @@ struct MYNTEYE_API StreamData {
|
||||
std::shared_ptr<ImgData> img;
|
||||
/** Frame. */
|
||||
cv::Mat frame;
|
||||
/** Raw frame. */
|
||||
std::shared_ptr<device::Frame> frame_raw;
|
||||
|
||||
bool operator==(const StreamData &other) const {
|
||||
if (img && other.img) {
|
||||
@@ -238,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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,14 +198,21 @@ void Processor::Run() {
|
||||
pre_callback_(input_.get());
|
||||
}
|
||||
bool ok = false;
|
||||
if (callback_) {
|
||||
if (callback_(input_.get(), output_.get(), parent_)) {
|
||||
ok = true;
|
||||
try {
|
||||
if (callback_) {
|
||||
if (callback_(input_.get(), output_.get(), parent_)) {
|
||||
ok = true;
|
||||
} else {
|
||||
ok = OnProcess(input_.get(), output_.get(), parent_);
|
||||
}
|
||||
} else {
|
||||
ok = OnProcess(input_.get(), output_.get(), parent_);
|
||||
}
|
||||
} 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";
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -46,7 +46,16 @@ cv::Mat frame2mat(const std::shared_ptr<device::Frame> &frame) {
|
||||
}
|
||||
|
||||
api::StreamData data2api(const device::StreamData &data) {
|
||||
return {data.img, frame2mat(data.frame)};
|
||||
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
|
||||
@@ -146,59 +155,59 @@ api::StreamData Synthetic::GetStreamData(const Stream &stream) {
|
||||
auto &&device = api_->device();
|
||||
return data2api(device->GetLatestStreamData(stream));
|
||||
} else if (mode == MODE_SYNTHETIC) {
|
||||
if (stream == Stream::LEFT_RECTIFIED || stream == Stream::RIGHT_RECTIFIED) {
|
||||
static std::shared_ptr<ObjMat2> output = nullptr;
|
||||
auto &&processor = find_processor<RectifyProcessor>(processor_);
|
||||
auto &&out = processor->GetOutput();
|
||||
if (out != nullptr) {
|
||||
// Obtain the output, out will be nullptr if get again immediately.
|
||||
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";
|
||||
return {};
|
||||
}
|
||||
switch (stream) {
|
||||
case Stream::LEFT_RECTIFIED: {
|
||||
auto &&processor = find_processor<RectifyProcessor>(processor_);
|
||||
Object *out = processor->GetOutput();
|
||||
if (out != nullptr) {
|
||||
ObjMat2 *output = Object::Cast<ObjMat2>(out);
|
||||
return {nullptr, output->first};
|
||||
}
|
||||
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);
|
||||
return {nullptr, output->second};
|
||||
}
|
||||
VLOG(2) << "Rectify not ready now";
|
||||
} break;
|
||||
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);
|
||||
return {nullptr, output->value};
|
||||
auto &&output = Object::Cast<ObjMat>(out);
|
||||
return {nullptr, output->value, nullptr};
|
||||
}
|
||||
VLOG(2) << "Disparity not ready now";
|
||||
} break;
|
||||
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);
|
||||
return {nullptr, output->value};
|
||||
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);
|
||||
return {nullptr, output->value};
|
||||
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);
|
||||
return {nullptr, output->value};
|
||||
auto &&output = Object::Cast<ObjMat>(out);
|
||||
return {nullptr, output->value, nullptr};
|
||||
}
|
||||
VLOG(2) << "Depth not ready now";
|
||||
} break;
|
||||
@@ -437,60 +446,50 @@ void Synthetic::InitProcessors() {
|
||||
|
||||
void Synthetic::ProcessNativeStream(
|
||||
const Stream &stream, const api::StreamData &data) {
|
||||
bool done = false;
|
||||
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 &&
|
||||
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 || stream == Stream::RIGHT) {
|
||||
static api::StreamData left_data, right_data;
|
||||
if (stream == Stream::LEFT) {
|
||||
left_data = data;
|
||||
} else if (stream == Stream::RIGHT) {
|
||||
right_data = data;
|
||||
}
|
||||
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});
|
||||
}
|
||||
};
|
||||
|
||||
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 &&
|
||||
left_rect_data.img->frame_id == right_rect_data.img->frame_id) {
|
||||
process_childs(
|
||||
RectifyProcessor::NAME,
|
||||
ObjMat2{left_rect_data.frame, right_rect_data.frame});
|
||||
}
|
||||
if (done)
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
} else if (stream == Stream::RIGHT_RECTIFIED) {
|
||||
right_rect_data = data;
|
||||
}
|
||||
if (left_rect_data.img && right_rect_data.img &&
|
||||
left_rect_data.img->frame_id == right_rect_data.img->frame_id) {
|
||||
process_childs(
|
||||
processor_, RectifyProcessor::NAME,
|
||||
ObjMat2{left_rect_data.frame, right_rect_data.frame});
|
||||
}
|
||||
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;
|
||||
@@ -546,17 +545,19 @@ bool Synthetic::OnDepthProcess(
|
||||
void Synthetic::OnRectifyPostProcess(Object *const out) {
|
||||
const ObjMat2 *output = Object::Cast<ObjMat2>(out);
|
||||
if (HasStreamCallback(Stream::LEFT_RECTIFIED)) {
|
||||
stream_callbacks_.at(Stream::LEFT_RECTIFIED)({nullptr, output->first});
|
||||
stream_callbacks_.at(Stream::LEFT_RECTIFIED)(
|
||||
{nullptr, output->first, nullptr});
|
||||
}
|
||||
if (HasStreamCallback(Stream::RIGHT_RECTIFIED)) {
|
||||
stream_callbacks_.at(Stream::RIGHT_RECTIFIED)({nullptr, output->second});
|
||||
stream_callbacks_.at(Stream::RIGHT_RECTIFIED)(
|
||||
{nullptr, output->second, nullptr});
|
||||
}
|
||||
}
|
||||
|
||||
void Synthetic::OnDisparityPostProcess(Object *const out) {
|
||||
const ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
if (HasStreamCallback(Stream::DISPARITY)) {
|
||||
stream_callbacks_.at(Stream::DISPARITY)({nullptr, output->value});
|
||||
stream_callbacks_.at(Stream::DISPARITY)({nullptr, output->value, nullptr});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,21 +565,21 @@ void Synthetic::OnDisparityNormalizedPostProcess(Object *const out) {
|
||||
const ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
if (HasStreamCallback(Stream::DISPARITY_NORMALIZED)) {
|
||||
stream_callbacks_.at(Stream::DISPARITY_NORMALIZED)(
|
||||
{nullptr, output->value});
|
||||
{nullptr, output->value, nullptr});
|
||||
}
|
||||
}
|
||||
|
||||
void Synthetic::OnPointsPostProcess(Object *const out) {
|
||||
const ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
if (HasStreamCallback(Stream::POINTS)) {
|
||||
stream_callbacks_.at(Stream::POINTS)({nullptr, output->value});
|
||||
stream_callbacks_.at(Stream::POINTS)({nullptr, output->value, nullptr});
|
||||
}
|
||||
}
|
||||
|
||||
void Synthetic::OnDepthPostProcess(Object *const out) {
|
||||
const ObjMat *output = Object::Cast<ObjMat>(out);
|
||||
if (HasStreamCallback(Stream::DEPTH)) {
|
||||
stream_callbacks_.at(Stream::DEPTH)({nullptr, output->value});
|
||||
stream_callbacks_.at(Stream::DEPTH)({nullptr, output->value, nullptr});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -434,6 +488,7 @@ void Device::StartVideoStreaming() {
|
||||
}
|
||||
}
|
||||
continuation();
|
||||
OnStereoStreamUpdate();
|
||||
// VLOG(2) << "Stereo video callback cost "
|
||||
// << times::count<times::milliseconds>(times::now() - time_beg)
|
||||
// << " ms";
|
||||
@@ -465,7 +520,7 @@ void Device::StartMotionTracking() {
|
||||
}
|
||||
motions_->SetMotionCallback(
|
||||
std::bind(&Device::CallbackMotionData, this, std::placeholders::_1));
|
||||
motions_->StartMotionTracking();
|
||||
// motions_->StartMotionTracking();
|
||||
motion_tracking_ = true;
|
||||
}
|
||||
|
||||
@@ -474,10 +529,12 @@ void Device::StopMotionTracking() {
|
||||
LOG(WARNING) << "Cannot stop motion tracking without first starting it";
|
||||
return;
|
||||
}
|
||||
motions_->StopMotionTracking();
|
||||
// motions_->StopMotionTracking();
|
||||
motion_tracking_ = false;
|
||||
}
|
||||
|
||||
void Device::OnStereoStreamUpdate() {}
|
||||
|
||||
void Device::ReadAllInfos() {
|
||||
device_info_ = std::make_shared<DeviceInfo>();
|
||||
|
||||
@@ -485,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
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
@@ -239,6 +257,18 @@ class MYNTEYE_API Device {
|
||||
return device_;
|
||||
}
|
||||
|
||||
std::shared_ptr<Streams> streams() const {
|
||||
return streams_;
|
||||
}
|
||||
|
||||
std::shared_ptr<Channels> channels() const {
|
||||
return channels_;
|
||||
}
|
||||
|
||||
std::shared_ptr<Motions> motions() const {
|
||||
return motions_;
|
||||
}
|
||||
|
||||
const StreamRequest &GetStreamRequest(const Capabilities &capability);
|
||||
|
||||
virtual void StartVideoStreaming();
|
||||
@@ -247,6 +277,8 @@ class MYNTEYE_API Device {
|
||||
virtual void StartMotionTracking();
|
||||
virtual void StopMotionTracking();
|
||||
|
||||
virtual void OnStereoStreamUpdate();
|
||||
|
||||
virtual std::vector<Stream> GetKeyStreams() const = 0;
|
||||
|
||||
bool video_streaming_;
|
||||
@@ -284,10 +316,6 @@ class MYNTEYE_API Device {
|
||||
void CallbackPushedStreamData(const Stream &stream);
|
||||
void CallbackMotionData(const device::MotionData &data);
|
||||
|
||||
std::shared_ptr<Channels> channels() {
|
||||
return channels_;
|
||||
}
|
||||
|
||||
friend API;
|
||||
friend tools::DeviceWriter;
|
||||
};
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include "internal/motions.h"
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
StandardDevice::StandardDevice(std::shared_ptr<uvc::device> device)
|
||||
@@ -30,4 +32,11 @@ std::vector<Stream> StandardDevice::GetKeyStreams() const {
|
||||
return {Stream::LEFT, Stream::RIGHT};
|
||||
}
|
||||
|
||||
void StandardDevice::OnStereoStreamUpdate() {
|
||||
if (motion_tracking_) {
|
||||
auto &&motions = this->motions();
|
||||
motions->DoMotionTrack();
|
||||
}
|
||||
}
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
@@ -28,6 +28,8 @@ class StandardDevice : public Device {
|
||||
virtual ~StandardDevice();
|
||||
|
||||
std::vector<Stream> GetKeyStreams() const override;
|
||||
|
||||
void OnStereoStreamUpdate() override;
|
||||
};
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -31,7 +31,12 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
const uvc::xu mynteye_xu = {3, 2, {0x947a6d9f, 0x8a2f, 0x418d, {0x85, 0x9e, 0x6c, 0x9a, 0xa0, 0x38, 0x10, 0x14}}};
|
||||
const uvc::xu mynteye_xu = {3,
|
||||
2,
|
||||
{0x947a6d9f,
|
||||
0x8a2f,
|
||||
0x418d,
|
||||
{0x85, 0x9e, 0x6c, 0x9a, 0xa0, 0x38, 0x10, 0x14}}};
|
||||
|
||||
int XuCamCtrlId(Option option) {
|
||||
switch (option) {
|
||||
@@ -276,6 +281,47 @@ void Channels::SetImuCallback(imu_callback_t callback) {
|
||||
imu_callback_ = callback;
|
||||
}
|
||||
|
||||
void Channels::DoImuTrack() {
|
||||
static ImuReqPacket req_packet{0};
|
||||
static ImuResPacket res_packet;
|
||||
|
||||
req_packet.serial_number = imu_sn_;
|
||||
if (!XuImuWrite(req_packet)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!XuImuRead(&res_packet)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (res_packet.packets.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
VLOG(2) << "Imu req sn: " << imu_sn_ << ", res count: " << []() {
|
||||
std::size_t n = 0;
|
||||
for (auto &&packet : res_packet.packets) {
|
||||
n += packet.count;
|
||||
}
|
||||
return n;
|
||||
}();
|
||||
|
||||
auto &&sn = res_packet.packets.back().serial_number;
|
||||
if (imu_sn_ == sn) {
|
||||
VLOG(2) << "New imu not ready, dropped";
|
||||
return;
|
||||
}
|
||||
imu_sn_ = sn;
|
||||
|
||||
if (imu_callback_) {
|
||||
for (auto &&packet : res_packet.packets) {
|
||||
imu_callback_(packet);
|
||||
}
|
||||
}
|
||||
|
||||
res_packet.packets.clear();
|
||||
}
|
||||
|
||||
void Channels::StartImuTracking(imu_callback_t callback) {
|
||||
if (is_imu_tracking_) {
|
||||
LOG(WARNING) << "Start imu tracking failed, is tracking already";
|
||||
@@ -287,8 +333,6 @@ void Channels::StartImuTracking(imu_callback_t callback) {
|
||||
is_imu_tracking_ = true;
|
||||
imu_track_thread_ = std::thread([this]() {
|
||||
imu_sn_ = 0;
|
||||
ImuReqPacket req_packet{imu_sn_};
|
||||
ImuResPacket res_packet;
|
||||
auto sleep = [](const times::system_clock::time_point &time_beg) {
|
||||
auto &&time_elapsed_ms =
|
||||
times::count<times::milliseconds>(times::now() - time_beg);
|
||||
@@ -301,48 +345,7 @@ void Channels::StartImuTracking(imu_callback_t callback) {
|
||||
};
|
||||
while (!imu_track_stop_) {
|
||||
auto &&time_beg = times::now();
|
||||
|
||||
req_packet.serial_number = imu_sn_;
|
||||
if (!XuImuWrite(req_packet)) {
|
||||
sleep(time_beg);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!XuImuRead(&res_packet)) {
|
||||
sleep(time_beg);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (res_packet.packets.size() == 0) {
|
||||
sleep(time_beg);
|
||||
continue;
|
||||
}
|
||||
|
||||
VLOG(2) << "Imu req sn: " << imu_sn_
|
||||
<< ", res count: " << [&res_packet]() {
|
||||
std::size_t n = 0;
|
||||
for (auto &&packet : res_packet.packets) {
|
||||
n += packet.count;
|
||||
}
|
||||
return n;
|
||||
}();
|
||||
|
||||
auto &&sn = res_packet.packets.back().serial_number;
|
||||
if (imu_sn_ == sn) {
|
||||
VLOG(2) << "New imu not ready, dropped";
|
||||
sleep(time_beg);
|
||||
continue;
|
||||
}
|
||||
imu_sn_ = sn;
|
||||
|
||||
if (imu_callback_) {
|
||||
for (auto &&packet : res_packet.packets) {
|
||||
imu_callback_(packet);
|
||||
}
|
||||
}
|
||||
|
||||
res_packet.packets.clear();
|
||||
|
||||
DoImuTrack();
|
||||
sleep(time_beg);
|
||||
}
|
||||
});
|
||||
@@ -870,7 +873,8 @@ bool Channels::PuControlQuery(
|
||||
}
|
||||
|
||||
bool Channels::XuControlRange(
|
||||
channel_t channel, uint8_t id, int32_t *min, int32_t *max, int32_t *def) const {
|
||||
channel_t channel, uint8_t id, int32_t *min, int32_t *max,
|
||||
int32_t *def) const {
|
||||
return XuControlRange(mynteye_xu, channel, id, min, max, def);
|
||||
}
|
||||
|
||||
@@ -1016,7 +1020,8 @@ Channels::control_info_t Channels::XuControlInfo(Option option) const {
|
||||
int id = XuCamCtrlId(option);
|
||||
|
||||
int32_t min = 0, max = 0, def = 0;
|
||||
if (!XuControlRange(CHANNEL_CAM_CTRL, static_cast<std::uint8_t>(id), &min, &max, &def)) {
|
||||
if (!XuControlRange(
|
||||
CHANNEL_CAM_CTRL, static_cast<std::uint8_t>(id), &min, &max, &def)) {
|
||||
LOG(WARNING) << "Get XuControlInfo of " << option << " failed";
|
||||
}
|
||||
return {min, max, def};
|
||||
|
||||
@@ -95,6 +95,8 @@ class MYNTEYE_API Channels {
|
||||
bool RunControlAction(const Option &option) const;
|
||||
|
||||
void SetImuCallback(imu_callback_t callback);
|
||||
void DoImuTrack();
|
||||
|
||||
void StartImuTracking(imu_callback_t callback = nullptr);
|
||||
void StopImuTracking();
|
||||
|
||||
@@ -111,10 +113,11 @@ class MYNTEYE_API Channels {
|
||||
bool PuControlQuery(Option option, uvc::pu_query query, int32_t *value) const;
|
||||
|
||||
bool XuControlRange(
|
||||
channel_t channel, uint8_t id, int32_t *min, int32_t *max, int32_t *def) const;
|
||||
bool XuControlRange(
|
||||
const uvc::xu &xu, uint8_t selector, uint8_t id, int32_t *min, int32_t *max,
|
||||
channel_t channel, uint8_t id, int32_t *min, int32_t *max,
|
||||
int32_t *def) const;
|
||||
bool XuControlRange(
|
||||
const uvc::xu &xu, uint8_t selector, uint8_t id, int32_t *min,
|
||||
int32_t *max, int32_t *def) const;
|
||||
|
||||
bool XuControlQuery(
|
||||
channel_t channel, uvc::xu_query query, uint16_t size,
|
||||
|
||||
@@ -34,11 +34,8 @@ Motions::~Motions() {
|
||||
|
||||
void Motions::SetMotionCallback(motion_callback_t callback) {
|
||||
motion_callback_ = callback;
|
||||
}
|
||||
|
||||
void Motions::StartMotionTracking() {
|
||||
if (!is_imu_tracking) {
|
||||
channels_->StartImuTracking([this](const ImuPacket &packet) {
|
||||
if (motion_callback_) {
|
||||
channels_->SetImuCallback([this](const ImuPacket &packet) {
|
||||
if (!motion_callback_ && !motion_datas_enabled_) {
|
||||
LOG(WARNING) << "";
|
||||
return;
|
||||
@@ -62,11 +59,22 @@ void Motions::StartMotionTracking() {
|
||||
std::lock_guard<std::mutex> _(mtx_datas_);
|
||||
motion_data_t data = {imu};
|
||||
motion_datas_.push_back(data);
|
||||
if (motion_callback_) {
|
||||
motion_callback_(data);
|
||||
}
|
||||
|
||||
motion_callback_(data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
channels_->SetImuCallback(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void Motions::DoMotionTrack() {
|
||||
channels_->DoImuTrack();
|
||||
}
|
||||
|
||||
void Motions::StartMotionTracking() {
|
||||
if (!is_imu_tracking) {
|
||||
channels_->StartImuTracking();
|
||||
is_imu_tracking = true;
|
||||
} else {
|
||||
LOG(WARNING) << "Imu is tracking already";
|
||||
|
||||
@@ -37,6 +37,7 @@ class Motions {
|
||||
~Motions();
|
||||
|
||||
void SetMotionCallback(motion_callback_t callback);
|
||||
void DoMotionTrack();
|
||||
|
||||
void StartMotionTracking();
|
||||
void StopMotionTracking();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -69,7 +69,7 @@ roslaunch mynt_eye_ros_wrapper mynteye.launch
|
||||
```
|
||||
|
||||
```bash
|
||||
rosbag record -O mynteye.bag /mynteye/left /mynteye/imu /mynteye/temp
|
||||
rosbag record -O mynteye.bag /mynteye/left/image_raw /mynteye/imu/data_raw /mynteye/temp/data_raw
|
||||
```
|
||||
|
||||
## Analytics data (rosbag)
|
||||
|
||||
@@ -650,8 +650,8 @@ def _main():
|
||||
else:
|
||||
dataset = ROSBag(
|
||||
path,
|
||||
topic_imu='/mynteye/imu',
|
||||
topic_temp='/mynteye/temp')
|
||||
topic_imu='/mynteye/imu/data_raw',
|
||||
topic_temp='/mynteye/temp/data_raw')
|
||||
return dataset
|
||||
|
||||
if args.binary:
|
||||
|
||||
@@ -334,8 +334,8 @@ def _main():
|
||||
sys.exit('Error: dataset model not supported {}'.format(model))
|
||||
else:
|
||||
dataset = ROSBag(path,
|
||||
topic_img_left='/mynteye/left',
|
||||
topic_imu='/mynteye/imu')
|
||||
topic_img_left='/mynteye/left/image_raw',
|
||||
topic_imu='/mynteye/imu/data_raw')
|
||||
return dataset
|
||||
|
||||
dataset = BinDataset(dataset_path, dataset_creator)
|
||||
|
||||
@@ -3,7 +3,7 @@ dataset: "mynteye"
|
||||
|
||||
# rosbag config
|
||||
rosbag:
|
||||
topic_img_left: "/mynteye/left"
|
||||
topic_img_right: "/mynteye/right"
|
||||
topic_imu: "/mynteye/imu"
|
||||
topic_temp: "/mynteye/temp"
|
||||
topic_img_left: "/mynteye/left/image_raw"
|
||||
topic_img_right: "/mynteye/right/image_raw"
|
||||
topic_imu: "/mynteye/imu/data_raw"
|
||||
topic_temp: "/mynteye/temp/data_raw"
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
|
||||
<!-- node params -->
|
||||
|
||||
<arg name="left_topic" default="left" />
|
||||
<arg name="right_topic" default="right" />
|
||||
<arg name="left_rect_topic" default="left_rect" />
|
||||
<arg name="right_rect_topic" default="right_rect" />
|
||||
<arg name="disparity_topic" default="disparity" />
|
||||
<arg name="disparity_norm_topic" default="disparity_norm" />
|
||||
<arg name="points_topic" default="points" />
|
||||
<arg name="depth_topic" default="depth" />
|
||||
<arg name="left_topic" default="left/image_raw" />
|
||||
<arg name="right_topic" default="right/image_raw" />
|
||||
<arg name="left_rect_topic" default="left/image_rect" />
|
||||
<arg name="right_rect_topic" default="right/image_rect" />
|
||||
<arg name="disparity_topic" default="disparity/image_raw" />
|
||||
<arg name="disparity_norm_topic" default="disparity/image_norm" />
|
||||
<arg name="depth_topic" default="depth/image_raw" />
|
||||
<arg name="points_topic" default="points/data_raw" />
|
||||
|
||||
<arg name="imu_topic" default="imu" />
|
||||
<arg name="temp_topic" default="temp" />
|
||||
<arg name="imu_topic" default="imu/data_raw" />
|
||||
<arg name="temp_topic" default="temp/data_raw" />
|
||||
|
||||
<arg name="base_frame_id" default="$(arg mynteye)_link" />
|
||||
<arg name="left_frame_id" default="$(arg mynteye)_left_frame" />
|
||||
|
||||
@@ -55,7 +55,7 @@ Visualization Manager:
|
||||
Displays:
|
||||
- Class: rviz/Image
|
||||
Enabled: true
|
||||
Image Topic: /mynteye/left
|
||||
Image Topic: /mynteye/left/image_raw
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
@@ -67,7 +67,7 @@ Visualization Manager:
|
||||
Value: true
|
||||
- Class: rviz/Image
|
||||
Enabled: true
|
||||
Image Topic: /mynteye/right
|
||||
Image Topic: /mynteye/right/image_raw
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
@@ -81,7 +81,7 @@ Visualization Manager:
|
||||
Displays:
|
||||
- Class: rviz/Image
|
||||
Enabled: true
|
||||
Image Topic: /mynteye/left_rect
|
||||
Image Topic: /mynteye/left/image_rect
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
@@ -93,7 +93,7 @@ Visualization Manager:
|
||||
Value: true
|
||||
- Class: rviz/Image
|
||||
Enabled: true
|
||||
Image Topic: /mynteye/right_rect
|
||||
Image Topic: /mynteye/right/image_rect
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
@@ -111,7 +111,7 @@ Visualization Manager:
|
||||
Displays:
|
||||
- Class: rviz/Image
|
||||
Enabled: true
|
||||
Image Topic: /mynteye/disparity
|
||||
Image Topic: /mynteye/disparity/image_raw
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
@@ -123,7 +123,7 @@ Visualization Manager:
|
||||
Value: true
|
||||
- Class: rviz/Image
|
||||
Enabled: true
|
||||
Image Topic: /mynteye/disparity_norm
|
||||
Image Topic: /mynteye/disparity/image_norm
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
@@ -137,7 +137,7 @@ Visualization Manager:
|
||||
Name: Disparity
|
||||
- Class: rviz/Image
|
||||
Enabled: true
|
||||
Image Topic: /mynteye/depth
|
||||
Image Topic: /mynteye/depth/image_raw
|
||||
Max Value: 1
|
||||
Median window: 5
|
||||
Min Value: 0
|
||||
@@ -157,7 +157,7 @@ Visualization Manager:
|
||||
Channel Name: intensity
|
||||
Class: rviz/PointCloud2
|
||||
Color: 255; 255; 255
|
||||
Color Transformer: ""
|
||||
Color Transformer: RGB8
|
||||
Decay Time: 0
|
||||
Enabled: true
|
||||
Invert Rainbow: false
|
||||
@@ -166,13 +166,13 @@ Visualization Manager:
|
||||
Min Color: 0; 0; 0
|
||||
Min Intensity: 0
|
||||
Name: Points
|
||||
Position Transformer: ""
|
||||
Position Transformer: XYZ
|
||||
Queue Size: 10
|
||||
Selectable: true
|
||||
Size (Pixels): 3
|
||||
Size (m): 0.00999999978
|
||||
Style: Flat Squares
|
||||
Topic: /mynteye/points
|
||||
Topic: /mynteye/points/data_raw
|
||||
Unreliable: false
|
||||
Use Fixed Frame: true
|
||||
Use rainbow: true
|
||||
@@ -183,7 +183,7 @@ Visualization Manager:
|
||||
Enabled: false
|
||||
History Length: 1
|
||||
Name: Imu
|
||||
Topic: /mynteye/imu
|
||||
Topic: /mynteye/imu/data_raw
|
||||
Unreliable: false
|
||||
Value: false
|
||||
Enabled: true
|
||||
@@ -247,7 +247,7 @@ Window Geometry:
|
||||
collapsed: false
|
||||
LeftRect:
|
||||
collapsed: false
|
||||
QMainWindow State: 000000ff00000000fd00000004000000000000016a00000396fc020000000ffb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006100fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000002800000396000000d700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb00000008004c00650066007403000001bd000000860000024e00000190fb0000000a00520069006700680074030000040c000000860000025000000190fb00000010004c006500660074005200650063007402000001bd000002170000024e00000190fb00000012005200690067006800740052006500630074020000040c000002170000024f00000190fb0000000a0044006500700074006803000001bc000002170000024f00000190fb0000001200440069007300700061007200690074007902000001bd000002170000024e0000018ffb0000001a004400690073007000610072006900740079004e006f0072006d020000040c000002170000025100000190000000010000010f00000396fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000002800000396000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000073f0000003efc0100000002fb0000000800540069006d006501000000000000073f0000030000fffffffb0000000800540069006d00650100000000000004500000000000000000000004ba0000039600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
QMainWindow State: 000000ff00000000fd00000004000000000000017e00000396fc020000000ffb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006100fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000002800000396000000d700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb00000008004c00650066007403000001bd000000860000024e00000190fb0000000a00520069006700680074030000040c000000860000025000000190fb00000010004c006500660074005200650063007402000001bd000002170000024e00000190fb00000012005200690067006800740052006500630074020000040c000002170000024f00000190fb0000000a0044006500700074006803000001bc000002170000024f00000190fb0000001200440069007300700061007200690074007902000001bd000002170000024e0000018ffb0000001a004400690073007000610072006900740079004e006f0072006d020000040c000002170000025100000190000000010000010f00000396fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000002800000396000000ad00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e100000197000000030000073f0000003efc0100000002fb0000000800540069006d006501000000000000073f0000030000fffffffb0000000800540069006d00650100000000000004500000000000000000000004a60000039600000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
Right:
|
||||
collapsed: false
|
||||
RightRect:
|
||||
|
||||
@@ -71,6 +71,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 :(");
|
||||
@@ -242,10 +256,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
void publishTopics() {
|
||||
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 <<
|
||||
@@ -268,10 +279,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
|
||||
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);
|
||||
@@ -303,10 +311,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||
});
|
||||
|
||||
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
|
||||
@@ -413,9 +418,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);
|
||||
|
||||
Reference in New Issue
Block a user