PCL learning: key points -HARRIS

First, the class HarrisKeypoint2D

Class HarrisKeypoint2D enable detection sub-keys based on the point cloud harris field strength, which comprises a plurality of different variants of harris critical point detection algorithm, e.g. harris critical point detection algorithm proposed by Tomasi and the like.

pcl::HarrisKeypoint2D< PointInT, PointOutT, IntensityT >

Key Function Description:

  • H arrisKeypoint2D (ResponseMet hod method= HARRIS, intwindow_width =3 , intwindow_height=3, intmin_distance=S, float threshold= 0. 0)

Reconstruction function, method provided that need critical point detection method, there HARRIS, NOBLE, LOWE, TOMASI four methods, the default is H ARRIS, window_width, window_height for the detection window width and height, two key points of MIN_DISTANCE the minimum distance between allowable, threshold for judging whether the level of interest key Ko value, less than the width of the point values ​​is ignored, that is greater than the critical point.

  • void setMethod (ResponseMethod type)

Setting detection method.

  • void setWindowWidth (intwindow width)

The detection window width is provided.

  • void setWindowHeight (intwindow_height)

Provided detection window height.

  • void setSkippedPixels (intskipped_pixels)

Detecting the number of pixels disposed at each skipped.

  • void setMinimalDistance (intmin_distance)

Setting a minimum distance between the candidate keypoints.

  • void setThreshold ( float threshold)

Setting interest threshold.

  • void setNonMaxSupression ( bool= false)

Set whether the point is less than the threshold value of interest is removed, the culling if true, to optimize the results, if each point is false is returned, regardless of interest is above or below the threshold value of interest.

  • void setRefine (booldo refine)

Set whether the key results obtained were recalculated optimization.

  • void setNumberOfThreads (intnr threads)

Set the number of threads that the algorithm if OpenMP parallelism can be created.

  • void compute CPointCloudOut&output)

Computing access to key points, it is stored in the output.

Second, the class HarrisKeypoint3D

Class HarrisKeypoint3D and HarrisKeypoint2D similar, but it does not have a cloud point of detecting the intensity of key space, but the space 30 by the surface normal vector information dot clouds critical point detection is performed.

pcl::HarrisKeypoint3D< PointInT, PointOutT, NormalT >

Key Function Description:

  • HarrisKeypoint3D ( ResponseMethod method = HARRIS, float radius =0. 0lf, float threshold = 0. 0f)

Reconstruction function, method which requires setting the key point detection method is used, there HARRIS, NOBLE, LOWE, TOMASI, CURVATURE five methods, default HARRIS, radius is normal to estimate the search radius, but also the support of regional interest calculated values , threshold determination for the degree of interest is a critical point threshold value, the point is less than the threshold are ignored, that is greater than the critical point.

Third, the class HarrisKeypoint6D

Class HarrisKeypoint6D HarrisK eypoint2D with similar, but using Euclidean spatial domain or the intensity domain XYZ to determine a candidate keypoint, or both before the intersection, i.e., at the same time meet the most critical field strength and the XYZ domain as candidate keys.

pcl::HarrisKeypoint6D< PointInT, PointOutT, NormalT >

Key Function Description:

  • HarrisKeypoint6D (float radius =O. 01, float threshold = 0. 0)

Reconstruction function, noted here and no parameter selection method, which can be seen only through the source code using the method proposed by Tomasi achieve critical point detection, radius of the estimated normal search radius, but also to support the region of interest calculated values, to determine whether the threshold level of the key points of interest for the threshold value, below the threshold point is ignored, that is greater than the critical point.
 

Fourth, the test example

#include <iostream>
#include <pcl\io\pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/io/io.h>
#include <pcl/keypoints/harris_3D.h>//harris特征点估计类头文件声明
#include <cstdlib>
#include <vector>
#include <pcl/console/parse.h>
using namespace std;

int main(int argc,char *argv[]) 
{
	pcl::PointCloud<pcl::PointXYZ>::Ptr input_cloud (new pcl::PointCloud<pcl::PointXYZ>);
	pcl::io::loadPCDFile (argv[1], *input_cloud);
	pcl::PCDWriter writer;
	float r_normal;
	float r_keypoint;

	r_normal=stof(argv[2]);
	r_keypoint=stof(argv[3]);

	typedef pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI> ColorHandlerT3;

	pcl::PointCloud<pcl::PointXYZI>::Ptr Harris_keypoints (new pcl::PointCloud<pcl::PointXYZI> ());
	pcl::HarrisKeypoint3D<pcl::PointXYZ,pcl::PointXYZI,pcl::Normal>* harris_detector = new pcl::HarrisKeypoint3D<pcl::PointXYZ,pcl::PointXYZI,pcl::Normal> ;

	//harris_detector->setNonMaxSupression(true);
	harris_detector->setRadius(r_normal);         //设置法向量估算的半径
	harris_detector->setRadiusSearch(r_keypoint); //设置关键点估计的近邻搜索半径
	harris_detector->setInputCloud (input_cloud);
	//harris_detector->setNormals(normal_source);
	//harris_detector->setMethod(pcl::HarrisKeypoint3D<pcl::PointXYZRGB,pcl::PointXYZI>::LOWE);
	harris_detector->compute (*Harris_keypoints);
	cout<<"Harris_keypoints的大小是"<<Harris_keypoints->size()<<endl;
	writer.write<pcl::PointXYZI> ("Harris_keypoints.pcd",*Harris_keypoints,false);

	pcl::visualization::PCLVisualizer visu3("clouds");
	visu3.setBackgroundColor(255,255,255);
	visu3.addPointCloud (Harris_keypoints, ColorHandlerT3 (Harris_keypoints, 0.0, 0.0, 255.0), "Harris_keypoints");
	visu3.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE,8,"Harris_keypoints");
	visu3.addPointCloud(input_cloud,"input_cloud");
	visu3.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_COLOR,0,0,0,"input_cloud");
	visu3.spin ();
}

Excuting an order:

 .\Harrisdetect.exe ..\..\source\room.pcd 0.1 0.1

As shown, the detected critical point (blue dots); 

Guess you like

Origin blog.csdn.net/zfjBIT/article/details/92839090