feat: add disparity params load file.
This commit is contained in:
@@ -604,4 +604,8 @@ std::shared_ptr<struct CameraROSMsgInfoPair> API::GetCameraROSMsgInfoPair() {
|
||||
return synthetic_->GetCameraROSMsgInfoPair();
|
||||
}
|
||||
|
||||
bool API::ConfigDisparityFromFile(const std::string& config_file) {
|
||||
return synthetic_->ConfigDisparityFromFile(config_file);
|
||||
}
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <opencv2/calib3d/calib3d.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <opencv2/core/persistence.hpp>
|
||||
|
||||
#include "mynteye/logger.h"
|
||||
|
||||
@@ -103,6 +104,24 @@ void DisparityProcessor::SetDisparityComputingMethodType(
|
||||
NotifyComputingTypeChanged(MethodType);
|
||||
}
|
||||
|
||||
bool DisparityProcessor::ConfigFromFile(const std::string& config_file) {
|
||||
cv::FileStorage fsSettings(config_file, cv::FileStorage::READ);
|
||||
if (!fsSettings.isOpened()) {
|
||||
std::cerr << "ERROR: Wrong path to settings" << std::endl;
|
||||
return false;
|
||||
}
|
||||
cv::FileNode node_sgbm = fsSettings["SGBM"];
|
||||
if (node_sgbm.type() == cv::FileNode::MAP) {
|
||||
sgbm_matcher->read(node_sgbm);
|
||||
}
|
||||
|
||||
cv::FileNode node_bm = fsSettings["BM"];
|
||||
if (node_bm.type() == cv::FileNode::MAP) {
|
||||
bm_matcher->read(node_bm);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string DisparityProcessor::Name() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ class DisparityProcessor : public Processor {
|
||||
void SetDisparityComputingMethodType(
|
||||
const DisparityComputingMethod &MethodType);
|
||||
void NotifyComputingTypeChanged(const DisparityComputingMethod &MethodType);
|
||||
bool ConfigFromFile(const std::string& config);
|
||||
|
||||
protected:
|
||||
// inline Processor::process_type ProcessOutputConnection() override {
|
||||
|
||||
@@ -119,6 +119,12 @@ void Synthetic::NotifyImageParamsChanged() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Synthetic::ConfigDisparityFromFile(const std::string& config_file) {
|
||||
auto processor = getProcessorWithStream(Stream::DISPARITY);
|
||||
auto proc = static_cast<DisparityProcessor*>(&(*processor));
|
||||
return proc->ConfigFromFile(config_file);
|
||||
}
|
||||
|
||||
const struct Synthetic::stream_control_t Synthetic::getControlDateWithStream(
|
||||
const Stream& stream) const {
|
||||
for (auto &&it : processors_) {
|
||||
|
||||
@@ -94,6 +94,7 @@ class Synthetic {
|
||||
void SetDisparityComputingMethodType(
|
||||
const DisparityComputingMethod &MethoType);
|
||||
std::shared_ptr<struct CameraROSMsgInfoPair> GetCameraROSMsgInfoPair();
|
||||
bool ConfigDisparityFromFile(const std::string& config_file);
|
||||
|
||||
private:
|
||||
void InitCalibInfo();
|
||||
|
||||
Reference in New Issue
Block a user