From 7985a8ffe7abe207a0750542dc68517cab606e91 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Mon, 14 Jan 2019 17:28:57 +0800 Subject: [PATCH 1/2] fix(calib models): use shared ptr value change instead of ptr change --- src/mynteye/api/processor/rectify_processor.cc | 14 +++++++++++--- src/mynteye/api/processor/rectify_processor.h | 4 ---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mynteye/api/processor/rectify_processor.cc b/src/mynteye/api/processor/rectify_processor.cc index cf34e73..6a130bc 100644 --- a/src/mynteye/api/processor/rectify_processor.cc +++ b/src/mynteye/api/processor/rectify_processor.cc @@ -339,13 +339,21 @@ void RectifyProcessor::InitParams( generateCameraFromIntrinsicsEquidistant(in_left); camodocal::CameraPtr camera_odo_ptr_right = generateCameraFromIntrinsicsEquidistant(in_right); - calib_infos = - stereoRectify(camera_odo_ptr_left, + if (calib_infos) { + auto calib_info_tmp = stereoRectify(camera_odo_ptr_left, + camera_odo_ptr_right, + in_left, + in_right, + ex_right_to_left); + *calib_infos = *calib_info_tmp; + } else { + calib_infos = + stereoRectify(camera_odo_ptr_left, camera_odo_ptr_right, in_left, in_right, ex_right_to_left); - + } cv::Mat rect_R_l = cv::Mat::eye(3, 3, CV_32F), rect_R_r = cv::Mat::eye(3, 3, CV_32F); for (size_t i = 0; i < 3; i++) { diff --git a/src/mynteye/api/processor/rectify_processor.h b/src/mynteye/api/processor/rectify_processor.h index 5929dfc..147bc1e 100644 --- a/src/mynteye/api/processor/rectify_processor.h +++ b/src/mynteye/api/processor/rectify_processor.h @@ -23,11 +23,7 @@ #include "mynteye/types.h" #include "mynteye/api/processor.h" #include "mynteye/device/device.h" -#include -#include #include -#include -#include #include #include #include From e56bf190f6df8a0af3b1c90b0e2008c8ae68309f Mon Sep 17 00:00:00 2001 From: TinyOh Date: Mon, 14 Jan 2019 17:48:24 +0800 Subject: [PATCH 2/2] fix(calib models): calib struct update --- src/mynteye/api/processor/rectify_processor.cc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/mynteye/api/processor/rectify_processor.cc b/src/mynteye/api/processor/rectify_processor.cc index 6a130bc..e668eca 100644 --- a/src/mynteye/api/processor/rectify_processor.cc +++ b/src/mynteye/api/processor/rectify_processor.cc @@ -339,21 +339,12 @@ void RectifyProcessor::InitParams( generateCameraFromIntrinsicsEquidistant(in_left); camodocal::CameraPtr camera_odo_ptr_right = generateCameraFromIntrinsicsEquidistant(in_right); - if (calib_infos) { - auto calib_info_tmp = stereoRectify(camera_odo_ptr_left, + auto calib_info_tmp = stereoRectify(camera_odo_ptr_left, camera_odo_ptr_right, in_left, in_right, ex_right_to_left); - *calib_infos = *calib_info_tmp; - } else { - calib_infos = - stereoRectify(camera_odo_ptr_left, - camera_odo_ptr_right, - in_left, - in_right, - ex_right_to_left); - } + *calib_infos = *calib_info_tmp; cv::Mat rect_R_l = cv::Mat::eye(3, 3, CV_32F), rect_R_r = cv::Mat::eye(3, 3, CV_32F); for (size_t i = 0; i < 3; i++) { @@ -390,6 +381,7 @@ RectifyProcessor::RectifyProcessor( : Processor(std::move(proc_period)), calib_model(CalibrationModel::UNKNOW) { VLOG(2) << __func__ << ": proc_period=" << proc_period; + calib_infos = std::make_shared(); InitParams( *std::dynamic_pointer_cast(intr_left), *std::dynamic_pointer_cast(intr_right),