diff --git a/src/mynteye/api/synthetic.cc b/src/mynteye/api/synthetic.cc index dbaf4db..02810fa 100644 --- a/src/mynteye/api/synthetic.cc +++ b/src/mynteye/api/synthetic.cc @@ -90,6 +90,7 @@ void Synthetic::InitCalibInfo() { api_->GetExtrinsics(Stream::LEFT, Stream::RIGHT)); #endif } else { + calib_default_tag_ = true; calib_model_ = CalibrationModel::PINHOLE; LOG(INFO) << "camera calib model: unknow ,use default pinhole data"; intr_left_ = getDefaultIntrinsics(); @@ -101,7 +102,8 @@ void Synthetic::InitCalibInfo() { Synthetic::Synthetic(API *api, CalibrationModel calib_model) : api_(api), plugin_(nullptr), - calib_model_(calib_model) { + calib_model_(calib_model), + calib_default_tag_(false) { VLOG(2) << __func__; CHECK_NOTNULL(api_); InitCalibInfo(); @@ -117,20 +119,18 @@ Synthetic::~Synthetic() { } } -void Synthetic::NotifyImageParamsChanged(bool is_from_dev) { - if (is_from_dev && calib_model_ == CalibrationModel::PINHOLE) { +void Synthetic::NotifyImageParamsChanged() { + if (!calib_default_tag_) { intr_left_ = api_->GetIntrinsicsBase(Stream::LEFT); intr_right_ = api_->GetIntrinsicsBase(Stream::RIGHT); extr_ = std::make_shared( api_->GetExtrinsics(Stream::LEFT, Stream::RIGHT)); + } + if (calib_model_ == CalibrationModel::PINHOLE) { auto &&processor = find_processor(processor_); if (processor) processor->ReloadImageParams(intr_left_, intr_right_, extr_); #ifdef WITH_CAM_MODELS - } else if (is_from_dev && calib_model_ == CalibrationModel::KANNALA_BRANDT) { - intr_left_ = api_->GetIntrinsicsBase(Stream::LEFT); - intr_right_ = api_->GetIntrinsicsBase(Stream::RIGHT); - extr_ = std::make_shared( - api_->GetExtrinsics(Stream::LEFT, Stream::RIGHT)); + } else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) { auto &&processor = find_processor(processor_); if (processor) processor->ReloadImageParams(intr_left_, intr_right_, extr_); #endif diff --git a/src/mynteye/api/synthetic.h b/src/mynteye/api/synthetic.h index 1777d38..3625a9f 100644 --- a/src/mynteye/api/synthetic.h +++ b/src/mynteye/api/synthetic.h @@ -44,7 +44,7 @@ class Synthetic { explicit Synthetic(API *api, CalibrationModel calib_model); ~Synthetic(); - void NotifyImageParamsChanged(bool is_from_dev = false); + void NotifyImageParamsChanged(); bool Supports(const Stream &stream) const; mode_t SupportsMode(const Stream &stream) const; @@ -120,6 +120,7 @@ class Synthetic { std::shared_ptr intr_left_; std::shared_ptr intr_right_; std::shared_ptr extr_; + bool calib_default_tag_; }; template