From a9386c5d2bf609263a928108df6453b68672bc24 Mon Sep 17 00:00:00 2001 From: ke Date: Thu, 31 May 2018 13:13:26 -0400 Subject: [PATCH] Fix the bug introduced in the last commit --- src/image_processor.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/image_processor.cpp b/src/image_processor.cpp index 08f9736..a5039f3 100644 --- a/src/image_processor.cpp +++ b/src/image_processor.cpp @@ -1105,13 +1105,16 @@ void ImageProcessor::twoPointRansac( // Randomly select two point pairs. // Although this is a weird way of selecting two pairs, but it // is able to efficiently avoid selecting repetitive pairs. - int pair_idx1 = raw_inlier_idx[random_gen.uniformInteger( - 0, raw_inlier_idx.size()-1)]; - int idx_diff = random_gen.uniformInteger( + int select_idx1 = random_gen.uniformInteger( + 0, raw_inlier_idx.size()-1); + int select_idx_diff = random_gen.uniformInteger( 1, raw_inlier_idx.size()-1); - int pair_idx2 = raw_inlier_idx[ - pair_idx1+idx_diff < raw_inlier_idx.size() ? - pair_idx1+idx_diff : pair_idx1+idx_diff-raw_inlier_idx.size()]; + int select_idx2 = select_idx1+select_idx_diff