fix(calib model): default config now work
This commit is contained in:
parent
60ea66b1ec
commit
d42b8ef69c
|
@ -235,6 +235,7 @@ if(WITH_API)
|
|||
src/mynteye/api/processor/points_processor_ocv.cc
|
||||
src/mynteye/api/processor/depth_processor_ocv.cc
|
||||
src/mynteye/api/processor/rectify_processor_ocv.cc
|
||||
src/mynteye/api/config.cc
|
||||
)
|
||||
if(WITH_CAM_MODELS)
|
||||
list(APPEND MYNTEYE_SRCS
|
||||
|
|
|
@ -246,13 +246,16 @@ std::shared_ptr<API> API::Create(const std::shared_ptr<Device> &device) {
|
|||
"to learn more.";
|
||||
LOG(WARNING) << "use pinhole as default";
|
||||
api = std::make_shared<API>(device, CalibrationModel::UNKNOW);
|
||||
return api;
|
||||
} else {
|
||||
if (left_intr->calib_model() != right_intr->calib_model()) {
|
||||
LOG(ERROR) << "left camera and right camera use different calib models!";
|
||||
LOG(WARNING) << "use pinhole as default";
|
||||
api = std::make_shared<API>(device, CalibrationModel::UNKNOW);
|
||||
return api;
|
||||
} else {
|
||||
api = std::make_shared<API>(device, left_intr->calib_model());
|
||||
return api;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -21,6 +21,9 @@ MYNTEYE_BEGIN_NAMESPACE
|
|||
|
||||
std::shared_ptr<IntrinsicsBase> getDefaultIntrinsics() {
|
||||
auto res = std::make_shared<IntrinsicsPinhole>();
|
||||
res->width = 640;
|
||||
res->height = 400;
|
||||
res->model = 0;
|
||||
res->fx = 3.6220059643202876e+02;
|
||||
res->fy = 3.6350065250745848e+02;
|
||||
res->cx = 4.0658699068023441e+02;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "mynteye/api/processor/rectify_processor_ocv.h"
|
||||
#include "mynteye/api/processor/depth_processor_ocv.h"
|
||||
#include "mynteye/api/processor/points_processor_ocv.h"
|
||||
#include "mynteye/api/config.h"
|
||||
#ifdef WITH_CAM_MODELS
|
||||
#include "mynteye/api/processor/depth_processor.h"
|
||||
#include "mynteye/api/processor/points_processor.h"
|
||||
|
@ -74,20 +75,26 @@ void process_childs(
|
|||
} // namespace
|
||||
|
||||
void Synthetic::InitCalibInfo() {
|
||||
if (calib_model_ == CalibrationModel::UNKNOW) {
|
||||
calib_model_ = CalibrationModel::PINHOLE;
|
||||
LOG(INFO) << "camera calib model: unknow";
|
||||
// use default
|
||||
} else {
|
||||
if (calib_model_ == CalibrationModel::PINHOLE) {
|
||||
LOG(INFO) << "camera calib model: pinhole";
|
||||
} else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) {
|
||||
LOG(INFO) << "camera calib model: kannala_brandt";
|
||||
}
|
||||
if (calib_model_ == CalibrationModel::PINHOLE) {
|
||||
LOG(INFO) << "camera calib model: pinhole";
|
||||
intr_left_ = api_->GetIntrinsicsBase(Stream::LEFT);
|
||||
intr_right_ = api_->GetIntrinsicsBase(Stream::RIGHT);
|
||||
extr_ = std::make_shared<Extrinsics>(
|
||||
api_->GetExtrinsics(Stream::LEFT, Stream::RIGHT));
|
||||
#ifdef WITH_CAM_MODELS
|
||||
} else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) {
|
||||
LOG(INFO) << "camera calib model: kannala_brandt";
|
||||
intr_left_ = api_->GetIntrinsicsBase(Stream::LEFT);
|
||||
intr_right_ = api_->GetIntrinsicsBase(Stream::RIGHT);
|
||||
extr_ = std::make_shared<Extrinsics>(
|
||||
api_->GetExtrinsics(Stream::LEFT, Stream::RIGHT));
|
||||
#endif
|
||||
} else {
|
||||
calib_model_ = CalibrationModel::PINHOLE;
|
||||
LOG(INFO) << "camera calib model: unknow ,use default pinhole data";
|
||||
intr_left_ = getDefaultIntrinsics();
|
||||
intr_right_ = getDefaultIntrinsics();
|
||||
extr_ = getDefaultExtrinsics();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,16 +117,20 @@ Synthetic::~Synthetic() {
|
|||
}
|
||||
}
|
||||
|
||||
void Synthetic::NotifyImageParamsChanged() {
|
||||
void Synthetic::NotifyImageParamsChanged(bool is_from_dev) {
|
||||
if (is_from_dev && calib_model_ == CalibrationModel::PINHOLE) {
|
||||
intr_left_ = api_->GetIntrinsicsBase(Stream::LEFT);
|
||||
intr_right_ = api_->GetIntrinsicsBase(Stream::RIGHT);
|
||||
extr_ = std::make_shared<Extrinsics>(
|
||||
api_->GetExtrinsics(Stream::LEFT, Stream::RIGHT));
|
||||
if (calib_model_ == CalibrationModel::PINHOLE) {
|
||||
auto &&processor = find_processor<RectifyProcessorOCV>(processor_);
|
||||
if (processor) processor->ReloadImageParams(intr_left_, intr_right_, extr_);
|
||||
#ifdef WITH_CAM_MODELS
|
||||
} else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) {
|
||||
} 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<Extrinsics>(
|
||||
api_->GetExtrinsics(Stream::LEFT, Stream::RIGHT));
|
||||
auto &&processor = find_processor<RectifyProcessor>(processor_);
|
||||
if (processor) processor->ReloadImageParams(intr_left_, intr_right_, extr_);
|
||||
#endif
|
||||
|
|
|
@ -44,7 +44,7 @@ class Synthetic {
|
|||
explicit Synthetic(API *api, CalibrationModel calib_model);
|
||||
~Synthetic();
|
||||
|
||||
void NotifyImageParamsChanged();
|
||||
void NotifyImageParamsChanged(bool is_from_dev = false);
|
||||
|
||||
bool Supports(const Stream &stream) const;
|
||||
mode_t SupportsMode(const Stream &stream) const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user