Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2 into develop

* 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2:
  feat: forbid 2100/210A uless update sdk to 2.3.1 and above
  refactor(synthetic): remove usless logic
This commit is contained in:
John Zhao 2019-02-28 10:26:11 +08:00
commit c35d338248
3 changed files with 46 additions and 73 deletions

View File

@ -224,10 +224,9 @@ std::shared_ptr<API> API::Create(int argc, char *argv[]) {
auto &&device = device::select(); auto &&device = device::select();
if (!device) return nullptr; if (!device) return nullptr;
auto api = Create(argc, argv, device); auto api = Create(argc, argv, device);
if (api && checkFirmwareVersion(api))
return api; return api;
// if (api && checkFirmwareVersion(api)) return nullptr;
// return api;
// return nullptr;
} }
std::shared_ptr<API> API::Create( std::shared_ptr<API> API::Create(

View File

@ -511,66 +511,60 @@ bool Synthetic::IsStreamEnabledSynthetic(const Stream &stream) const {
void Synthetic::InitProcessors() { void Synthetic::InitProcessors() {
std::shared_ptr<Processor> rectify_processor = nullptr; std::shared_ptr<Processor> rectify_processor = nullptr;
#ifdef WITH_CAM_MODELS std::shared_ptr<Processor> points_processor = nullptr;
std::shared_ptr<RectifyProcessor> rectify_processor_imp = nullptr; std::shared_ptr<Processor> depth_processor = nullptr;
#endif
cv::Mat Q;
if (calib_model_ == CalibrationModel::PINHOLE) {
auto &&rectify_processor_ocv =
std::make_shared<RectifyProcessorOCV>(intr_left_, intr_right_, extr_,
RECTIFY_PROC_PERIOD);
Q = rectify_processor_ocv->Q;
rectify_processor = rectify_processor_ocv;
#ifdef WITH_CAM_MODELS
} else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) {
rectify_processor_imp =
std::make_shared<RectifyProcessor>(intr_left_, intr_right_, extr_,
RECTIFY_PROC_PERIOD);
rectify_processor = rectify_processor_imp;
#endif
} else {
LOG(ERROR) << "Unknow calib model type in device: "
<< calib_model_ << ", use default pinhole model";
auto &&rectify_processor_ocv =
std::make_shared<RectifyProcessorOCV>(intr_left_, intr_right_, extr_,
RECTIFY_PROC_PERIOD);
rectify_processor = rectify_processor_ocv;
}
auto &&disparity_processor = auto &&disparity_processor =
std::make_shared<DisparityProcessor>(DisparityComputingMethod::SGBM, std::make_shared<DisparityProcessor>(DisparityComputingMethod::SGBM,
DISPARITY_PROC_PERIOD); DISPARITY_PROC_PERIOD);
auto &&disparitynormalized_processor = auto &&disparitynormalized_processor =
std::make_shared<DisparityNormalizedProcessor>( std::make_shared<DisparityNormalizedProcessor>(
DISPARITY_NORM_PROC_PERIOD); DISPARITY_NORM_PROC_PERIOD);
std::shared_ptr<Processor> points_processor = nullptr;
auto root_processor =
std::make_shared<RootProcessor>(ROOT_PROC_PERIOD);
if (calib_model_ == CalibrationModel::PINHOLE) { if (calib_model_ == CalibrationModel::PINHOLE) {
// PINHOLE
auto &&rectify_processor_ocv =
std::make_shared<RectifyProcessorOCV>(intr_left_, intr_right_, extr_,
RECTIFY_PROC_PERIOD);
rectify_processor = rectify_processor_ocv;
points_processor = std::make_shared<PointsProcessorOCV>( points_processor = std::make_shared<PointsProcessorOCV>(
Q, POINTS_PROC_PERIOD); rectify_processor_ocv->Q, POINTS_PROC_PERIOD);
depth_processor = std::make_shared<DepthProcessorOCV>(DEPTH_PROC_PERIOD);
root_processor->AddChild(rectify_processor);
rectify_processor->AddChild(disparity_processor);
disparity_processor->AddChild(disparitynormalized_processor);
disparity_processor->AddChild(points_processor);
points_processor->AddChild(depth_processor);
#ifdef WITH_CAM_MODELS #ifdef WITH_CAM_MODELS
} else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) { } else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) {
// KANNALA_BRANDT
auto rectify_processor_imp =
std::make_shared<RectifyProcessor>(intr_left_, intr_right_, extr_,
RECTIFY_PROC_PERIOD);
rectify_processor = rectify_processor_imp;
points_processor = std::make_shared<PointsProcessor>( points_processor = std::make_shared<PointsProcessor>(
rectify_processor_imp -> getCalibInfoPair(), rectify_processor_imp -> getCalibInfoPair(),
POINTS_PROC_PERIOD); POINTS_PROC_PERIOD);
#endif
} else {
points_processor = std::make_shared<PointsProcessorOCV>(
Q, POINTS_PROC_PERIOD);
}
std::shared_ptr<Processor> depth_processor = nullptr;
if (calib_model_ == CalibrationModel::PINHOLE) {
depth_processor = std::make_shared<DepthProcessorOCV>(DEPTH_PROC_PERIOD);
#ifdef WITH_CAM_MODELS
} else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) {
depth_processor = std::make_shared<DepthProcessor>( depth_processor = std::make_shared<DepthProcessor>(
rectify_processor_imp -> getCalibInfoPair(), rectify_processor_imp -> getCalibInfoPair(),
DEPTH_PROC_PERIOD); DEPTH_PROC_PERIOD);
root_processor->AddChild(rectify_processor);
rectify_processor->AddChild(disparity_processor);
disparity_processor->AddChild(disparitynormalized_processor);
disparity_processor->AddChild(depth_processor);
depth_processor->AddChild(points_processor);
#endif #endif
} else { } else {
depth_processor = std::make_shared<DepthProcessorOCV>(DEPTH_PROC_PERIOD); // UNKNOW
LOG(ERROR) << "Unknow calib model type in device: "
<< calib_model_;
return;
} }
auto root_processor =
std::make_shared<RootProcessor>(ROOT_PROC_PERIOD);
root_processor->AddChild(rectify_processor);
rectify_processor->addTargetStreams( rectify_processor->addTargetStreams(
{Stream::LEFT_RECTIFIED, Mode::MODE_LAST, Mode::MODE_LAST, nullptr}); {Stream::LEFT_RECTIFIED, Mode::MODE_LAST, Mode::MODE_LAST, nullptr});
@ -618,25 +612,7 @@ void Synthetic::InitProcessors() {
depth_processor->SetPostProcessCallback( depth_processor->SetPostProcessCallback(
std::bind(&Synthetic::OnDepthPostProcess, this, _1)); std::bind(&Synthetic::OnDepthPostProcess, this, _1));
if (calib_model_ == CalibrationModel::PINHOLE) { processor_ = root_processor;
// PINHOLE
rectify_processor->AddChild(disparity_processor);
disparity_processor->AddChild(disparitynormalized_processor);
disparity_processor->AddChild(points_processor);
points_processor->AddChild(depth_processor);
} else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) {
// KANNALA_BRANDT
rectify_processor->AddChild(disparity_processor);
disparity_processor->AddChild(disparitynormalized_processor);
disparity_processor->AddChild(depth_processor);
depth_processor->AddChild(points_processor);
} else {
// UNKNOW
LOG(ERROR) << "Unknow calib model type in device: "
<< calib_model_;
}
processor_ = rectify_processor;
} }
void Synthetic::ProcessNativeStream( void Synthetic::ProcessNativeStream(

View File

@ -44,9 +44,11 @@ static const firmware_version_match_table_unit FSVM_TABLE[] ={
{"MYNT-EYE-S1030", ">2.3.0", "<2.2.0", ERRO_DESCRIPTION_F}, {"MYNT-EYE-S1030", ">2.3.0", "<2.2.0", ERRO_DESCRIPTION_F},
{"MYNT-EYE-S1030", "<2.3.1", "<2.2.0", WARN_DESCRIPTION_S}, {"MYNT-EYE-S1030", "<2.3.1", "<2.2.0", WARN_DESCRIPTION_S},
/** S2100 */ /** S2100 */
{"MYNT-EYE-S2100", ">0.0.0", "1.0", PASS_DESCRIPTION}, {"MYNT-EYE-S2100", ">2.3.0", "1.0", PASS_DESCRIPTION},
{"MYNT-EYE-S2100", "<2.3.1", "1.0", ERRO_DESCRIPTION_S},
/** S210A */ /** S210A */
{"MYNT-EYE-S210A", ">0.0.0", "1.0", PASS_DESCRIPTION}, {"MYNT-EYE-S210A", ">2.3.0", "1.0", PASS_DESCRIPTION},
{"MYNT-EYE-S210A", "<2.3.1", "1.0", ERRO_DESCRIPTION_S},
}; };
void getVersion(const std::string &str, char *version) { void getVersion(const std::string &str, char *version) {
@ -99,12 +101,8 @@ STATUS_UNIT checkUnit(const std::string& sdkv,
if (condition.device_type == devn && if (condition.device_type == devn &&
conditionMatch(condition.sdk_version, sdkv) && conditionMatch(condition.sdk_version, sdkv) &&
conditionMatch(condition.firmware_version, firmv)) { conditionMatch(condition.firmware_version, firmv)) {
if (condition.status == ERRO_DESCRIPTION_F) { if (condition.status == ERRO_DESCRIPTION_F) return ST_ERRO_F;
return ST_ERRO_F; if (condition.status == ERRO_DESCRIPTION_S) return ST_ERRO_S;
}
if (condition.status == ERRO_DESCRIPTION_S) {
return ST_ERRO_S;
}
if (condition.status == WARN_DESCRIPTION_F || if (condition.status == WARN_DESCRIPTION_F ||
condition.status == WARN_DESCRIPTION_S) { condition.status == WARN_DESCRIPTION_S) {
LOG(WARNING) << condition.status; LOG(WARNING) << condition.status;