From 268041e4704cbb9b40445fc7f7fd08e6f7fc834e Mon Sep 17 00:00:00 2001 From: Zhao Zihe <2809075376@qq.com> Date: Wed, 18 Jul 2018 23:32:17 +0800 Subject: [PATCH 1/3] Update detectFeatures.cpp --- part III/src/detectFeatures.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/part III/src/detectFeatures.cpp b/part III/src/detectFeatures.cpp index f8f73de..6d8cf4f 100644 --- a/part III/src/detectFeatures.cpp +++ b/part III/src/detectFeatures.cpp @@ -4,6 +4,7 @@ > Mail: gaoxiang12@mails.tsinghua.edu.cn > 特征提取与匹配 > Created Time: 2015年07月18日 星期六 16时00分21秒 + > Modify: To support OpenCV v3.4.1 ************************************************************************/ #include @@ -34,8 +35,8 @@ int main( int argc, char** argv ) // _detector = cv::FeatureDetector::create( "SIFT" ); // _descriptor = cv::DescriptorExtractor::create( "SIFT" ); - detector = cv::FeatureDetector::create("ORB"); - descriptor = cv::DescriptorExtractor::create("ORB"); + detector = cv::ORB::create(); + descriptor = cv::ORB::create(); vector< cv::KeyPoint > kp1, kp2; //关键点 detector->detect( rgb1, kp1 ); //提取关键点 From 148ae6f2a359a5ac1da487670dc1ec70696161ad Mon Sep 17 00:00:00 2001 From: Zhao Zihe <2809075376@qq.com> Date: Thu, 19 Jul 2018 20:36:16 +0800 Subject: [PATCH 2/3] Add the support of the c++ 11 --- part III/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/part III/CMakeLists.txt b/part III/CMakeLists.txt index 31d6e05..00f2b0f 100644 --- a/part III/CMakeLists.txt +++ b/part III/CMakeLists.txt @@ -1,6 +1,6 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) PROJECT( slam ) - +add_definitions(-std=c++11) SET(CMAKE_CXX_COMPILER "g++") SET( CMAKE_BUILD_TYPE Debug ) SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) From 595a90e746b0a102c8dba3562bc5381e1d0c45c6 Mon Sep 17 00:00:00 2001 From: Zhao Zihe <2809075376@qq.com> Date: Thu, 19 Jul 2018 20:58:44 +0800 Subject: [PATCH 3/3] Change the confidence range for OpenCV3.x --- part III/src/detectFeatures.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/part III/src/detectFeatures.cpp b/part III/src/detectFeatures.cpp index 6d8cf4f..2e82967 100644 --- a/part III/src/detectFeatures.cpp +++ b/part III/src/detectFeatures.cpp @@ -135,8 +135,8 @@ int main( int argc, char** argv ) // 构建相机矩阵 cv::Mat cameraMatrix( 3, 3, CV_64F, camera_matrix_data ); cv::Mat rvec, tvec, inliers; - // 求解pnp - cv::solvePnPRansac( pts_obj, pts_img, cameraMatrix, cv::Mat(), rvec, tvec, false, 100, 1.0, 100, inliers ); + // 求解pnp the confidence should be in (0, 1) in Opencv 3.x + cv::solvePnPRansac( pts_obj, pts_img, cameraMatrix, cv::Mat(), rvec, tvec, false, 100, 1.0, 0.99, inliers ); cout<<"inliers: "<