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


C++ PointCloudPtr::size方法代码示例

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


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

示例1: isPointInCloud

//if a point is in a cloud
bool isPointInCloud(Point pt, PointCloudPtr cloud){
  for(int i=0;i<cloud->size();i++){
    if(pt.x==cloud->at(i).x&&pt.y==cloud->at(i).y&&pt.z==cloud->at(i).z){
      return true;
    }
  }

  return false;
}
开发者ID:ccjnmoe,项目名称:Modified-InfiniTAM,代码行数:10,代码来源:common_func.cpp

示例2: getAlignmentToX

void ppfmap::CudaPPFMatch<PointT, NormalT>::detect(
    const PointCloudPtr cloud, 
    const NormalsPtr normals, 
    std::vector<Pose>& poses) {

    float affine_s[12];
    std::vector<Pose> pose_vector;
    const float radius = map->getCloudDiameter() * neighborhood_percentage;

    std::vector<int> indices;
    std::vector<float> distances;

    pcl::KdTreeFLANN<PointT> kdtree;
    kdtree.setInputCloud(cloud);

    if (!use_indices) {
        ref_point_indices->resize(cloud->size());
        for (int i = 0; i < cloud->size(); i++) {
            (*ref_point_indices)[i] = i;
        }
    }

    poses.clear();
    for (const auto index : *ref_point_indices) {
        const auto& point = cloud->at(index);
        const auto& normal = normals->at(index);

        if (!pcl::isFinite(point)) continue;

        getAlignmentToX(point, normal, &affine_s);
        kdtree.radiusSearch(point, radius, indices, distances);

        poses.push_back(getPose(index, indices, cloud, normals, affine_s));
    }

    sort(poses.begin(), poses.end(), 
         [](const Pose& a, const Pose& b) -> bool { 
             return a.votes > b.votes; 
         });
}
开发者ID:ahundt,项目名称:PPFMap,代码行数:40,代码来源:CudaPPFMatch.hpp

示例3: findNearestNeighbor

//find nearest neighbor
bool findNearestNeighbor(PointCloudPtr cloud, PointCloudPtr except_cloud, Point search_pt, Point& finded_pt){
  int min=10;
  bool flag=false;

  for(int i=0;i<cloud->size();i++){
    int dis=sqrt(pow(search_pt.x-cloud->at(i).x, 2)+pow(search_pt.y-cloud->at(i).y, 2)+pow(search_pt.z-cloud->at(i).z, 2));
    if(dis<min){
      min=dis;
      finded_pt.x=cloud->at(i).x;
      finded_pt.y=cloud->at(i).y;
      finded_pt.z=cloud->at(i).z;

      if(!isPointInCloud(finded_pt, except_cloud)){
        flag=true;
      }
    }
  }

  return flag;
}
开发者ID:ccjnmoe,项目名称:Modified-InfiniTAM,代码行数:21,代码来源:common_func.cpp

示例4: cloud

