实现效果
图像特征匹配
通过将不同图像的特征进行拼接,然后一张拼一张,最后通过一些平衡化处理之后就可以得到一张全景图了。
图像特征处理主要分为以下几类:
- 角点:Harris算子,SUSAN算子,FAST算子
- 梯度特征点。SIFT、SURF、GLOH、ASIFT、PSIFT等
- 边缘特征(线型)。Canny算子、Marr算子
- 纹理特征。灰度共生矩阵。小波Gabor算子
这篇文章主要研究Harrias角点检测与特征匹配
Harris角点检测
通常意义上来说,角点就是极值点,即在某方面属性特别突出的点,是在某些属性上强度最大或者最小的孤立点、线段的终点。而对于图像而言,如图所示红点部分,即为图像的角点,其是物体轮廓线的连接点。
代码实现
// harris处理函数
pcl::PointCloud<pcl::PointXYZ>::Ptr harris_pick_impl(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud){
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_out(new pcl::PointCloud<pcl::PointXYZ>);
pcl::HarrisKeypoint3D<pcl::PointXYZ,pcl::PointXYZI> harris;
pcl::PointCloud<pcl::PointXYZI>::Ptr harris_keypoint(new pcl::PointCloud<pcl::PointXYZI>);
harris.setInputCloud(cloud);
harris.setMethod(harris.LOWE);
harris.setRadius(0.5);
harris.setRadiusSearch(0.2);
harris.setNonMaxSupression(true);
harris.setThreshold(0.002);
harris.setNumberOfThreads(10);
harris.compute(*harris_keypoint);
pcl::PointIndicesConstPtr keypointIndices=harris.getKeypointsIndices();
pcl::copyPointCloud(*cloud,*keypointIndices,*cloud_out);
return cloud_out;
}
// 封装调用
void MainWindow::harris_pick(){
// 设立关键点的颜色
auto cloud_old=cloud.makeShared();
auto cloud_out=harris_pick_impl(cloud.makeShared());
cloud=*cloud_out;
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> selected_color(cloud.makeShared(),255,0,0);
viewer->addPointCloud(cloud.makeShared(),selected_color,cloud_name[1]);
viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 10, cloud_name[1]);
viewer->resetCamera();
ui->qvtkWidget->update();
}