Esempio n. 1
0
/// Harris6d keypoints detector
///
/// cloud       -- input point cloud
///
pcl::PointCloud<pcl::PointXYZI>::Ptr harris6d( pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr cloud ) {
  pcl::console::TicToc tt;
  tt.tic();

  // detector
  pcl::HarrisKeypoint6D<pcl::PointXYZRGB, pcl::PointXYZI>::Ptr harris_detector(
        new pcl::HarrisKeypoint6D<pcl::PointXYZRGB, pcl::PointXYZI>(  ) );

  pcl::search::KdTree<pcl::PointXYZRGB>::Ptr tree( new pcl::search::KdTree<pcl::PointXYZRGB>() );

  harris_detector->setSearchMethod( tree );
  harris_detector->setNonMaxSupression( true );
  harris_detector->setRadius( 0.03f );
  harris_detector->setRadiusSearch( 0.03f );


  pcl::PointCloud<pcl::PointXYZI>::Ptr kpts( new pcl::PointCloud<pcl::PointXYZI>() );

  harris_detector->setInputCloud( cloud );
  harris_detector->compute( *kpts );
  double t = tt.toc();
  pcl::console::print_value( "Harris6D takes %.3f for extractiing %d keypoints\n", t, (int)kpts->size() );

  return kpts;
}
bool vpro_harris_corner_process::execute()
{
    if (this->get_N_input_images() != 1)
    {
        vcl_cout << "In vpro_harris_corner_process::execute() - not exactly one input image\n";
        return false;
    }
    output_spat_objs_.clear();
    //assume the input images are grey scale (should really check)
    vil1_memory_image_of<unsigned char> img(vpro_video_process::get_input_image(0));
    vpro_video_process::clear_input();
    sdet_harris_detector harris_detector(*(static_cast<sdet_harris_detector_params*>(this)));
    harris_detector.set_image(img);
    harris_detector.extract_corners();
    vcl_vector<vsol_point_2d_sptr>& points = harris_detector.get_points();
    int N = points.size();
    if (!N)
        return false;
    for (int i = 0; i<N; i++)
        output_spat_objs_.push_back(points[i]->cast_to_spatial_object());

    output_topo_objs_.clear();
    output_image_ = 0;
    return true;
}
Esempio n. 3
0
/// Harris3d keypoints detector
///
/// cloud       -- input point cloud
///
pcl::PointCloud<pcl::PointXYZI>::Ptr harris3d( pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr cloud,
                                               pcl::HarrisKeypoint3D<pcl::PointXYZRGB, pcl::PointXYZI>::ResponseMethod method ) {
  pcl::console::TicToc tt;
  tt.tic();

  // detector
  pcl::HarrisKeypoint3D<pcl::PointXYZRGB, pcl::PointXYZI>::Ptr harris_detector(
        new pcl::HarrisKeypoint3D<pcl::PointXYZRGB, pcl::PointXYZI>( method ) );

  harris_detector->setNonMaxSupression( true );
  harris_detector->setRadius( 0.03f );
  harris_detector->setRadiusSearch( 0.03f );


  pcl::PointCloud<pcl::PointXYZI>::Ptr kpts( new pcl::PointCloud<pcl::PointXYZI>() );

  harris_detector->setInputCloud( cloud );
  harris_detector->compute( *kpts );
  double t = tt.toc();
  std::string method_name;
  switch( method ) {
  case pcl::HarrisKeypoint3D<pcl::PointXYZRGB, pcl::PointXYZ>::HARRIS:
    method_name = "HARRIS";
    break;
  case pcl::HarrisKeypoint3D<pcl::PointXYZRGB, pcl::PointXYZ>::TOMASI:
    method_name = "TOMASI";
    break;
  case pcl::HarrisKeypoint3D<pcl::PointXYZRGB, pcl::PointXYZ>::NOBLE:
    method_name = "NOBLE";
    break;
  case pcl::HarrisKeypoint3D<pcl::PointXYZRGB, pcl::PointXYZ>::LOWE:
    method_name = "LOWE";
    break;
  case pcl::HarrisKeypoint3D<pcl::PointXYZRGB, pcl::PointXYZ>::CURVATURE:
    method_name = "CURVATURE";
    break;
  }
  pcl::console::print_value( "Harris3D (%s) takes %.3f for extractiing %d keypoints\n", method_name.c_str(), t, (int)kpts->size() );

  return kpts;
}