fix(src): Determine the default intrinsics based on the resulution

This commit is contained in:
Osenberg 2019-08-06 15:13:29 +08:00
parent de6dc0d712
commit 1cda60d137
3 changed files with 11 additions and 2 deletions

View File

@ -41,6 +41,13 @@ std::shared_ptr<IntrinsicsBase> getDefaultIntrinsics() {
return res; return res;
} }
std::shared_ptr<IntrinsicsBase> getDefaultIntrinsics(const StreamRequest &request) {
auto res = getDefaultIntrinsics();
res->resize_scale = static_cast<double>(request.width / res->width);
res->ResizeIntrinsics();
return res;
}
std::shared_ptr<Extrinsics> getDefaultExtrinsics() { std::shared_ptr<Extrinsics> getDefaultExtrinsics() {
auto res = std::make_shared<Extrinsics>(); auto res = std::make_shared<Extrinsics>();
double rotation[9] = { double rotation[9] = {

View File

@ -20,6 +20,7 @@
MYNTEYE_BEGIN_NAMESPACE MYNTEYE_BEGIN_NAMESPACE
std::shared_ptr<IntrinsicsBase> getDefaultIntrinsics(); std::shared_ptr<IntrinsicsBase> getDefaultIntrinsics();
std::shared_ptr<IntrinsicsBase> getDefaultIntrinsics(const StreamRequest &request);
std::shared_ptr<Extrinsics> getDefaultExtrinsics(); std::shared_ptr<Extrinsics> getDefaultExtrinsics();

View File

@ -66,8 +66,9 @@ void Synthetic::InitCalibInfo() {
calib_default_tag_ = true; calib_default_tag_ = true;
calib_model_ = CalibrationModel::PINHOLE; calib_model_ = CalibrationModel::PINHOLE;
LOG(INFO) << "camera calib model: unknow, use default pinhole data"; LOG(INFO) << "camera calib model: unknow, use default pinhole data";
intr_left_ = getDefaultIntrinsics(); auto stream_request = api_->GetStreamRequest();
intr_right_ = getDefaultIntrinsics(); intr_left_ = getDefaultIntrinsics(stream_request);
intr_right_ = getDefaultIntrinsics(stream_request);
extr_ = getDefaultExtrinsics(); extr_ = getDefaultExtrinsics();
} }
} }