From 1893ef382ae0eff0d2a57003a122a7d6402fc6ba Mon Sep 17 00:00:00 2001 From: Messier Date: Fri, 23 Aug 2019 15:28:56 +0800 Subject: [PATCH] change structure of folder samples and move demo_project --- samples/CMakeLists.txt | 184 +++++++++++++++++- samples/api/CMakeLists.txt | 37 ---- samples/{api/camera.cc => api_camera.cc} | 0 ...region.cc => api_get_depth_with_region.cc} | 0 ...o_exposure.cc => control_auto_exposure.cc} | 2 +- .../framerate.cc => control_framerate.cc} | 0 .../iic_address.cc => control_iic_address.cc} | 0 ...lter.cc => control_imu_low_pass_filter.cc} | 0 .../imu_range.cc => control_imu_range.cc} | 0 .../infrared.cc => control_infrared.cc} | 0 ...exposure.cc => control_manual_exposure.cc} | 2 +- ...timestamp.cc => control_sync_timestamp.cc} | 0 ...ect.cc => data_get_data_without_select.cc} | 0 .../data/get_depth.cc => data_get_depth.cc} | 0 ...device_info.cc => data_get_device_info.cc} | 0 ...get_disparity.cc => data_get_disparity.cc} | 0 ...allbacks.cc => data_get_from_callbacks.cc} | 2 +- ...t_img_params.cc => data_get_img_params.cc} | 0 .../data/get_imu.cc => data_get_imu.cc} | 2 +- ...ence.cc => data_get_imu_correspondence.cc} | 2 +- ...t_imu_params.cc => data_get_imu_params.cc} | 0 .../data/get_points.cc => data_get_points.cc} | 2 +- .../data/get_stereo.cc => data_get_stereo.cc} | 0 ...tified.cc => data_get_stereo_rectified.cc} | 0 ...with_plugin.cc => data_get_with_plugin.cc} | 0 ...gle_image.cc => data_save_single_image.cc} | 0 {platforms/win => samples/demo}/README.txt | 0 .../demo/project_cmake}/CMakeLists.txt | 0 .../demo/project_cmake}/mynteye_demo.cc | 0 .../demo/project_vs2017}/README.md | 0 .../demo/project_vs2017}/images/10_path.png | Bin .../demo/project_vs2017}/images/1_new_pro.png | Bin .../demo/project_vs2017}/images/2_new_pro.png | Bin .../demo/project_vs2017}/images/3_new_pro.png | Bin .../demo/project_vs2017}/images/4_config.png | Bin .../images/5_config_include.png | Bin .../images/6_config_lib_dir.png | Bin .../project_vs2017}/images/7_config_lib.png | Bin .../images/8_config_debug_lib.png | Bin .../demo/project_vs2017}/images/9_run_x64.png | Bin .../project_vs2017}/mynteyes_demo/.gitignore | 0 .../mynteyes_demo/mynteyes_demo.sln | 0 .../mynteyes_demo/mynteyes_demo.cpp | Bin .../mynteyes_demo/mynteyes_demo.vcxproj | 0 .../mynteyes_demo.vcxproj.filters | 0 .../mynteyes_demo/mynteyes_demo/stdafx.cpp | Bin .../mynteyes_demo/mynteyes_demo/stdafx.h | Bin .../mynteyes_demo/mynteyes_demo/targetver.h | Bin samples/device/CMakeLists.txt | 33 ---- .../{device/camera.cc => device_camera.cc} | 0 ...c => intermediate_get_depth_and_points.cc} | 4 +- samples/mynteye_demo.cc | 61 ++++++ samples/tutorials/CMakeLists.txt | 148 -------------- .../util/cv_painter.cc => util_cv_painter.cc} | 2 +- .../util/cv_painter.h => util_cv_painter.h} | 0 .../util/pc_viewer.cc => util_pc_viewer.cc} | 2 +- .../util/pc_viewer.h => util_pc_viewer.h} | 0 samples/uvc/CMakeLists.txt | 33 ---- samples/{uvc/camera.cc => uvc_camera.cc} | 0 59 files changed, 246 insertions(+), 270 deletions(-) delete mode 100644 samples/api/CMakeLists.txt rename samples/{api/camera.cc => api_camera.cc} (100%) rename samples/{api/get_depth_with_region.cc => api_get_depth_with_region.cc} (100%) rename samples/{tutorials/control/auto_exposure.cc => control_auto_exposure.cc} (99%) rename samples/{tutorials/control/framerate.cc => control_framerate.cc} (100%) rename samples/{tutorials/control/iic_address.cc => control_iic_address.cc} (100%) rename samples/{tutorials/control/imu_low_pass_filter.cc => control_imu_low_pass_filter.cc} (100%) rename samples/{tutorials/control/imu_range.cc => control_imu_range.cc} (100%) rename samples/{tutorials/control/infrared.cc => control_infrared.cc} (100%) rename samples/{tutorials/control/manual_exposure.cc => control_manual_exposure.cc} (99%) rename samples/{tutorials/control/sync_timestamp.cc => control_sync_timestamp.cc} (100%) rename samples/{tutorials/data/get_data_without_select.cc => data_get_data_without_select.cc} (100%) rename samples/{tutorials/data/get_depth.cc => data_get_depth.cc} (100%) rename samples/{tutorials/data/get_device_info.cc => data_get_device_info.cc} (100%) rename samples/{tutorials/data/get_disparity.cc => data_get_disparity.cc} (100%) rename samples/{tutorials/data/get_from_callbacks.cc => data_get_from_callbacks.cc} (99%) rename samples/{tutorials/data/get_img_params.cc => data_get_img_params.cc} (100%) rename samples/{tutorials/data/get_imu.cc => data_get_imu.cc} (98%) rename samples/{tutorials/data/get_imu_correspondence.cc => data_get_imu_correspondence.cc} (99%) rename samples/{tutorials/data/get_imu_params.cc => data_get_imu_params.cc} (100%) rename samples/{tutorials/data/get_points.cc => data_get_points.cc} (98%) rename samples/{tutorials/data/get_stereo.cc => data_get_stereo.cc} (100%) rename samples/{tutorials/data/get_stereo_rectified.cc => data_get_stereo_rectified.cc} (100%) rename samples/{tutorials/data/get_with_plugin.cc => data_get_with_plugin.cc} (100%) rename samples/{tutorials/data/save_single_image.cc => data_save_single_image.cc} (100%) rename {platforms/win => samples/demo}/README.txt (100%) rename {platforms/projects/cmake => samples/demo/project_cmake}/CMakeLists.txt (100%) rename {platforms/projects/cmake => samples/demo/project_cmake}/mynteye_demo.cc (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/README.md (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/10_path.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/1_new_pro.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/2_new_pro.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/3_new_pro.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/4_config.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/5_config_include.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/6_config_lib_dir.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/7_config_lib.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/8_config_debug_lib.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/images/9_run_x64.png (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/mynteyes_demo/.gitignore (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/mynteyes_demo/mynteyes_demo.sln (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/mynteyes_demo/mynteyes_demo/mynteyes_demo.cpp (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj.filters (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/mynteyes_demo/mynteyes_demo/stdafx.cpp (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/mynteyes_demo/mynteyes_demo/stdafx.h (100%) rename {platforms/projects/vs2017 => samples/demo/project_vs2017}/mynteyes_demo/mynteyes_demo/targetver.h (100%) delete mode 100644 samples/device/CMakeLists.txt rename samples/{device/camera.cc => device_camera.cc} (100%) rename samples/{tutorials/intermediate/get_depth_and_points.cc => intermediate_get_depth_and_points.cc} (99%) create mode 100644 samples/mynteye_demo.cc delete mode 100644 samples/tutorials/CMakeLists.txt rename samples/{tutorials/util/cv_painter.cc => util_cv_painter.cc} (99%) rename samples/{tutorials/util/cv_painter.h => util_cv_painter.h} (100%) rename samples/{tutorials/util/pc_viewer.cc => util_pc_viewer.cc} (99%) rename samples/{tutorials/util/pc_viewer.h => util_pc_viewer.h} (100%) delete mode 100644 samples/uvc/CMakeLists.txt rename samples/{uvc/camera.cc => uvc_camera.cc} (100%) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index c17feff..1ea4d0b 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -59,28 +59,194 @@ endif() #LIST(APPEND CMAKE_MODULE_PATH ${PRO_DIR}/cmake) + + + # targets set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output") + +include_directories( + ${PRO_DIR}/src +) + +set_outdir( + "${OUT_DIR}/lib" + "${OUT_DIR}/lib" + "${OUT_DIR}/bin" +) + if(OS_MAC) # samples above uvc layer - add_subdirectory(uvc) + make_executable(camera_u + SRCS uvc_camera.cc + LINK_LIBS mynteye ${OpenCV_LIBS} + DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} + ) else() # samples above device layer - add_subdirectory(device) - - # tutorials - - if(WITH_API) - add_subdirectory(tutorials) - endif() + make_executable(camera_use_device + SRCS device_camera.cc + LINK_LIBS mynteye ${OpenCV_LIBS} + DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} + ) # samples above api layer if(WITH_API) - add_subdirectory(api) + ## camera_a + + make_executable(camera_use_api + SRCS api_camera.cc + LINK_LIBS mynteye ${OpenCV_LIBS} + DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} + ) + + ## get_depth_with_region + + make_executable(get_depth_with_region + SRCS api_get_depth_with_region.cc + LINK_LIBS mynteye ${OpenCV_LIBS} + DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} + ) endif() endif() + + + +# targets + +include_directories( + ${OpenCV_INCLUDE_DIRS} +) + + +# tutorials + +if(WITH_API) + + # make_executable2(NAME + # [SRCS src1 src2 ...] + # [WITH_OPENCV] + # [WITH_PCL]) + macro(make_executable2 NAME) + set(options WITH_OPENCV WITH_PCL) + set(oneValueArgs) + set(multiValueArgs SRCS) + cmake_parse_arguments(THIS "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN}) + + set(__link_libs mynteye) + set(__dll_search_paths ${PRO_DIR}/_install/bin) + if(THIS_WITH_OPENCV) + list(APPEND __link_libs ${OpenCV_LIBS}) + list(APPEND __dll_search_paths ${OpenCV_LIB_SEARCH_PATH}) + endif() + if(THIS_WITH_PCL) + list(APPEND __link_libs ${PCL_LIBRARIES}) + #list(APPEND __link_libs pcl::pcl) + list(APPEND __dll_search_paths ${PCL_LIB_SEARCH_PATH}) + endif() + + add_executable(${NAME} ${THIS_SRCS}) + target_link_libraries(${NAME} ${__link_libs}) + target_create_scripts(${NAME} DLL_SEARCH_PATHS ${__dll_search_paths}) + + if(THIS_WITH_PCL) + target_include_directories(${NAME} PRIVATE ${PCL_INCLUDE_DIRS}) + #target_compile_definitions(${NAME} PRIVATE ${PCL_DEFINITIONS}) + #target_compile_options(${NAME} PRIVATE ${PCL_COMPILE_OPTIONS}) + endif() + if(OS_WIN) + target_compile_definitions(${NAME} + PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES + ) + endif() + endmacro() + + # packages + + # If you install PCL to different directory, please set CMAKE_PREFIX_PATH to find it. + #LIST(APPEND CMAKE_PREFIX_PATH /usr/local/share) + find_package(PCL) + if(PCL_FOUND) + message(STATUS "Found PCL: ${PCL_VERSION}") + + #message(STATUS "PCL_LIBRARIES: ${PCL_LIBRARIES}") + #message(STATUS "PCL_INCLUDE_DIRS: ${PCL_INCLUDE_DIRS}") + #message(STATUS "PCL_LIBRARY_DIRS: ${PCL_LIBRARY_DIRS}") + #message(STATUS "PCL_DEFINITIONS: ${PCL_DEFINITIONS}") + #message(STATUS "PCL_COMPILE_OPTIONS: ${PCL_COMPILE_OPTIONS}") + + if(OS_WIN) + get_filename_component(PCL_LIB_SEARCH_PATH "${PCL_LIBRARY_DIRS}/../bin" ABSOLUTE) + else() + set(PCL_LIB_SEARCH_PATH "${PCL_LIBRARY_DIRS}") + endif() + else() + message(WARNING "PCL not found :(") + endif() + + # beginner level + + ## 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) + make_executable2(get_disparity SRCS data_get_disparity.cc WITH_OPENCV) + make_executable2(get_depth SRCS data_get_depth.cc WITH_OPENCV) + + make_executable2(get_data_without_select SRCS data_get_data_without_select.cc WITH_OPENCV) + if(PCL_FOUND) + make_executable2(get_points + SRCS data_get_points.cc util_pc_viewer.cc + WITH_OPENCV WITH_PCL + ) + endif() + make_executable2(get_imu_correspondence + SRCS data_get_imu_correspondence.cc util_cv_painter.cc + WITH_OPENCV + ) + make_executable2(get_imu SRCS data_get_imu.cc util_cv_painter.cc WITH_OPENCV) + make_executable2(save_single_image SRCS data_save_single_image.cc WITH_OPENCV) + make_executable2(get_from_callbacks + SRCS data_get_from_callbacks.cc util_cv_painter.cc + WITH_OPENCV + ) + make_executable2(get_with_plugin SRCS data_get_with_plugin.cc WITH_OPENCV) + + ## control + + make_executable2(ctrl_framerate SRCS control_framerate.cc WITH_OPENCV) + make_executable2(ctrl_imu_low_pass_filter SRCS control_imu_low_pass_filter.cc WITH_OPENCV) + make_executable2(ctrl_imu_range SRCS control_imu_range.cc WITH_OPENCV) + make_executable2(ctrl_infrared SRCS control_infrared.cc WITH_OPENCV) + make_executable2(ctrl_iic_adress SRCS control_iic_address.cc WITH_OPENCV) + make_executable2(ctrl_sync_timestamp SRCS control_sync_timestamp.cc WITH_OPENCV) + make_executable2(ctrl_auto_exposure + SRCS control_auto_exposure.cc util_cv_painter.cc + WITH_OPENCV + ) + make_executable2(ctrl_manual_exposure + SRCS control_manual_exposure.cc util_cv_painter.cc + WITH_OPENCV + ) + + if(PCL_FOUND) + + 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() + + diff --git a/samples/api/CMakeLists.txt b/samples/api/CMakeLists.txt deleted file mode 100644 index 8100370..0000000 --- a/samples/api/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# 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. - -get_filename_component(DIR_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) - -set_outdir( - "${OUT_DIR}/lib/${DIR_NAME}" - "${OUT_DIR}/lib/${DIR_NAME}" - "${OUT_DIR}/bin/${DIR_NAME}" -) - -## camera_a - -make_executable(camera_a - SRCS camera.cc - LINK_LIBS mynteye ${OpenCV_LIBS} - DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} -) - -## get_depth_with_region - -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} -) diff --git a/samples/api/camera.cc b/samples/api_camera.cc similarity index 100% rename from samples/api/camera.cc rename to samples/api_camera.cc diff --git a/samples/api/get_depth_with_region.cc b/samples/api_get_depth_with_region.cc similarity index 100% rename from samples/api/get_depth_with_region.cc rename to samples/api_get_depth_with_region.cc diff --git a/samples/tutorials/control/auto_exposure.cc b/samples/control_auto_exposure.cc similarity index 99% rename from samples/tutorials/control/auto_exposure.cc rename to samples/control_auto_exposure.cc index 4e23030..f506a78 100644 --- a/samples/tutorials/control/auto_exposure.cc +++ b/samples/control_auto_exposure.cc @@ -16,7 +16,7 @@ #include "mynteye/logger.h" #include "mynteye/api/api.h" -#include "util/cv_painter.h" +#include "util_cv_painter.h" MYNTEYE_USE_NAMESPACE diff --git a/samples/tutorials/control/framerate.cc b/samples/control_framerate.cc similarity index 100% rename from samples/tutorials/control/framerate.cc rename to samples/control_framerate.cc diff --git a/samples/tutorials/control/iic_address.cc b/samples/control_iic_address.cc similarity index 100% rename from samples/tutorials/control/iic_address.cc rename to samples/control_iic_address.cc diff --git a/samples/tutorials/control/imu_low_pass_filter.cc b/samples/control_imu_low_pass_filter.cc similarity index 100% rename from samples/tutorials/control/imu_low_pass_filter.cc rename to samples/control_imu_low_pass_filter.cc diff --git a/samples/tutorials/control/imu_range.cc b/samples/control_imu_range.cc similarity index 100% rename from samples/tutorials/control/imu_range.cc rename to samples/control_imu_range.cc diff --git a/samples/tutorials/control/infrared.cc b/samples/control_infrared.cc similarity index 100% rename from samples/tutorials/control/infrared.cc rename to samples/control_infrared.cc diff --git a/samples/tutorials/control/manual_exposure.cc b/samples/control_manual_exposure.cc similarity index 99% rename from samples/tutorials/control/manual_exposure.cc rename to samples/control_manual_exposure.cc index d196719..1471e67 100644 --- a/samples/tutorials/control/manual_exposure.cc +++ b/samples/control_manual_exposure.cc @@ -16,7 +16,7 @@ #include "mynteye/logger.h" #include "mynteye/api/api.h" -#include "util/cv_painter.h" +#include "util_cv_painter.h" MYNTEYE_USE_NAMESPACE diff --git a/samples/tutorials/control/sync_timestamp.cc b/samples/control_sync_timestamp.cc similarity index 100% rename from samples/tutorials/control/sync_timestamp.cc rename to samples/control_sync_timestamp.cc diff --git a/samples/tutorials/data/get_data_without_select.cc b/samples/data_get_data_without_select.cc similarity index 100% rename from samples/tutorials/data/get_data_without_select.cc rename to samples/data_get_data_without_select.cc diff --git a/samples/tutorials/data/get_depth.cc b/samples/data_get_depth.cc similarity index 100% rename from samples/tutorials/data/get_depth.cc rename to samples/data_get_depth.cc diff --git a/samples/tutorials/data/get_device_info.cc b/samples/data_get_device_info.cc similarity index 100% rename from samples/tutorials/data/get_device_info.cc rename to samples/data_get_device_info.cc diff --git a/samples/tutorials/data/get_disparity.cc b/samples/data_get_disparity.cc similarity index 100% rename from samples/tutorials/data/get_disparity.cc rename to samples/data_get_disparity.cc diff --git a/samples/tutorials/data/get_from_callbacks.cc b/samples/data_get_from_callbacks.cc similarity index 99% rename from samples/tutorials/data/get_from_callbacks.cc rename to samples/data_get_from_callbacks.cc index b1effcc..b0d166e 100644 --- a/samples/tutorials/data/get_from_callbacks.cc +++ b/samples/data_get_from_callbacks.cc @@ -21,7 +21,7 @@ #include "mynteye/logger.h" #include "mynteye/api/api.h" -#include "util/cv_painter.h" +#include "util_cv_painter.h" MYNTEYE_USE_NAMESPACE diff --git a/samples/tutorials/data/get_img_params.cc b/samples/data_get_img_params.cc similarity index 100% rename from samples/tutorials/data/get_img_params.cc rename to samples/data_get_img_params.cc diff --git a/samples/tutorials/data/get_imu.cc b/samples/data_get_imu.cc similarity index 98% rename from samples/tutorials/data/get_imu.cc rename to samples/data_get_imu.cc index 99ea685..258637a 100644 --- a/samples/tutorials/data/get_imu.cc +++ b/samples/data_get_imu.cc @@ -16,7 +16,7 @@ #include "mynteye/logger.h" #include "mynteye/api/api.h" -#include "util/cv_painter.h" +#include "util_cv_painter.h" MYNTEYE_USE_NAMESPACE diff --git a/samples/tutorials/data/get_imu_correspondence.cc b/samples/data_get_imu_correspondence.cc similarity index 99% rename from samples/tutorials/data/get_imu_correspondence.cc rename to samples/data_get_imu_correspondence.cc index 3a2e184..ded1391 100644 --- a/samples/tutorials/data/get_imu_correspondence.cc +++ b/samples/data_get_imu_correspondence.cc @@ -16,7 +16,7 @@ #include "mynteye/logger.h" #include "mynteye/api/api.h" -#include "util/cv_painter.h" +#include "util_cv_painter.h" // #define CHECK_ACCEL_THEN_GYRO #define SEQ_FIRST 1 // accel diff --git a/samples/tutorials/data/get_imu_params.cc b/samples/data_get_imu_params.cc similarity index 100% rename from samples/tutorials/data/get_imu_params.cc rename to samples/data_get_imu_params.cc diff --git a/samples/tutorials/data/get_points.cc b/samples/data_get_points.cc similarity index 98% rename from samples/tutorials/data/get_points.cc rename to samples/data_get_points.cc index aa2558a..668ad40 100644 --- a/samples/tutorials/data/get_points.cc +++ b/samples/data_get_points.cc @@ -16,7 +16,7 @@ #include "mynteye/api/api.h" -#include "util/pc_viewer.h" +#include "util_pc_viewer.h" MYNTEYE_USE_NAMESPACE diff --git a/samples/tutorials/data/get_stereo.cc b/samples/data_get_stereo.cc similarity index 100% rename from samples/tutorials/data/get_stereo.cc rename to samples/data_get_stereo.cc diff --git a/samples/tutorials/data/get_stereo_rectified.cc b/samples/data_get_stereo_rectified.cc similarity index 100% rename from samples/tutorials/data/get_stereo_rectified.cc rename to samples/data_get_stereo_rectified.cc diff --git a/samples/tutorials/data/get_with_plugin.cc b/samples/data_get_with_plugin.cc similarity index 100% rename from samples/tutorials/data/get_with_plugin.cc rename to samples/data_get_with_plugin.cc diff --git a/samples/tutorials/data/save_single_image.cc b/samples/data_save_single_image.cc similarity index 100% rename from samples/tutorials/data/save_single_image.cc rename to samples/data_save_single_image.cc diff --git a/platforms/win/README.txt b/samples/demo/README.txt similarity index 100% rename from platforms/win/README.txt rename to samples/demo/README.txt diff --git a/platforms/projects/cmake/CMakeLists.txt b/samples/demo/project_cmake/CMakeLists.txt similarity index 100% rename from platforms/projects/cmake/CMakeLists.txt rename to samples/demo/project_cmake/CMakeLists.txt diff --git a/platforms/projects/cmake/mynteye_demo.cc b/samples/demo/project_cmake/mynteye_demo.cc similarity index 100% rename from platforms/projects/cmake/mynteye_demo.cc rename to samples/demo/project_cmake/mynteye_demo.cc diff --git a/platforms/projects/vs2017/README.md b/samples/demo/project_vs2017/README.md similarity index 100% rename from platforms/projects/vs2017/README.md rename to samples/demo/project_vs2017/README.md diff --git a/platforms/projects/vs2017/images/10_path.png b/samples/demo/project_vs2017/images/10_path.png similarity index 100% rename from platforms/projects/vs2017/images/10_path.png rename to samples/demo/project_vs2017/images/10_path.png diff --git a/platforms/projects/vs2017/images/1_new_pro.png b/samples/demo/project_vs2017/images/1_new_pro.png similarity index 100% rename from platforms/projects/vs2017/images/1_new_pro.png rename to samples/demo/project_vs2017/images/1_new_pro.png diff --git a/platforms/projects/vs2017/images/2_new_pro.png b/samples/demo/project_vs2017/images/2_new_pro.png similarity index 100% rename from platforms/projects/vs2017/images/2_new_pro.png rename to samples/demo/project_vs2017/images/2_new_pro.png diff --git a/platforms/projects/vs2017/images/3_new_pro.png b/samples/demo/project_vs2017/images/3_new_pro.png similarity index 100% rename from platforms/projects/vs2017/images/3_new_pro.png rename to samples/demo/project_vs2017/images/3_new_pro.png diff --git a/platforms/projects/vs2017/images/4_config.png b/samples/demo/project_vs2017/images/4_config.png similarity index 100% rename from platforms/projects/vs2017/images/4_config.png rename to samples/demo/project_vs2017/images/4_config.png diff --git a/platforms/projects/vs2017/images/5_config_include.png b/samples/demo/project_vs2017/images/5_config_include.png similarity index 100% rename from platforms/projects/vs2017/images/5_config_include.png rename to samples/demo/project_vs2017/images/5_config_include.png diff --git a/platforms/projects/vs2017/images/6_config_lib_dir.png b/samples/demo/project_vs2017/images/6_config_lib_dir.png similarity index 100% rename from platforms/projects/vs2017/images/6_config_lib_dir.png rename to samples/demo/project_vs2017/images/6_config_lib_dir.png diff --git a/platforms/projects/vs2017/images/7_config_lib.png b/samples/demo/project_vs2017/images/7_config_lib.png similarity index 100% rename from platforms/projects/vs2017/images/7_config_lib.png rename to samples/demo/project_vs2017/images/7_config_lib.png diff --git a/platforms/projects/vs2017/images/8_config_debug_lib.png b/samples/demo/project_vs2017/images/8_config_debug_lib.png similarity index 100% rename from platforms/projects/vs2017/images/8_config_debug_lib.png rename to samples/demo/project_vs2017/images/8_config_debug_lib.png diff --git a/platforms/projects/vs2017/images/9_run_x64.png b/samples/demo/project_vs2017/images/9_run_x64.png similarity index 100% rename from platforms/projects/vs2017/images/9_run_x64.png rename to samples/demo/project_vs2017/images/9_run_x64.png diff --git a/platforms/projects/vs2017/mynteyes_demo/.gitignore b/samples/demo/project_vs2017/mynteyes_demo/.gitignore similarity index 100% rename from platforms/projects/vs2017/mynteyes_demo/.gitignore rename to samples/demo/project_vs2017/mynteyes_demo/.gitignore diff --git a/platforms/projects/vs2017/mynteyes_demo/mynteyes_demo.sln b/samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo.sln similarity index 100% rename from platforms/projects/vs2017/mynteyes_demo/mynteyes_demo.sln rename to samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo.sln diff --git a/platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.cpp b/samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.cpp similarity index 100% rename from platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.cpp rename to samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.cpp diff --git a/platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj b/samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj similarity index 100% rename from platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj rename to samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj diff --git a/platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj.filters b/samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj.filters similarity index 100% rename from platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj.filters rename to samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/mynteyes_demo.vcxproj.filters diff --git a/platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/stdafx.cpp b/samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/stdafx.cpp similarity index 100% rename from platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/stdafx.cpp rename to samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/stdafx.cpp diff --git a/platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/stdafx.h b/samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/stdafx.h similarity index 100% rename from platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/stdafx.h rename to samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/stdafx.h diff --git a/platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/targetver.h b/samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/targetver.h similarity index 100% rename from platforms/projects/vs2017/mynteyes_demo/mynteyes_demo/targetver.h rename to samples/demo/project_vs2017/mynteyes_demo/mynteyes_demo/targetver.h diff --git a/samples/device/CMakeLists.txt b/samples/device/CMakeLists.txt deleted file mode 100644 index cf7ac72..0000000 --- a/samples/device/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# 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. - -get_filename_component(DIR_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) - -include_directories( - ${PRO_DIR}/src -) - -set_outdir( - "${OUT_DIR}/lib/${DIR_NAME}" - "${OUT_DIR}/lib/${DIR_NAME}" - "${OUT_DIR}/bin/${DIR_NAME}" -) - -## camera_d - -make_executable(camera_d - SRCS camera.cc - LINK_LIBS mynteye ${OpenCV_LIBS} - DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} -) diff --git a/samples/device/camera.cc b/samples/device_camera.cc similarity index 100% rename from samples/device/camera.cc rename to samples/device_camera.cc diff --git a/samples/tutorials/intermediate/get_depth_and_points.cc b/samples/intermediate_get_depth_and_points.cc similarity index 99% rename from samples/tutorials/intermediate/get_depth_and_points.cc rename to samples/intermediate_get_depth_and_points.cc index 805d806..d13b3ed 100644 --- a/samples/tutorials/intermediate/get_depth_and_points.cc +++ b/samples/intermediate_get_depth_and_points.cc @@ -17,8 +17,8 @@ // #include "mynteye/logger.h" #include "mynteye/api/api.h" -#include "util/cv_painter.h" -#include "util/pc_viewer.h" +#include "util_cv_painter.h" +#include "util_pc_viewer.h" namespace { diff --git a/samples/mynteye_demo.cc b/samples/mynteye_demo.cc new file mode 100644 index 0000000..ee06f33 --- /dev/null +++ b/samples/mynteye_demo.cc @@ -0,0 +1,61 @@ +// 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 +#include + +#include "mynteye/api/api.h" + +MYNTEYE_USE_NAMESPACE + +int main(int argc, char const *argv[]) { + auto &&api = API::Create(0, nullptr); + if (!api) return 1; + + bool ok; + auto &&request = api->SelectStreamRequest(&ok); + if (!ok) return 1; + api->ConfigStreamRequest(request); + api->Start(Source::VIDEO_STREAMING); + + double fps; + double t = 0.01; + std::cout << "fps:" << std::endl; + + cv::namedWindow("frame"); + + while (true) { + api->WaitForStreams(); + + auto &&left_data = api->GetStreamData(Stream::LEFT); + auto &&right_data = api->GetStreamData(Stream::RIGHT); + + cv::Mat img; + if (!left_data.frame.empty() && !right_data.frame.empty()) { + double t_c = cv::getTickCount() / cv::getTickFrequency(); + fps = 1.0/(t_c - t); + printf("\b\b\b\b\b\b\b\b\b%.2f", fps); + t = t_c; + cv::hconcat(left_data.frame, right_data.frame, img); + cv::imshow("frame", img); + } + + char key = static_cast(cv::waitKey(1)); + if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q + break; + } + } + + api->Stop(Source::VIDEO_STREAMING); + return 0; +} diff --git a/samples/tutorials/CMakeLists.txt b/samples/tutorials/CMakeLists.txt deleted file mode 100644 index e50216f..0000000 --- a/samples/tutorials/CMakeLists.txt +++ /dev/null @@ -1,148 +0,0 @@ -# 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. - -get_filename_component(DIR_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${PRO_DIR}/src -) - -set_outdir( - "${OUT_DIR}/lib/${DIR_NAME}" - "${OUT_DIR}/lib/${DIR_NAME}" - "${OUT_DIR}/bin/${DIR_NAME}" -) - -# make_executable2(NAME -# [SRCS src1 src2 ...] -# [WITH_OPENCV] -# [WITH_PCL]) -macro(make_executable2 NAME) - set(options WITH_OPENCV WITH_PCL) - set(oneValueArgs) - set(multiValueArgs SRCS) - cmake_parse_arguments(THIS "${options}" "${oneValueArgs}" - "${multiValueArgs}" ${ARGN}) - - set(__link_libs mynteye) - set(__dll_search_paths ${PRO_DIR}/_install/bin) - if(THIS_WITH_OPENCV) - list(APPEND __link_libs ${OpenCV_LIBS}) - list(APPEND __dll_search_paths ${OpenCV_LIB_SEARCH_PATH}) - endif() - if(THIS_WITH_PCL) - list(APPEND __link_libs ${PCL_LIBRARIES}) - #list(APPEND __link_libs pcl::pcl) - list(APPEND __dll_search_paths ${PCL_LIB_SEARCH_PATH}) - endif() - - add_executable(${NAME} ${THIS_SRCS}) - target_link_libraries(${NAME} ${__link_libs}) - target_create_scripts(${NAME} DLL_SEARCH_PATHS ${__dll_search_paths}) - - if(THIS_WITH_PCL) - target_include_directories(${NAME} PRIVATE ${PCL_INCLUDE_DIRS}) - #target_compile_definitions(${NAME} PRIVATE ${PCL_DEFINITIONS}) - #target_compile_options(${NAME} PRIVATE ${PCL_COMPILE_OPTIONS}) - endif() - if(OS_WIN) - target_compile_definitions(${NAME} - PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES - ) - endif() -endmacro() - -# packages - -# If you install PCL to different directory, please set CMAKE_PREFIX_PATH to find it. -#LIST(APPEND CMAKE_PREFIX_PATH /usr/local/share) -find_package(PCL) -if(PCL_FOUND) - message(STATUS "Found PCL: ${PCL_VERSION}") - - #message(STATUS "PCL_LIBRARIES: ${PCL_LIBRARIES}") - #message(STATUS "PCL_INCLUDE_DIRS: ${PCL_INCLUDE_DIRS}") - #message(STATUS "PCL_LIBRARY_DIRS: ${PCL_LIBRARY_DIRS}") - #message(STATUS "PCL_DEFINITIONS: ${PCL_DEFINITIONS}") - #message(STATUS "PCL_COMPILE_OPTIONS: ${PCL_COMPILE_OPTIONS}") - - if(OS_WIN) - get_filename_component(PCL_LIB_SEARCH_PATH "${PCL_LIBRARY_DIRS}/../bin" ABSOLUTE) - else() - set(PCL_LIB_SEARCH_PATH "${PCL_LIBRARY_DIRS}") - endif() -else() - message(WARNING "PCL not found :(") -endif() - -# beginner level - -## 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) -make_executable2(get_disparity SRCS data/get_disparity.cc WITH_OPENCV) -make_executable2(get_depth SRCS data/get_depth.cc WITH_OPENCV) - -make_executable2(get_data_without_select SRCS data/get_data_without_select.cc WITH_OPENCV) -if(PCL_FOUND) - make_executable2(get_points - SRCS data/get_points.cc util/pc_viewer.cc - WITH_OPENCV WITH_PCL - ) -endif() -make_executable2(get_imu_correspondence - SRCS data/get_imu_correspondence.cc util/cv_painter.cc - WITH_OPENCV -) -make_executable2(get_imu SRCS data/get_imu.cc util/cv_painter.cc WITH_OPENCV) -make_executable2(save_single_image SRCS data/save_single_image.cc WITH_OPENCV) -make_executable2(get_from_callbacks - SRCS data/get_from_callbacks.cc util/cv_painter.cc - WITH_OPENCV -) -make_executable2(get_with_plugin SRCS data/get_with_plugin.cc WITH_OPENCV) - -## control - -make_executable2(ctrl_framerate SRCS control/framerate.cc WITH_OPENCV) -make_executable2(ctrl_imu_low_pass_filter SRCS control/imu_low_pass_filter.cc WITH_OPENCV) -make_executable2(ctrl_imu_range SRCS control/imu_range.cc WITH_OPENCV) -make_executable2(ctrl_infrared SRCS control/infrared.cc WITH_OPENCV) -make_executable2(ctrl_iic_adress SRCS control/iic_address.cc WITH_OPENCV) -make_executable2(ctrl_sync_timestamp SRCS control/sync_timestamp.cc WITH_OPENCV) -make_executable2(ctrl_auto_exposure - SRCS control/auto_exposure.cc util/cv_painter.cc - WITH_OPENCV -) -make_executable2(ctrl_manual_exposure - SRCS control/manual_exposure.cc util/cv_painter.cc - WITH_OPENCV -) - -if(PCL_FOUND) - -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() - -# advanced level diff --git a/samples/tutorials/util/cv_painter.cc b/samples/util_cv_painter.cc similarity index 99% rename from samples/tutorials/util/cv_painter.cc rename to samples/util_cv_painter.cc index d5a1271..ac14c4d 100644 --- a/samples/tutorials/util/cv_painter.cc +++ b/samples/util_cv_painter.cc @@ -11,7 +11,7 @@ // 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 "util/cv_painter.h" +#include "util_cv_painter.h" #include #include diff --git a/samples/tutorials/util/cv_painter.h b/samples/util_cv_painter.h similarity index 100% rename from samples/tutorials/util/cv_painter.h rename to samples/util_cv_painter.h diff --git a/samples/tutorials/util/pc_viewer.cc b/samples/util_pc_viewer.cc similarity index 99% rename from samples/tutorials/util/pc_viewer.cc rename to samples/util_pc_viewer.cc index bec96dc..e936aaa 100644 --- a/samples/tutorials/util/pc_viewer.cc +++ b/samples/util_pc_viewer.cc @@ -11,7 +11,7 @@ // 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 "util/pc_viewer.h" +#include "util_pc_viewer.h" // #include diff --git a/samples/tutorials/util/pc_viewer.h b/samples/util_pc_viewer.h similarity index 100% rename from samples/tutorials/util/pc_viewer.h rename to samples/util_pc_viewer.h diff --git a/samples/uvc/CMakeLists.txt b/samples/uvc/CMakeLists.txt deleted file mode 100644 index 8f93438..0000000 --- a/samples/uvc/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# 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. - -get_filename_component(DIR_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) - -set_outdir( - "${OUT_DIR}/lib/${DIR_NAME}" - "${OUT_DIR}/lib/${DIR_NAME}" - "${OUT_DIR}/bin/${DIR_NAME}" -) - -include_directories( - ${PRO_DIR}/src -) - -## camera_u - -make_executable(camera_u - SRCS camera.cc - LINK_LIBS mynteye ${OpenCV_LIBS} - DLL_SEARCH_PATHS ${PRO_DIR}/_install/bin ${OpenCV_LIB_SEARCH_PATH} -) diff --git a/samples/uvc/camera.cc b/samples/uvc_camera.cc similarity index 100% rename from samples/uvc/camera.cc rename to samples/uvc_camera.cc