refactor(synthetic): remove usless logic
This commit is contained in:
parent
d09f037aee
commit
f525c2063e
|
@ -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);
|
||||||
return api;
|
if (api && checkFirmwareVersion(api))
|
||||||
// if (api && checkFirmwareVersion(api))
|
return api;
|
||||||
// return api;
|
return nullptr;
|
||||||
// return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<API> API::Create(
|
std::shared_ptr<API> API::Create(
|
||||||
|
|
|
@ -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;
|
|
||||||
if (calib_model_ == CalibrationModel::PINHOLE) {
|
auto root_processor =
|
||||||
|
std::make_shared<RootProcessor>(ROOT_PROC_PERIOD);
|
||||||
|
|
||||||
|
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(
|
||||||
|
|
|
@ -99,12 +99,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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user