Fix the bug introduced in the last commit

This commit is contained in:
ke 2018-05-31 13:13:26 -04:00
parent 24d8c8886d
commit a9386c5d2b

View File

@ -1105,13 +1105,16 @@ void ImageProcessor::twoPointRansac(
// Randomly select two point pairs. // Randomly select two point pairs.
// Although this is a weird way of selecting two pairs, but it // Although this is a weird way of selecting two pairs, but it
// is able to efficiently avoid selecting repetitive pairs. // is able to efficiently avoid selecting repetitive pairs.
int pair_idx1 = raw_inlier_idx[random_gen.uniformInteger( int select_idx1 = random_gen.uniformInteger(
0, raw_inlier_idx.size()-1)]; 0, raw_inlier_idx.size()-1);
int idx_diff = random_gen.uniformInteger( int select_idx_diff = random_gen.uniformInteger(
1, raw_inlier_idx.size()-1); 1, raw_inlier_idx.size()-1);
int pair_idx2 = raw_inlier_idx[ int select_idx2 = select_idx1+select_idx_diff<raw_inlier_idx.size() ?
pair_idx1+idx_diff < raw_inlier_idx.size() ? select_idx1+select_idx_diff :
pair_idx1+idx_diff : pair_idx1+idx_diff-raw_inlier_idx.size()]; select_idx1+select_idx_diff-raw_inlier_idx.size();
int pair_idx1 = raw_inlier_idx[select_idx1];
int pair_idx2 = raw_inlier_idx[select_idx2];
// Construct the model; // Construct the model;
Vector2d coeff_tx(coeff_t(pair_idx1, 0), coeff_t(pair_idx2, 0)); Vector2d coeff_tx(coeff_t(pair_idx1, 0), coeff_t(pair_idx2, 0));