int 
main (int argc, char ** argv)
{
  if (argc < 2) 
  {
    pcl::console::print_info ("Syntax is: %s input.pcd <options>\n", argv[0]);
    pcl::console::print_info ("  where options are:\n");
    pcl::console::print_info ("    -p dist_threshold,max_iters  ..... Subtract the dominant plane\n");
    pcl::console::print_info ("    -c tolerance,min_size,max_size ... Cluster points\n");
    pcl::console::print_info ("    -s output.pcd .................... Save the largest cluster\n");
    return (1);
  }

  // Load the input file
  PointCloudPtr cloud (new PointCloud);
  pcl::io::loadPCDFile (argv[1], *cloud);
  pcl::console::print_info ("Loaded %s (%zu points)\n", argv[1], cloud->size ());

  // Subtract the dominant plane
  double dist_threshold, max_iters;
  bool subtract_plane = pcl::console::parse_2x_arguments (argc, argv, "-p", dist_threshold, max_iters) > 0;
  if (subtract_plane)
  {
    size_t n = cloud->size ();
    cloud = findAndSubtractPlane (cloud, dist_threshold, (int)max_iters);
    pcl::console::print_info ("Subtracted %zu points along the detected plane\n", n - cloud->size ());
  }

  // Cluster points
  double tolerance, min_size, max_size;
  std::vector<pcl::PointIndices> cluster_indices;
  bool cluster_points = pcl::console::parse_3x_arguments (argc, argv, "-c", tolerance, min_size, max_size) > 0;
  if (cluster_points)
  {
    clusterObjects (cloud, tolerance, (int)min_size, (int)max_size, cluster_indices);
    pcl::console::print_info ("Found %zu clusters\n", cluster_indices.size ());
  }

  // Save output
  std::string output_filename;
  bool save_cloud = pcl::console::parse_argument (argc, argv, "-s", output_filename) > 0;
  if (save_cloud)
  {
    // If clustering was performed, save only the first (i.e., largest) cluster
    if (cluster_points)
    {
      PointCloudPtr temp_cloud (new PointCloud);
      pcl::copyPointCloud (*cloud, cluster_indices[0], *temp_cloud);
      cloud = temp_cloud;
    }
    pcl::console::print_info ("Saving result as %s...\n", output_filename.c_str ());
    pcl::io::savePCDFile (output_filename, *cloud);
  }
  // Or visualize the result
  else
  {
    pcl::console::print_info ("Starting visualizer... Close window to exit.\n");
    pcl::visualization::PCLVisualizer vis;

    // If clustering was performed, display each cluster with a random color
    if (cluster_points)
    {
      for (size_t i = 0; i < cluster_indices.size (); ++i)
      {
        // Extract the i_th cluster into a new cloud
        pcl::PointCloud<pcl::PointXYZ>::Ptr cluster_i (new pcl::PointCloud<pcl::PointXYZ>);
        pcl::copyPointCloud (*cloud, cluster_indices[i], *cluster_i);

        // Create a random color
        pcl::visualization::PointCloudColorHandlerRandom<pcl::PointXYZ> random_color (cluster_i);

        // Create a unique identifier
        std::stringstream cluster_id ("cluster");
        cluster_id << i;

        // Add the i_th cluster to the visualizer with a random color and a unique identifier
        vis.addPointCloud<pcl::PointXYZ> (cluster_i, random_color, cluster_id.str ());
      }
    }
    else
    {
      // If clustering wasn't performed, just display the cloud
      vis.addPointCloud (cloud);
    }
    vis.resetCamera ();
    vis.spin ();
  }

  return (0);
}
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:90,代码来源:test_segmentation.cpp

示例5: query

