Commit afe7c5fd by Debargha Mukherjee

### Do not find transformation for very few points

```Adds check to make sure that find transformation functions are
never called for 0 points.

Change-Id: I2d7cf40aace535b1d708d6189aea9c1e0f7c281b```
parent d598f04d
 ... @@ -139,7 +139,8 @@ static void normalize_homography(double *pts, int n, double *T) { ... @@ -139,7 +139,8 @@ static void normalize_homography(double *pts, int n, double *T) { double msqe = 0; double msqe = 0; double scale; double scale; int i; int i; if (n <= 0) return; assert(n > 0); for (i = 0; i < n; ++i, p += 2) { for (i = 0; i < n; ++i, p += 2) { mean[0] += p[0]; mean[0] += p[0]; mean[1] += p[1]; mean[1] += p[1]; ... @@ -822,13 +823,15 @@ static int ransac(const int *matched_points, int npoints, ... @@ -822,13 +823,15 @@ static int ransac(const int *matched_points, int npoints, // Recompute the motions using only the inliers. // Recompute the motions using only the inliers. for (i = 0; i < num_desired_motions; ++i) { for (i = 0; i < num_desired_motions; ++i) { copy_points_at_indices(points1, corners1, motions[i].inlier_indices, if (motions[i].num_inliers >= minpts) { motions[i].num_inliers); copy_points_at_indices(points1, corners1, motions[i].inlier_indices, copy_points_at_indices(points2, corners2, motions[i].inlier_indices, motions[i].num_inliers); motions[i].num_inliers); copy_points_at_indices(points2, corners2, motions[i].inlier_indices, motions[i].num_inliers); find_transformation(motions[i].num_inliers, points1, points2, params_by_motion + (MAX_PARAMDIM - 1) * i); find_transformation(motions[i].num_inliers, points1, points2, params_by_motion + (MAX_PARAMDIM - 1) * i); } num_inliers_by_motion[i] = motions[i].num_inliers; num_inliers_by_motion[i] = motions[i].num_inliers; } } ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!