From dacad9483e4892429ccf600cb4d353a1dedb95f4 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Fri, 15 Mar 2019 14:55:46 +0800 Subject: [PATCH 1/3] fix(api): samples issues --- samples/tutorials/data/get_imu.cc | 2 +- samples/tutorials/data/get_imu_correspondence.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/tutorials/data/get_imu.cc b/samples/tutorials/data/get_imu.cc index eca5b3d..99ea685 100644 --- a/samples/tutorials/data/get_imu.cc +++ b/samples/tutorials/data/get_imu.cc @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) { */ painter.DrawImgData(img, *left_data.img); - if (!motion_datas.empty()) { + if (!motion_datas.empty() && motion_datas.size() > 0) { painter.DrawImuData(img, *motion_datas[0].imu); } diff --git a/samples/tutorials/data/get_imu_correspondence.cc b/samples/tutorials/data/get_imu_correspondence.cc index 7faef67..3a2e184 100644 --- a/samples/tutorials/data/get_imu_correspondence.cc +++ b/samples/tutorials/data/get_imu_correspondence.cc @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) { /* painter.DrawImgData(img, *left_data.img); - if (!motion_datas.empty()) { + if (!motion_datas.empty() && motion_datas.size() > 0) { painter.DrawImuData(img, *motion_datas[0].imu); } */ From e91a2663e211b3c60fe14d321bfa05ba3992ebb7 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Fri, 15 Mar 2019 15:05:22 +0800 Subject: [PATCH 2/3] fix use disparity_normalized as sample --- samples/tutorials/data/get_disparity.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/tutorials/data/get_disparity.cc b/samples/tutorials/data/get_disparity.cc index ff9ae4a..b5f1fd5 100644 --- a/samples/tutorials/data/get_disparity.cc +++ b/samples/tutorials/data/get_disparity.cc @@ -34,8 +34,8 @@ int main(int argc, char *argv[]) { api->Start(Source::VIDEO_STREAMING); cv::namedWindow("frame"); - cv::namedWindow("disparity"); - // cv::namedWindow("disparity_normalized"); + // cv::namedWindow("disparity"); + cv::namedWindow("disparity_normalized"); while (true) { api->WaitForStreams(); @@ -49,16 +49,16 @@ int main(int argc, char *argv[]) { cv::imshow("frame", img); } - auto &&disp_data = api->GetStreamData(Stream::DISPARITY); - if (!disp_data.frame.empty()) { - cv::imshow("disparity", disp_data.frame); - } - - // auto &&disp_norm_data = api->GetStreamData(Stream::DISPARITY_NORMALIZED); - // if (!disp_norm_data.frame.empty()) { - // cv::imshow("disparity_normalized", disp_norm_data.frame); // CV_8UC1 + // auto &&disp_data = api->GetStreamData(Stream::DISPARITY); + // if (!disp_data.frame.empty()) { + // cv::imshow("disparity", disp_data.frame); // } + auto &&disp_norm_data = api->GetStreamData(Stream::DISPARITY_NORMALIZED); + if (!disp_norm_data.frame.empty()) { + cv::imshow("disparity_normalized", disp_norm_data.frame); // CV_8UC1 + } + char key = static_cast(cv::waitKey(1)); if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q break; From edb18a90b8bbfdf460b60cf775e79693e6283a23 Mon Sep 17 00:00:00 2001 From: TinyOh Date: Fri, 15 Mar 2019 16:27:29 +0800 Subject: [PATCH 3/3] fix: points quality --- samples/tutorials/data/get_points.cc | 1 - samples/tutorials/intermediate/get_depth_and_points.cc | 1 - 2 files changed, 2 deletions(-) diff --git a/samples/tutorials/data/get_points.cc b/samples/tutorials/data/get_points.cc index b51c966..0ac59d7 100644 --- a/samples/tutorials/data/get_points.cc +++ b/samples/tutorials/data/get_points.cc @@ -27,7 +27,6 @@ int main(int argc, char *argv[]) { auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; api->ConfigStreamRequest(request); - api->SetDisparityComputingMethodType(DisparityComputingMethod::BM); api->EnableStreamData(Stream::POINTS); diff --git a/samples/tutorials/intermediate/get_depth_and_points.cc b/samples/tutorials/intermediate/get_depth_and_points.cc index 63692d1..349a767 100644 --- a/samples/tutorials/intermediate/get_depth_and_points.cc +++ b/samples/tutorials/intermediate/get_depth_and_points.cc @@ -154,7 +154,6 @@ int main(int argc, char *argv[]) { auto &&request = api->SelectStreamRequest(&ok); if (!ok) return 1; api->ConfigStreamRequest(request); - api->SetDisparityComputingMethodType(DisparityComputingMethod::BM); api->SetOptionValue(Option::IR_CONTROL, 80);