Skip to content
Snippets Groups Projects
Commit 49fb944a authored by Sebastian Hahta's avatar Sebastian Hahta Committed by Nicolas Pope
Browse files

Disable sub pixel accuracy in libSGM if filter is used (accuracy is lost in...

Disable sub pixel accuracy in libSGM if filter is used (accuracy is lost in conversion when disparityBilateralFilter is used)
parent 8e975ddd
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,9 @@ using cv::Mat;
FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) {
ssgm_ = nullptr;
use_filter_ = config.value("use_filter", false);
filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_, config.value("filter_radius", 25), config.value("filter_iter", 1));
// note: (max_disp_ << 4) libsgm subpixel accuracy.
// What is the impact in the filter? (possible artifacts)
filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_ << 4, config.value("filter_radius", 25), config.value("filter_iter", 1));
}
void FixstarsSGM::compute(const cv::Mat &l, const cv::Mat &r, cv::Mat &disp) {
......@@ -20,7 +22,7 @@ void FixstarsSGM::compute(const cv::Mat &l, const cv::Mat &r, cv::Mat &disp) {
Mat right_disp;
Mat lbw, rbw;
cv::cvtColor(l, lbw, cv::COLOR_BGR2GRAY);
cv::cvtColor(l, lbw, cv::COLOR_BGR2GRAY);
cv::cvtColor(r, rbw, cv::COLOR_BGR2GRAY);
if (!ssgm_) {
......@@ -54,4 +56,4 @@ void FixstarsSGM::compute(const cv::Mat &l, const cv::Mat &r, cv::Mat &disp) {
}
disp.convertTo(disp, CV_32F, 1.0f/16.0f);
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment