From 1cda60d137d41146b075ac307bf6e939a56febb5 Mon Sep 17 00:00:00 2001 From: Osenberg Date: Tue, 6 Aug 2019 15:13:29 +0800 Subject: [PATCH] fix(src): Determine the default intrinsics based on the resulution --- src/mynteye/api/config.cc | 7 +++++++ src/mynteye/api/config.h | 1 + src/mynteye/api/synthetic.cc | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mynteye/api/config.cc b/src/mynteye/api/config.cc index 7cd5184..4d20964 100644 --- a/src/mynteye/api/config.cc +++ b/src/mynteye/api/config.cc @@ -41,6 +41,13 @@ std::shared_ptr getDefaultIntrinsics() { return res; } +std::shared_ptr getDefaultIntrinsics(const StreamRequest &request) { + auto res = getDefaultIntrinsics(); + res->resize_scale = static_cast(request.width / res->width); + res->ResizeIntrinsics(); + return res; +} + std::shared_ptr getDefaultExtrinsics() { auto res = std::make_shared(); double rotation[9] = { diff --git a/src/mynteye/api/config.h b/src/mynteye/api/config.h index 8376cdd..7768c22 100644 --- a/src/mynteye/api/config.h +++ b/src/mynteye/api/config.h @@ -20,6 +20,7 @@ MYNTEYE_BEGIN_NAMESPACE std::shared_ptr getDefaultIntrinsics(); +std::shared_ptr getDefaultIntrinsics(const StreamRequest &request); std::shared_ptr getDefaultExtrinsics(); diff --git a/src/mynteye/api/synthetic.cc b/src/mynteye/api/synthetic.cc index 851e24d..8aa83ab 100644 --- a/src/mynteye/api/synthetic.cc +++ b/src/mynteye/api/synthetic.cc @@ -66,8 +66,9 @@ void Synthetic::InitCalibInfo() { calib_default_tag_ = true; calib_model_ = CalibrationModel::PINHOLE; LOG(INFO) << "camera calib model: unknow, use default pinhole data"; - intr_left_ = getDefaultIntrinsics(); - intr_right_ = getDefaultIntrinsics(); + auto stream_request = api_->GetStreamRequest(); + intr_left_ = getDefaultIntrinsics(stream_request); + intr_right_ = getDefaultIntrinsics(stream_request); extr_ = getDefaultExtrinsics(); } }