当前位置: 首页>>代码示例>>C++>>正文


C++ ModelType::projectPoints方法代码示例

本文整理汇总了C++中ModelType::projectPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelType::projectPoints方法的具体用法?C++ ModelType::projectPoints怎么用?C++ ModelType::projectPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelType的用法示例。


在下文中一共展示了ModelType::projectPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: verifyPlaneSac

void verifyPlaneSac (ModelType & model, SacType & sac, unsigned int inlier_number = 2000, float tol = 1e-1f,
                     float refined_tol = 1e-1f, float proj_tol = 1e-3f)
{
  // Algorithm tests
  bool result = sac.computeModel ();
  ASSERT_EQ (result, true);

  std::vector<int> sample;
  sac.getModel (sample);
  EXPECT_EQ (int (sample.size ()), 3);

  std::vector<int> inliers;
  sac.getInliers (inliers);
  EXPECT_GE (int (inliers.size ()), inlier_number);

  Eigen::VectorXf coeff;
  sac.getModelCoefficients (coeff);
  EXPECT_EQ (int (coeff.size ()), 4);
  EXPECT_NEAR (coeff[0]/coeff[3], plane_coeffs_[0], tol);
  EXPECT_NEAR (coeff[1]/coeff[3], plane_coeffs_[1], tol);
  EXPECT_NEAR (coeff[2]/coeff[3], plane_coeffs_[2], tol);


  Eigen::VectorXf coeff_refined;
  model->optimizeModelCoefficients (inliers, coeff, coeff_refined);
  EXPECT_EQ (int (coeff_refined.size ()), 4);
  EXPECT_NEAR (coeff_refined[0]/coeff_refined[3], plane_coeffs_[0], refined_tol);
  EXPECT_NEAR (coeff_refined[1]/coeff_refined[3], plane_coeffs_[1], refined_tol);
  // This test fails in Windows (VS 2010) -- not sure why yet -- relaxing the constraint from 1e-2 to 1e-1
  // This test fails in MacOS too -- not sure why yet -- disabling
  //EXPECT_NEAR (coeff_refined[2]/coeff_refined[3], plane_coeffs_[2], refined_tol);

  // Projection tests
  PointCloud<PointXYZ> proj_points;
  model->projectPoints (inliers, coeff_refined, proj_points);
  EXPECT_NEAR (proj_points.points[20].x,  1.1266, proj_tol);
  EXPECT_NEAR (proj_points.points[20].y,  0.0152, proj_tol);
  EXPECT_NEAR (proj_points.points[20].z, -0.0156, proj_tol);

  EXPECT_NEAR (proj_points.points[30].x,  1.1843, proj_tol);
  EXPECT_NEAR (proj_points.points[30].y, -0.0635, proj_tol);
  EXPECT_NEAR (proj_points.points[30].z, -0.0201, proj_tol);

  EXPECT_NEAR (proj_points.points[50].x,  1.0749, proj_tol);
  EXPECT_NEAR (proj_points.points[50].y, -0.0586, proj_tol);
  EXPECT_NEAR (proj_points.points[50].z,  0.0587, refined_tol);
}
开发者ID:KoenBuys,项目名称:pcl,代码行数:47,代码来源:test_sample_consensus.cpp


注:本文中的ModelType::projectPoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。