Skip to content

Commit

Permalink
Polyora: no pose refinement if not enough matches are available.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Pilet committed Jan 17, 2013
1 parent 903a951 commit e779300
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions polyora/pose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ void computeObjectPose(const vobj_frame *frame, const vobj_instance *instance,

camera->setPoseFromHomography(instance->transform);

cv::Mat intrinsics = camera->getIntrinsics();
cv::Mat rotation = camera->getExpMapRotation();
cv::Mat translation = camera->getTranslation();
cv::solvePnP(object_points, projections, intrinsics, camera->distortion,
rotation, translation,
true, // use extrinsic guess
CV_ITERATIVE);

camera->setExpMapRotation(rotation);
camera->setTranslation(translation);

if (projections.size() > 4) {
cv::Mat intrinsics = camera->getIntrinsics();
cv::Mat rotation = camera->getExpMapRotation();
cv::Mat translation = camera->getTranslation();
cv::solvePnP(object_points, projections, intrinsics, camera->distortion,
rotation, translation,
true, // use extrinsic guess
CV_ITERATIVE);

camera->setExpMapRotation(rotation);
camera->setTranslation(translation);
}
}

0 comments on commit e779300

Please sign in to comment.