Permalink
Browse files

Merge pull request #8 from JulienMichot/master

Fixed some bugs.
  • Loading branch information...
2 parents 7bef9ca + b2d9a3b commit 1cd4cdacb6b0aa7ba705aacd40540f6c12ec046a @keir keir committed Aug 10, 2011
@@ -83,20 +83,19 @@ void LensDistortion::ComputeUndistortedCoordinates(
double u = point_centered.x() / camera.focal_x();
double v = point_centered.y() / camera.focal_y();
- double radius = u * u + v * v;
+ double radius_squared = u * u + v * v;
double coef_radial = 0;
if (radial_distortion_.size() > 0) {
for (int i = radial_distortion_.size() - 1; i >= 0; --i) {
- coef_radial = (coef_radial + radial_distortion_[i]) * radius;
+ coef_radial = (coef_radial + radial_distortion_[i]) * radius_squared;
}
}
undistorted_point->x() = point.x() + point_centered.x() * coef_radial;
undistorted_point->y() = point.y() + point_centered.y() * coef_radial;
if (tangential_distortion_.size() >= 2) {
- double radius_squared = radius * radius;
double coef_tangential = 1;
for (size_t i = 2; i < tangential_distortion_.size(); ++i) {
@@ -634,8 +634,8 @@ void EuclideanResectionEPnP(const Mat2X &x_camera,
// Finally, with all three solutions, select the (R, t) with the best RMSE.
VLOG(2) << "RMSE for solution 0: " << rmse(0);
- VLOG(2) << "RMSE for solution 1: " << rmse(0);
- VLOG(2) << "RMSE for solution 2: " << rmse(0);
+ VLOG(2) << "RMSE for solution 1: " << rmse(1);
+ VLOG(2) << "RMSE for solution 2: " << rmse(2);
size_t n = 0;
if (rmse(1) < rmse(0)) {
n = 1;
@@ -86,8 +86,6 @@ bool Similarity3DFromCorrespondencesLinear(const Mat &x1,
double scale = svd.singularValues()(0);
Mat3 sI3 = scale * Mat3::Identity();
H->block<3,3>(0, 0) = svd.matrixU() * sI3 * svd.matrixV().transpose();
- if (H->block<3,3>(0, 0).determinant() < 0)
- H->block<3,3>(0, 0) = -H->block<3,3>(0, 0);
return true;
}
return false;

0 comments on commit 1cd4cda

Please sign in to comment.