本文整理汇总了C++中Pose3::center方法的典型用法代码示例。如果您正苦于以下问题:C++ Pose3::center方法的具体用法?C++ Pose3::center怎么用?C++ Pose3::center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pose3
的用法示例。
在下文中一共展示了Pose3::center方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: c
/// Camera pair epipole (Projection of camera center 2 in the image plane 1)
static Vec3 epipole_from_P(const Mat34& P1, const Pose3& P2)
{
const Vec3 c = P2.center();
Vec4 center;
center << c(0), c(1), c(2), 1.0;
return P1*center;
}
示例2: f
// Init a frustum for each valid views of the SfM scene
void Frustum_Filter::initFrustum
(
const SfM_Data & sfm_data
)
{
for (NearFarPlanesT::const_iterator it = z_near_z_far_perView.begin();
it != z_near_z_far_perView.end(); ++it)
{
const View * view = sfm_data.GetViews().at(it->first).get();
if (!sfm_data.IsPoseAndIntrinsicDefined(view))
continue;
Intrinsics::const_iterator iterIntrinsic = sfm_data.GetIntrinsics().find(view->id_intrinsic);
if (!isPinhole(iterIntrinsic->second->getType()))
continue;
const Pose3 pose = sfm_data.GetPoseOrDie(view);
const Pinhole_Intrinsic * cam = dynamic_cast<const Pinhole_Intrinsic*>(iterIntrinsic->second.get());
if (!cam)
continue;
if (!_bTruncated) // use infinite frustum
{
const Frustum f(
cam->w(), cam->h(), cam->K(),
pose.rotation(), pose.center());
frustum_perView[view->id_view] = f;
}
else // use truncated frustum with defined Near and Far planes
{
const Frustum f(cam->w(), cam->h(), cam->K(),
pose.rotation(), pose.center(), it->second.first, it->second.second);
frustum_perView[view->id_view] = f;
}
}
}
示例3: operator
Pose3 operator () (const Pose3 & pose) const
{
return Pose3( pose.rotation() * _pose.rotation().transpose(), this->operator()(pose.center()));
}
示例4: main
//.........这里部分代码省略.........
return EXIT_FAILURE;
}
//A. prepare the corresponding putatives points
Mat xL(2, vec_PutativeMatches.size());
Mat xR(2, vec_PutativeMatches.size());
for (size_t k = 0; k < vec_PutativeMatches.size(); ++k) {
const PointFeature & imaL = featsL[vec_PutativeMatches[k]._i];
const PointFeature & imaR = featsR[vec_PutativeMatches[k]._j];
xL.col(k) = imaL.coords().cast<double>();
xR.col(k) = imaR.coords().cast<double>();
}
//B. Compute the relative pose thanks to a essential matrix estimation
std::pair<size_t, size_t> size_imaL(imageL.Width(), imageL.Height());
std::pair<size_t, size_t> size_imaR(imageR.Width(), imageR.Height());
sfm::RelativePose_Info relativePose_info;
if (!sfm::robustRelativePose(K, K, xL, xR, relativePose_info, size_imaL, size_imaR, 256))
{
std::cerr << " /!\\ Robust relative pose estimation failure."
<< std::endl;
return EXIT_FAILURE;
}
std::cout << "\nFound an Essential matrix:\n"
<< "\tprecision: " << relativePose_info.found_residual_precision << " pixels\n"
<< "\t#inliers: " << relativePose_info.vec_inliers.size() << "\n"
<< "\t#matches: " << vec_PutativeMatches.size()
<< std::endl;
// Show Essential validated point
svgDrawer svgStream( imageL.Width() + imageR.Width(), max(imageL.Height(), imageR.Height()));
svgStream.drawImage(jpg_filenameL, imageL.Width(), imageL.Height());
svgStream.drawImage(jpg_filenameR, imageR.Width(), imageR.Height(), imageL.Width());
for (size_t i = 0; i < relativePose_info.vec_inliers.size(); ++i) {
const SIOPointFeature & LL = regionsL->Features()[vec_PutativeMatches[relativePose_info.vec_inliers[i]]._i];
const SIOPointFeature & RR = regionsR->Features()[vec_PutativeMatches[relativePose_info.vec_inliers[i]]._j];
const Vec2f L = LL.coords();
const Vec2f R = RR.coords();
svgStream.drawLine(L.x(), L.y(), R.x()+imageL.Width(), R.y(), svgStyle().stroke("green", 2.0));
svgStream.drawCircle(L.x(), L.y(), LL.scale(), svgStyle().stroke("yellow", 2.0));
svgStream.drawCircle(R.x()+imageL.Width(), R.y(), RR.scale(),svgStyle().stroke("yellow", 2.0));
}
const std::string out_filename = "04_ACRansacEssential.svg";
std::ofstream svgFile( out_filename.c_str() );
svgFile << svgStream.closeSvgFile().str();
svgFile.close();
//C. Triangulate and export inliers as a PLY scene
std::vector<Vec3> vec_3DPoints;
// Setup camera intrinsic and poses
Pinhole_Intrinsic intrinsic0(imageL.Width(), imageL.Height(), K(0, 0), K(0, 2), K(1, 2));
Pinhole_Intrinsic intrinsic1(imageR.Width(), imageR.Height(), K(0, 0), K(0, 2), K(1, 2));
const Pose3 pose0 = Pose3(Mat3::Identity(), Vec3::Zero());
const Pose3 pose1 = relativePose_info.relativePose;
// Init structure by inlier triangulation
const Mat34 P1 = intrinsic0.get_projective_equivalent(pose0);
const Mat34 P2 = intrinsic1.get_projective_equivalent(pose1);
std::vector<double> vec_residuals;
vec_residuals.reserve(relativePose_info.vec_inliers.size() * 4);
for (size_t i = 0; i < relativePose_info.vec_inliers.size(); ++i) {
const SIOPointFeature & LL = regionsL->Features()[vec_PutativeMatches[relativePose_info.vec_inliers[i]]._i];
const SIOPointFeature & RR = regionsR->Features()[vec_PutativeMatches[relativePose_info.vec_inliers[i]]._j];
// Point triangulation
Vec3 X;
TriangulateDLT(P1, LL.coords().cast<double>(), P2, RR.coords().cast<double>(), &X);
// Reject point that is behind the camera
if (pose0.depth(X) < 0 && pose1.depth(X) < 0)
continue;
const Vec2 residual0 = intrinsic0.residual(pose0, X, LL.coords().cast<double>());
const Vec2 residual1 = intrinsic1.residual(pose1, X, RR.coords().cast<double>());
vec_residuals.push_back(fabs(residual0(0)));
vec_residuals.push_back(fabs(residual0(1)));
vec_residuals.push_back(fabs(residual1(0)));
vec_residuals.push_back(fabs(residual1(1)));
}
// Display some statistics of reprojection errors
float dMin, dMax, dMean, dMedian;
minMaxMeanMedian<float>(vec_residuals.begin(), vec_residuals.end(),
dMin, dMax, dMean, dMedian);
std::cout << std::endl
<< "Triangulation residuals statistics:" << "\n"
<< "\t-- Residual min:\t" << dMin << "\n"
<< "\t-- Residual median:\t" << dMedian << "\n"
<< "\t-- Residual max:\t " << dMax << "\n"
<< "\t-- Residual mean:\t " << dMean << std::endl;
// Export as PLY (camera pos + 3Dpoints)
std::vector<Vec3> vec_camPos;
vec_camPos.push_back( pose0.center() );
vec_camPos.push_back( pose1.center() );
exportToPly(vec_3DPoints, vec_camPos, "EssentialGeometry.ply");
}
return EXIT_SUCCESS;
}