int 
main (int argc, char ** argv)
{
  if (argc < 3) 
  {
    pcl::console::print_info ("Syntax is: %s query.pcd <options>\n", argv[0]);
    pcl::console::print_info ("  where options are:\n");
    pcl::console::print_info ("    --objects_root_path root_path ......... Root path to append to files in object_files.txt \n");
    pcl::console::print_info ("    --objects object_files.txt ......... A list of the files to use as exemplars\n");
    pcl::console::print_info ("    --filter parameters.txt ............ Threshold, downsample, and denoise\n");
    pcl::console::print_info ("    --segment parameters.txt  .......... Remove dominant plane and cluster\n");
    pcl::console::print_info ("    --feature parameters.txt ........... Compute normals, keypoints, and descriptors\n");
    pcl::console::print_info ("    --registration parameters.txt ...... Align best fitting model to query\n");
    pcl::console::print_info ("  and where the parameters files must contain the following values (one per line):\n");
    pcl::console::print_info ("    filter parameters:\n");
    pcl::console::print_info ("      * min_depth\n");
    pcl::console::print_info ("      * max_depth\n");
    pcl::console::print_info ("      * downsample_leaf_size\n");
    pcl::console::print_info ("      * outlier_rejection_radius\n");
    pcl::console::print_info ("      * outlier_rejection_min_neighbors\n");
    pcl::console::print_info ("    segmentation parameters:\n");
    pcl::console::print_info ("      * plane_inlier_distance_threshold\n");
    pcl::console::print_info ("      * max_ransac_iterations\n");
    pcl::console::print_info ("      * cluster_tolerance\n");
    pcl::console::print_info ("      * min_cluster_size\n");
    pcl::console::print_info ("      * max_cluster_size\n");
    pcl::console::print_info ("    feature estimation parameters:\n");
    pcl::console::print_info ("      * surface_normal_radius\n");
    pcl::console::print_info ("      * keypoints_min_scale\n");
    pcl::console::print_info ("      * keypoints_nr_octaves\n");
    pcl::console::print_info ("      * keypoints_nr_scales_per_octave\n");
    pcl::console::print_info ("      * keypoints_min_contrast\n");
    pcl::console::print_info ("      * local_descriptor_radius\n");
    pcl::console::print_info ("    registration parameters:\n");
    pcl::console::print_info ("      * initial_alignment_min_sample_distance\n");
    pcl::console::print_info ("      * initial_alignment_max_correspondence_distance\n");
    pcl::console::print_info ("      * initial_alignment_nr_iterations\n");
    pcl::console::print_info ("      * icp_max_correspondence_distance\n");
    pcl::console::print_info ("      * icp_rejection_threshold\n");
    pcl::console::print_info ("      * icp_transformation_epsilon\n");
    pcl::console::print_info ("      * icp_max_iterations\n");

    return (1);
  }

  // Load input file
  PointCloudPtr query (new PointCloud);
  pcl::io::loadPCDFile (argv[1], *query);
  pcl::console::print_info ("Loaded %s (%lu points)\n", argv[1], query->size ());    

  ifstream input_stream;
  ObjectRecognitionParameters params;

  // Parse the exemplar files
  std::string objects_root_path;
  pcl::console::parse_argument (argc, argv, "--objects_root_path", objects_root_path);

  std::string objects_file;
  pcl::console::parse_argument (argc, argv, "--objects", objects_file);
  std::vector<std::string> exemplar_filenames (0);
  input_stream.open (objects_file.c_str ());
  if (input_stream.is_open ())
  {
    while (input_stream.good ())
    {
      std::string filename;
      input_stream >> filename;
      if (filename.size () > 0)
      {
        exemplar_filenames.push_back (objects_root_path + "/" + filename);
      }
    }
    input_stream.close ();
  }
  
  //Parse filter parameters
  std::string filter_parameters_file;
  pcl::console::parse_argument (argc, argv, "--filter", filter_parameters_file) > 0;    
  input_stream.open (filter_parameters_file.c_str ());
  if (input_stream.is_open())
  {
    input_stream >> params.min_depth;
    input_stream >> params.max_depth;
    input_stream >> params.downsample_leaf_size;
    input_stream >> params.outlier_rejection_radius;
    input_stream >> params.outlier_rejection_min_neighbors;
    input_stream.close ();
  }
开发者ID:2php,项目名称:pcl,代码行数:88,代码来源:test_object_recognition.cpp

示例6: cloud

int 
main (int argc, char ** argv)
{
  if (argc < 2) 
  {
    pcl::console::print_info ("Syntax is: %s input.pcd <options>\n", argv[0]);
    pcl::console::print_info ("  where options are:\n");
    pcl::console::print_info ("    -t min_depth,max_depth  ............... Threshold depth\n");
    pcl::console::print_info ("    -d leaf_size  ......................... Downsample\n");
    pcl::console::print_info ("    -r radius,min_neighbors ............... Radius outlier removal\n");
    pcl::console::print_info ("    -s output.pcd ......................... Save output\n");
    return (1);
  }

  // Load the input file
  PointCloudPtr cloud (new PointCloud);
  pcl::io::loadPCDFile (argv[1], *cloud);
  pcl::console::print_info ("Loaded %s (%zu points)\n", argv[1], cloud->size ());

  // Threshold depth
  double min_depth, max_depth;
  bool threshold_depth = pcl::console::parse_2x_arguments (argc, argv, "-t", min_depth, max_depth) > 0;
  if (threshold_depth)
  {
    size_t n = cloud->size ();
    cloud = thresholdDepth (cloud, min_depth, max_depth);
    pcl::console::print_info ("Eliminated %zu points outside depth limits\n", n - cloud->size ());
  }

  // Downsample and threshold depth
  double leaf_size;
  bool downsample_cloud = pcl::console::parse_argument (argc, argv, "-d", leaf_size) > 0;
  if (downsample_cloud)
  {
    size_t n = cloud->size ();
    cloud = downsample (cloud, leaf_size);
    pcl::console::print_info ("Downsampled from %zu to %zu points\n", n, cloud->size ());
  }

  // Remove outliers
  double radius, min_neighbors;
  bool remove_outliers = pcl::console::parse_2x_arguments (argc, argv, "-r", radius, min_neighbors) > 0;
  if (remove_outliers)
  {
    size_t n = cloud->size ();
    cloud = removeOutliers (cloud, radius, (int)min_neighbors);
    pcl::console::print_info ("Removed %zu outliers\n", n - cloud->size ());
  }

  // Save output
  std::string output_filename;
  bool save_cloud = pcl::console::parse_argument (argc, argv, "-s", output_filename) > 0;
  if (save_cloud)
  {
    pcl::io::savePCDFile (output_filename, *cloud);
    pcl::console::print_info ("Saved result as %s\n", output_filename.c_str ());
  }
  // Or visualize the result
  else
  {
    pcl::console::print_info ("Starting visualizer... Close window to exit.\n");
    pcl::visualization::PCLVisualizer vis;
    vis.addPointCloud (cloud);
    vis.resetCamera ();
    vis.spin ();
  }

  return (0);
}
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:69,代码来源:test_filters.cpp

示例7:

void Skeletonization3D::translate_points_to_inside(PointCloudPtr& cloud,
		int cam_num) const {
	for (unsigned int i = 0; i < cloud->size(); i++) {
		cloud->set_z(i, cloud->get_z(i) + move_distance);
	}
}
开发者ID:Garoe,项目名称:surrey-canine-mocap,代码行数:6,代码来源:Skeletonization3D.cpp

示例8: input

int 
main (int argc, char ** argv)
{
  if (argc < 3) 
  {
    pcl::console::print_info ("Syntax is: %s input.pcd output <options>\n", argv[0]);
    pcl::console::print_info ("  where options are:\n");
    pcl::console::print_info ("    --filter parameters.txt ............ Threshold, downsample, and denoise\n");
    pcl::console::print_info ("    --segment parameters.txt  .......... Remove dominant plane and cluster\n");
    pcl::console::print_info ("    --feature parameters.txt ........... Compute normals, keypoints, and descriptors\n");
    pcl::console::print_info ("    --registration parameters.txt ...... Align best fitting model to query\n");
    pcl::console::print_info ("  and where the parameters files must contain the following values (one per line):\n");
    pcl::console::print_info ("    filter parameters:\n");
    pcl::console::print_info ("      * min_depth\n");
    pcl::console::print_info ("      * max_depth\n");
    pcl::console::print_info ("      * downsample_leaf_size\n");
    pcl::console::print_info ("      * outlier_rejection_radius\n");
    pcl::console::print_info ("      * outlier_rejection_min_neighbors\n");
    pcl::console::print_info ("    segmentation parameters:\n");
    pcl::console::print_info ("      * plane_inlier_distance_threshold\n");
    pcl::console::print_info ("      * max_ransac_iterations\n");
    pcl::console::print_info ("      * cluster_tolerance\n");
    pcl::console::print_info ("      * min_cluster_size\n");
    pcl::console::print_info ("      * max_cluster_size\n");
    pcl::console::print_info ("    feature estimation parameters:\n");
    pcl::console::print_info ("      * surface_normal_radius\n");
    pcl::console::print_info ("      * keypoints_min_scale\n");
    pcl::console::print_info ("      * keypoints_nr_octaves\n");
    pcl::console::print_info ("      * keypoints_nr_scales_per_octave\n");
    pcl::console::print_info ("      * keypoints_min_contrast\n");
    pcl::console::print_info ("      * local_descriptor_radius\n");
    pcl::console::print_info ("    registration parameters:\n");
    pcl::console::print_info ("      * initial_alignment_min_sample_distance\n");
    pcl::console::print_info ("      * initial_alignment_max_correspondence_distance\n");
    pcl::console::print_info ("      * initial_alignment_nr_iterations\n");
    pcl::console::print_info ("      * icp_max_correspondence_distance\n");
    pcl::console::print_info ("      * icp_rejection_threshold\n");
    pcl::console::print_info ("      * icp_transformation_epsilon\n");
    pcl::console::print_info ("      * icp_max_iterations\n");
    pcl::console::print_info ("Note: The output's base filename must be specified without the .pcd extension\n");
    pcl::console::print_info ("      Four output files will be created with the following suffixes:\n");
    pcl::console::print_info ("        * '_points.pcd'\n");
    pcl::console::print_info ("        * '_keypoints.pcd'\n");
    pcl::console::print_info ("        * '_localdesc.pcd'\n");
    pcl::console::print_info ("        * '_globaldesc.pcd'\n");

    return (1);
  }

  // Load input file
  PointCloudPtr input (new PointCloud);
  pcl::io::loadPCDFile (argv[1], *input);
  pcl::console::print_info ("Loaded %s (%zu points)\n", argv[1], input->size ());    
  
  ObjectRecognitionParameters params;
  ifstream params_stream;

  //Parse filter parameters
  std::string filter_parameters_file;
  pcl::console::parse_argument (argc, argv, "--filter", filter_parameters_file) > 0;    
  params_stream.open (filter_parameters_file.c_str ());
  if (params_stream.is_open())
  {
    params_stream >> params.min_depth;
    params_stream >> params.max_depth;
    params_stream >> params.downsample_leaf_size;
    params_stream >> params.outlier_rejection_radius;
    params_stream >> params.outlier_rejection_min_neighbors;
    params_stream.close ();
  }
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:70,代码来源:build_object_model.cpp

示例9: appendCloud

//append a cloud to another cloud
void appendCloud(PointCloudPtr sourceCloud,PointCloudPtr targetCloud){
  for(int i=0;i<sourceCloud->size();i++){
    targetCloud->push_back(sourceCloud->at(i));
  }
}
开发者ID:ccjnmoe,项目名称:Modified-InfiniTAM,代码行数:6,代码来源:common_func.cpp

示例10: cloud

int 
main (int argc, char ** argv)
{
  if (argc < 2) 
  {
    pcl::console::print_info ("Syntax is: %s input.pcd <options>\n", argv[0]);
    pcl::console::print_info ("  where options are:\n");
    pcl::console::print_info ("    --surfel radius,order............... Compute surface elements\n");
    pcl::console::print_info ("    --convex ........................... Compute convex hull\n");
    pcl::console::print_info ("    --concave alpha .................... Compute concave hull\n");
    pcl::console::print_info ("    --greedy radius,max_nn,mu,surf_angle,min_angle,max_angle ... Compute greedy triangulation\n");
    pcl::console::print_info ("    -s output.pcd ...................... Save the output cloud\n");

    return (1);
  }

  // Load the points
  PointCloudPtr cloud (new PointCloud);
  pcl::io::loadPCDFile (argv[1], *cloud);
  pcl::console::print_info ("Loaded %s (%zu points)\n", argv[1], cloud->size ());

  // Compute surface elements
  SurfaceElementsPtr surfels (new SurfaceElements);
  double mls_radius, polynomial_order;
  bool compute_surface_elements = 
    pcl::console::parse_2x_arguments (argc, argv, "--surfel", mls_radius, polynomial_order) > 0;
  if (compute_surface_elements)
  {
    surfels = computeSurfaceElements (cloud, mls_radius, polynomial_order);
    pcl::console::print_info ("Computed surface elements\n");
  }

  // Find the convex hull
  MeshPtr convex_hull;
  bool compute_convex_hull = pcl::console::find_argument (argc, argv, "--convex") > 0;
  if (compute_convex_hull)
  {
    convex_hull = computeConvexHull (cloud);
    pcl::console::print_info ("Computed convex hull\n");
  }

  // Find the concave hull
  MeshPtr concave_hull;
  double alpha;
  bool compute_concave_hull = pcl::console::parse_argument (argc, argv, "--concave", alpha) > 0;
  if (compute_concave_hull)
  {
    concave_hull = computeConcaveHull (cloud, alpha);
    pcl::console::print_info ("Computed concave hull\n");
  }

  // Compute a greedy surface triangulation
  pcl::PolygonMesh::Ptr greedy_mesh;
  std::string params_string;
  bool perform_greedy_triangulation = pcl::console::parse_argument (argc, argv, "--greedy", params_string) > 0;
  if (perform_greedy_triangulation)
  {
    assert (surfels);

    std::vector<std::string> tokens;
    boost::split (tokens, params_string, boost::is_any_of (","), boost::token_compress_on);
    assert (tokens.size () == 6);
    float radius = atof(tokens[0].c_str ());
    int max_nearest_neighbors = atoi(tokens[1].c_str ());
    float mu = atof(tokens[2].c_str ());
    float max_surface_angle = atof(tokens[3].c_str ());
    float min_angle = atof(tokens[4].c_str ());
    float max_angle = atof(tokens[5].c_str ());

    greedy_mesh = greedyTriangulation (surfels, radius, max_nearest_neighbors, mu, 
                                       max_surface_angle, min_angle, max_angle);

    pcl::console::print_info ("Performed greedy surface triangulation\n");
  }


  // Compute a greedy surface triangulation
  pcl::PolygonMesh::Ptr marching_cubes_mesh;
  double leaf_size, iso_level;
  bool perform_marching_cubes = pcl::console::parse_2x_arguments (argc, argv, "--mc", leaf_size, iso_level) > 0;
  if (perform_marching_cubes)
  {
    assert (surfels);

    marching_cubes_mesh = marchingCubesTriangulation (surfels, leaf_size, iso_level);

    pcl::console::print_info ("Performed marching cubes surface triangulation\n");
  }

  // Save output
  std::string output_filename;
  bool save_output = pcl::console::parse_argument (argc, argv, "-s", output_filename) > 0;
  if (save_output)
  {
    // Save the result
    pcl::io::savePCDFile (output_filename, *cloud);

    pcl::console::print_info ("Saved result as %s\n", output_filename.c_str ());    
  }
  // Or visualize the result
//.........这里部分代码省略.........
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:101,代码来源:test_surface.cpp

示例11: cloud

int 
main (int argc, char ** argv)
{
  if (argc < 2) 
  {
    pcl::console::print_info ("Syntax is: %s input.pcd <options>\n", argv[0]);
    pcl::console::print_info ("  where options are:\n");
    pcl::console::print_info ("    -n radius  ...................................... Estimate surface normals\n");
    pcl::console::print_info ("    -k min_scale,nr_octaves,nr_scales,min_contrast... Detect keypoints\n");
    pcl::console::print_info ("    -l radius ....................................... Compute local descriptors\n");
    pcl::console::print_info ("    -s output_name (without .pcd extension).......... Save outputs\n");
    pcl::console::print_info ("Note: \n");
    pcl::console::print_info ("  Each of the first four options depends on the options above it.\n");
    pcl::console::print_info ("  Saving (-s) will output individual files for each option used (-n,-k,-f,-g).\n");
    return (1);
  }
  

  // Load the input file
  PointCloudPtr cloud (new PointCloud);
  pcl::io::loadPCDFile (argv[1], *cloud);
  pcl::console::print_info ("Loaded %s (%lu points)\n", argv[1], cloud->size ());
  
  // Estimate surface normals
  SurfaceNormalsPtr normals;
  double surface_radius;
  bool estimate_surface_normals = pcl::console::parse_argument (argc, argv, "-n", surface_radius) > 0;
  
  if (estimate_surface_normals)
  {  
    normals = estimateSurfaceNormals (cloud, surface_radius);
    pcl::console::print_info ("Estimated surface normals\n");
  }
  
  // Detect keypoints
  PointCloudPtr keypoints;
  std::string params_string;
  bool detect_keypoints = pcl::console::parse_argument (argc, argv, "-k", params_string) > 0;
  if (detect_keypoints)
  {
    assert (normals);
    std::vector<std::string> tokens;
    boost::split (tokens, params_string, boost::is_any_of (","), boost::token_compress_on);
    assert (tokens.size () == 4);    
    float min_scale = atof(tokens[0].c_str ());
    int nr_octaves = atoi(tokens[1].c_str ());
    int nr_scales = atoi(tokens[2].c_str ());
    float min_contrast = atof(tokens[3].c_str ());
    keypoints = detectKeypoints (cloud, normals, min_scale, nr_octaves, nr_scales, min_contrast);
    pcl::console::print_info ("Detected %lu keypoints\n", keypoints->size ());
  }
  
  // Compute local descriptors
  LocalDescriptorsPtr local_descriptors;
  double feature_radius;
  bool compute_local_descriptors = pcl::console::parse_argument (argc, argv, "-l", feature_radius) > 0;
  if (compute_local_descriptors)
  {
    assert (normals && keypoints);
    local_descriptors = computeLocalDescriptors (cloud, normals, keypoints, feature_radius);
    pcl::console::print_info ("Computed local descriptors\n");
  }

  // Compute global descriptor
  GlobalDescriptorsPtr global_descriptor;
  if (normals)
  {
    global_descriptor = computeGlobalDescriptor (cloud, normals);
    pcl::console::print_info ("Computed global descriptor\n");
  }

  // Save output
  std::string base_filename, output_filename;
  bool save_cloud = pcl::console::parse_argument (argc, argv, "-s", base_filename) > 0;
  if (save_cloud)
  {
    if (normals)
    {
      output_filename = base_filename;
      output_filename.append ("_normals.pcd");
      pcl::io::savePCDFile (output_filename, *normals);
      pcl::console::print_info ("Saved surface normals as %s\n", output_filename.c_str ());
    }
    if (keypoints)
    {
      output_filename = base_filename;
      output_filename.append ("_keypoints.pcd");
      pcl::io::savePCDFile (output_filename, *keypoints);
      pcl::console::print_info ("Saved keypoints as %s\n", output_filename.c_str ());
    }
    if (local_descriptors)
    {
      output_filename = base_filename;
      output_filename.append ("_localdesc.pcd");
      pcl::io::savePCDFile (output_filename, *local_descriptors);
      pcl::console::print_info ("Saved local descriptors as %s\n", output_filename.c_str ());
    }
    if (global_descriptor)
    {
      output_filename = base_filename;
//.........这里部分代码省略.........
开发者ID:2php,项目名称:pcl,代码行数:101,代码来源:test_feature_estimation.cpp


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