Skip to content

Commit

Permalink
Merge branch 'rjanvier-develop_tiny_opti_localizer' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoulon committed May 2, 2019
2 parents dae7861 + c4e4bcd commit 78b0bdb
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/openMVG/sfm/pipelines/localization/SfM_Localizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,22 @@ class ACKernelAdaptorResection_Intrinsics
models); // Found model hypothesis
}

double Error(uint32_t sample, const Model &model) const {
const Vec3 t = model.block(0, 3, 3, 1);
const geometry::Pose3 pose(model.block(0, 0, 3, 3),
- model.block(0, 0, 3, 3).transpose() * t);
const bool ignore_distortion = true; // We ignore distortion since we are using undistorted bearing vector as input
return (camera_->residual(pose(x3D_.col(sample)),
x2d_.col(sample),
ignore_distortion) * N1_(0,0)).squaredNorm();
}

void Errors(const Model & model, std::vector<double> & vec_errors) const
{
// Convert the found model into a Pose3
const Vec3 t = model.block(0, 3, 3, 1);
const geometry::Pose3 pose(model.block(0, 0, 3, 3),
- model.block(0, 0, 3, 3).transpose() * t);

vec_errors.resize(x2d_.cols());

const bool ignore_distortion = true; // We ignore distortion since we are using undistorted bearing vector as input

for (Mat::Index sample = 0; sample < x2d_.cols(); ++sample)
{
vec_errors[sample] = this->Error(sample, model);
vec_errors[sample] = (camera_->residual(pose(x3D_.col(sample)),
x2d_.col(sample),
ignore_distortion) * N1_(0,0)).squaredNorm();
}
}

Expand Down

0 comments on commit 78b0bdb

Please sign in to comment.