From 63e9dda1b24df565b908abf9ef41a1f74ab11f65 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Wed, 13 Feb 2019 10:05:38 +0800 Subject: [PATCH 1/9] fix(cv): 4.x error , shield the old algorithm temporarily when complie --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0a727f..878617a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,7 @@ endif() ## camodocal -if(WITH_CAM_MODELS) +if(WITH_CAM_MODELS AND (NOT WITH_OPENCV4)) set(EIGEN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty) message(STATUS "EIGEN_INCLUDE_DIR: ${EIGEN_INCLUDE_DIR}") @@ -220,7 +220,7 @@ if(WITH_API) src/mynteye/api/processor/rectify_processor_ocv.cc src/mynteye/api/config.cc ) - if(WITH_CAM_MODELS) + if(WITH_CAM_MODELS AND (NOT WITH_OPENCV4)) list(APPEND MYNTEYE_SRCS src/mynteye/api/processor/depth_processor.cc src/mynteye/api/processor/points_processor.cc From 5d5dc0b7aadbd236c90e9cc4add73bee5a99993f Mon Sep 17 00:00:00 2001 From: TinyOh Date: Wed, 13 Feb 2019 10:47:39 +0800 Subject: [PATCH 2/9] fix(cv): 4.x error , add macro shield part --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 878617a..1ff3fc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,15 @@ endif() ## camodocal -if(WITH_CAM_MODELS AND (NOT WITH_OPENCV4)) +if(WITH_OPENCV4) + message(STATUS "opencv4 calib models not supported") + include_directories( + src/mynteye/api/camodocal/include + ) + ADD_DEFINITIONS(-DWITH_CAM_MODELS=OFF) +endif() + +if(WITH_CAM_MODELS) set(EIGEN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty) message(STATUS "EIGEN_INCLUDE_DIR: ${EIGEN_INCLUDE_DIR}") @@ -220,7 +228,7 @@ if(WITH_API) src/mynteye/api/processor/rectify_processor_ocv.cc src/mynteye/api/config.cc ) - if(WITH_CAM_MODELS AND (NOT WITH_OPENCV4)) + if(WITH_CAM_MODELS) list(APPEND MYNTEYE_SRCS src/mynteye/api/processor/depth_processor.cc src/mynteye/api/processor/points_processor.cc From f1beee93c15e8c9ab30ec32733d71e3c4c71b7a1 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Wed, 13 Feb 2019 11:13:47 +0800 Subject: [PATCH 3/9] fix(complie): 4.x cv error --- CMakeLists.txt | 14 -------------- cmake/Option.cmake | 5 ++++- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ff3fc4..cc2c310 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,14 +130,6 @@ endif() ## camodocal -if(WITH_OPENCV4) - message(STATUS "opencv4 calib models not supported") - include_directories( - src/mynteye/api/camodocal/include - ) - ADD_DEFINITIONS(-DWITH_CAM_MODELS=OFF) -endif() - if(WITH_CAM_MODELS) set(EIGEN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty) message(STATUS "EIGEN_INCLUDE_DIR: ${EIGEN_INCLUDE_DIR}") @@ -324,12 +316,6 @@ if(NOT WITH_GLOG) DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR} ) endif() -# if(WITH_CAM_MODELS) -# install(FILES -# ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/glog/logging.h -# DESTINATION ${MYNTEYE_CMAKE_INCLUDE_DIR}/glog -# ) -# endif() install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/deprecated/mynteye/callbacks.h diff --git a/cmake/Option.cmake b/cmake/Option.cmake index 0cb363f..6598edc 100644 --- a/cmake/Option.cmake +++ b/cmake/Option.cmake @@ -34,9 +34,12 @@ option(WITH_BOOST "Include Boost support" ON) option(WITH_GLOG "Include glog support" OFF) # packages - if(WITH_API) include(${CMAKE_CURRENT_LIST_DIR}/DetectOpenCV.cmake) + set(WITH_OPENCV4 true) + if(WITH_OPENCV4) + set(WITH_CAM_MODELS OFF) + endif() else() # Disable WITH_CAM_MODELS if WITH_API is OFF set(WITH_CAM_MODELS OFF) From 6690f240955450c4c38df1a92178cda063186f5a Mon Sep 17 00:00:00 2001 From: TinyOh Date: Wed, 13 Feb 2019 14:55:09 +0800 Subject: [PATCH 4/9] fix(models): unused debug tag --- cmake/Option.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/Option.cmake b/cmake/Option.cmake index 6598edc..658915b 100644 --- a/cmake/Option.cmake +++ b/cmake/Option.cmake @@ -36,7 +36,6 @@ option(WITH_GLOG "Include glog support" OFF) # packages if(WITH_API) include(${CMAKE_CURRENT_LIST_DIR}/DetectOpenCV.cmake) - set(WITH_OPENCV4 true) if(WITH_OPENCV4) set(WITH_CAM_MODELS OFF) endif() From 5a1fbfd55bbabd4f07cbe3b414d713e22a385bb2 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Wed, 13 Feb 2019 15:05:26 +0800 Subject: [PATCH 5/9] fix(calibmodels): may be merge problem before cause the useless code --- src/mynteye/api/processor/rectify_processor.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/mynteye/api/processor/rectify_processor.cc b/src/mynteye/api/processor/rectify_processor.cc index 6648b8a..d7ee5f8 100644 --- a/src/mynteye/api/processor/rectify_processor.cc +++ b/src/mynteye/api/processor/rectify_processor.cc @@ -339,13 +339,6 @@ void RectifyProcessor::InitParams( generateCameraFromIntrinsicsEquidistant(in_left); camodocal::CameraPtr camera_odo_ptr_right = generateCameraFromIntrinsicsEquidistant(in_right); - auto calib_infos_temp = - stereoRectify(camera_odo_ptr_left, - camera_odo_ptr_right, - in_left, - in_right, - ex_right_to_left); - *calib_infos = *calib_infos_temp; auto calib_info_tmp = stereoRectify(camera_odo_ptr_left, camera_odo_ptr_right, in_left, From e899f7cc1cfb4bdf286e1480db0cd443845934f1 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Wed, 13 Feb 2019 16:10:54 +0800 Subject: [PATCH 6/9] fix(models): move value --- src/mynteye/api/synthetic.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mynteye/api/synthetic.cc b/src/mynteye/api/synthetic.cc index f2a6998..b68cfd4 100644 --- a/src/mynteye/api/synthetic.cc +++ b/src/mynteye/api/synthetic.cc @@ -460,8 +460,8 @@ void Synthetic::InitProcessors() { auto &&rectify_processor_ocv = std::make_shared(intr_left_, intr_right_, extr_, RECTIFY_PROC_PERIOD); - rectify_processor = rectify_processor_ocv; Q = rectify_processor_ocv->Q; + rectify_processor = rectify_processor_ocv; #ifdef WITH_CAM_MODELS } else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) { rectify_processor_imp = From 750437fd71448998e332c17f2ebffd50840a6cfc Mon Sep 17 00:00:00 2001 From: TinyOh Date: Fri, 15 Feb 2019 18:25:58 +0800 Subject: [PATCH 7/9] fix(win): calib models complie --- Makefile | 8 +- .../api/camodocal/include/camodocal/gpl/gpl.h | 6 -- .../src/camera_models/EquidistantCamera.cc | 4 +- src/mynteye/api/camodocal/src/gpl/gpl.cc | 81 +------------------ 4 files changed, 9 insertions(+), 90 deletions(-) diff --git a/Makefile b/Makefile index e9773b5..6e11ec6 100644 --- a/Makefile +++ b/Makefile @@ -36,9 +36,11 @@ CAM_MODELS ?= CMAKE_BUILD_EXTRA_OPTIONS := ifeq ($(CAM_MODELS),) - CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=OFF + $(warning "the value of LOCAL_PATH ibbbbbbbbbbbbbbbbbbbbbbbbs") + CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=OFF else - CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=ON + $(warning "the value of LOCAL_PATH iaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaas") + CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=ON endif .DEFAULT_GOAL := all @@ -106,7 +108,7 @@ init: build: @$(call echo,Make $@) ifeq ($(HOST_OS),Win) - @$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install) + @$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install $(CMAKE_BUILD_EXTRA_OPTIONS)) else @$(call cmake_build,./_build,..,$(CMAKE_BUILD_EXTRA_OPTIONS)) endif diff --git a/src/mynteye/api/camodocal/include/camodocal/gpl/gpl.h b/src/mynteye/api/camodocal/include/camodocal/gpl/gpl.h index ecfaeb0..b5b555c 100644 --- a/src/mynteye/api/camodocal/include/camodocal/gpl/gpl.h +++ b/src/mynteye/api/camodocal/include/camodocal/gpl/gpl.h @@ -80,10 +80,6 @@ const T randomNormal(const T &sigma) { return x1 * w * sigma; } -unsigned long long timeInMicroseconds(void); // NOLINT - -double timeInSeconds(void); - void colorDepthImage( cv::Mat &imgDepth, cv::Mat &imgColoredDepth, float minRange, // NOLINT float maxRange); @@ -107,8 +103,6 @@ void LLtoUTM( void UTMtoLL( double utmNorthing, double utmEasting, const std::string &utmZone, // NOLINT double &latitude, double &longitude); // NOLINT - -long int timestampDiff(uint64_t t1, uint64_t t2); // NOLINT } #endif // SRC_MYNTEYE_API_CAMODOCAL_INCLUDE_CAMODOCAL_GPL_GPL_H_ diff --git a/src/mynteye/api/camodocal/src/camera_models/EquidistantCamera.cc b/src/mynteye/api/camodocal/src/camera_models/EquidistantCamera.cc index 5e9ce3b..34ff08f 100644 --- a/src/mynteye/api/camodocal/src/camera_models/EquidistantCamera.cc +++ b/src/mynteye/api/camodocal/src/camera_models/EquidistantCamera.cc @@ -276,7 +276,8 @@ void EquidistantCamera::estimateIntrinsics( double f0 = 0.0; for (size_t i = 0; i < imagePoints.size(); ++i) { std::vector center(boardSize.height); - double radius[boardSize.height]; // NOLINT + int arrayLength = boardSize.height; + double *radius = new double[arrayLength]; for (int r = 0; r < boardSize.height; ++r) { std::vector circle; for (int c = 0; c < boardSize.width; ++c) { @@ -320,6 +321,7 @@ void EquidistantCamera::estimateIntrinsics( } } } + delete[] radius; } if (f0 <= 0.0 && minReprojErr >= std::numeric_limits::max()) { diff --git a/src/mynteye/api/camodocal/src/gpl/gpl.cc b/src/mynteye/api/camodocal/src/gpl/gpl.cc index a318c69..bfeacb7 100644 --- a/src/mynteye/api/camodocal/src/gpl/gpl.cc +++ b/src/mynteye/api/camodocal/src/gpl/gpl.cc @@ -16,6 +16,7 @@ #include #ifdef _WIN32 #include +#define M_PI (3.14159265358979323846) #else #include #endif @@ -109,69 +110,8 @@ getFILETIMEoffset() { return (t); } -int clock_gettime(int X, struct timespec *tp) { - LARGE_INTEGER t; - FILETIME f; - double microseconds; - static LARGE_INTEGER offset; - static double frequencyToMicroseconds; - static int initialized = 0; - static BOOL usePerformanceCounter = 0; - - if (!initialized) { - LARGE_INTEGER performanceFrequency; - initialized = 1; - usePerformanceCounter = QueryPerformanceFrequency(&performanceFrequency); - if (usePerformanceCounter) { - QueryPerformanceCounter(&offset); - frequencyToMicroseconds = - static_cast(performanceFrequency.QuadPart / 1000000.); - } else { - offset = getFILETIMEoffset(); - frequencyToMicroseconds = 10.; - } - } - if (usePerformanceCounter) { - QueryPerformanceCounter(&t); - } else { - GetSystemTimeAsFileTime(&f); - t.QuadPart = f.dwHighDateTime; - t.QuadPart <<= 32; - t.QuadPart |= f.dwLowDateTime; - } - - t.QuadPart -= offset.QuadPart; - microseconds = static_cast(t.QuadPart / frequencyToMicroseconds); - t.QuadPart = microseconds; - tp->tv_sec = t.QuadPart / 1000000; - tp->tv_nsec = (t.QuadPart % 1000000) * 1000; - return (0); -} #endif -unsigned long long timeInMicroseconds(void) { // NOLINT - struct timespec tp; -#ifdef __APPLE__ - tp = orwl_gettime(); -#else - clock_gettime(CLOCK_REALTIME, &tp); -#endif - - return tp.tv_sec * 1000000 + tp.tv_nsec / 1000; -} - -double timeInSeconds(void) { - struct timespec tp; -#ifdef __APPLE__ - tp = orwl_gettime(); -#else - clock_gettime(CLOCK_REALTIME, &tp); -#endif - - return static_cast(tp.tv_sec) + - static_cast(tp.tv_nsec) / 1000000000.0; -} - float colormapAutumn[128][3] = { {1.0f, 0.f, 0.f}, {1.0f, 0.007874f, 0.f}, {1.0f, 0.015748f, 0.f}, {1.0f, 0.023622f, 0.f}, {1.0f, 0.031496f, 0.f}, {1.0f, 0.03937f, 0.f}, @@ -745,23 +685,4 @@ void UTMtoLL( longitude = LongOrigin + longitude / M_PI * 180.0; } -long int timestampDiff(uint64_t t1, uint64_t t2) { // NOLINT - if (t2 > t1) { - uint64_t d = t2 - t1; - - if (d > std::numeric_limits::max()) { // NOLINT - return std::numeric_limits::max(); // NOLINT - } else { - return d; - } - } else { - uint64_t d = t1 - t2; - - if (d > std::numeric_limits::max()) { // NOLINT - return std::numeric_limits::min(); // NOLINT - } else { - return -static_cast(d); // NOLINT - } - } -} } From 2c5fd62a06d50fb6ffebc46e9da849b70d3183ae Mon Sep 17 00:00:00 2001 From: Tiny Date: Mon, 18 Feb 2019 11:34:34 +0800 Subject: [PATCH 8/9] fix(mac): remove tools complie on mac --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 9e23713..f787af1 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,13 @@ samples: install tools: install @$(call echo,Make $@) +ifeq ($(HOST_OS),Mac) + $(error "Can't make tools on $(HOST_OS)") +else @$(call cmake_build,./tools/_build) +endif + + .PHONY: tools From 17141b64dde754105e09913007a4ed1d68001f6c Mon Sep 17 00:00:00 2001 From: TinyOh Date: Mon, 18 Feb 2019 17:34:51 +0800 Subject: [PATCH 9/9] =?UTF-8?q?style:=20remove=20CAM=5FMODELS=3D=3F=20comp?= =?UTF-8?q?lie=20prams?= --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e9773b5..c55ac0a 100644 --- a/Makefile +++ b/Makefile @@ -34,12 +34,7 @@ SUDO ?= sudo CAM_MODELS ?= -CMAKE_BUILD_EXTRA_OPTIONS := -ifeq ($(CAM_MODELS),) - CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=OFF -else - CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=ON -endif +CMAKE_BUILD_EXTRA_OPTIONS := $(CMAKE_BUILD_EXTRA_OPTIONS) -DWITH_CAM_MODELS=ON .DEFAULT_GOAL := all