fix(disparity): opencv2.0 logic

This commit is contained in:
TinyOh 2019-01-28 11:11:20 +08:00
parent a389d84452
commit 58464510f6
2 changed files with 4 additions and 3 deletions

View File

@ -46,7 +46,7 @@ DisparityProcessor::DisparityProcessor(DisparityComputingMethod type,
100, // speckleWindowSize 100, // speckleWindowSize
32, // speckleRange 32, // speckleRange
false)); // fullDP false)); // fullDP
LOG(ERROR) << "not supported in opencv 2.x"; LOG(ERROR) << "BM not supported in opencv 2.x, use sgbm";
// int bmWinSize = 3; // int bmWinSize = 3;
// // StereoBM // // StereoBM
// // https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereobm-stereobm // // https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereobm-stereobm
@ -130,7 +130,8 @@ bool DisparityProcessor::OnProcess(
if (type_ == DisparityComputingMethod::SGBM) { if (type_ == DisparityComputingMethod::SGBM) {
(*sgbm_matcher)(input->first, input->second, disparity); (*sgbm_matcher)(input->first, input->second, disparity);
} else if (type_ == DisparityComputingMethod::BM) { } else if (type_ == DisparityComputingMethod::BM) {
LOG(ERROR) << "not supported in opencv 2.x"; // LOG(ERROR) << "not supported in opencv 2.x";
(*sgbm_matcher)(input->first, input->second, disparity);
// cv::Mat tmp1, tmp2; // cv::Mat tmp1, tmp2;
// cv::cvtColor(input->first, tmp1, CV_RGB2GRAY); // cv::cvtColor(input->first, tmp1, CV_RGB2GRAY);
// cv::cvtColor(input->second, tmp2, CV_RGB2GRAY); // cv::cvtColor(input->second, tmp2, CV_RGB2GRAY);

View File

@ -59,7 +59,7 @@
<!-- disparity computing method type --> <!-- disparity computing method type -->
<arg name="sgbm" default="0" /> <arg name="sgbm" default="0" />
<arg name="bm" default="1" /> <arg name="bm" default="1" />
<arg name="disparity_computing_method" default="$(arg bm)" /> <arg name="disparity_computing_method" default="$(arg sgbm)" />
<arg name="enable_left_rect" default="false" /> <arg name="enable_left_rect" default="false" />
<arg name="enable_right_rect" default="false" /> <arg name="enable_right_rect" default="false" />