feat: add disparity params load file.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user