本系列博客将介绍Matlab中机器视觉工具箱的应用,部分案例,主要关于点云处理方面,更多内容见Matlab官方文档。如有翻译错误请批评指正!所有代码经自己运行测试通过。转载请注明链接 :http://blog.csdn.net/kaspar1992
【Matlab Computer Vision System ToolBox】学习笔记-1-点云配准流程 | 特征匹配
【Matlab Computer Vision System ToolBox】学习笔记-2-3D立体图创建 | 视差图 | 3D点云图
【Matlab Computer Vision System ToolBox】学习笔记-3 -点云配准 | 噪音去除 | 降采样
【Matlab Computer Vision System ToolBox】学习笔记-4 -点云文件PLY格式
1. PointCloud Registration Workflow -点云配准流程
2. Bluran Image Using an Average Filter -均值滤波模糊图像
>> I=imread('pout.tif'); >> imshow(I); >> intImage=integralImage(I); >> imshow(intImage); >> avgH=integralKernel([1 1 7 7],1/49); >> J=integralFilter(intImage,avgH); >> imshow(J); >> J=uint8(J); >> figure >> imshow(J);
3. Find Corresponding Interest Points Between Pair of Images -寻找两幅图中相应兴趣点
用的是 Harris算法. 参见Harris角点检测原理分析
在OpenCV中的应用 图像处理之角点检测算法(Harris Corner Detection)
>> I1=rgb2gray(imread('viprectification_deskLeft.png')); >> I2=rgb2gray(imread('viprectification_deskRight.png')); //读入左右图像 >> points1=detectHarrisFeatures(I1); >> points2=detectHarrisFeatures(I2); //获取Harris角点 >> [features1,valid_points1]=extractFeatures(I1,points1); >> [features2,valid_points2]=extractFeatures(I2,points2); // 提取特征点 >> indexPairs=matchFeatures(features1,features2); //特征匹配 >> matchPoints1=valid_points1(indexPairs(:,1),:); >> matchPoints2=valid_points2(indexPairs(:,2),:); //恢复特征点在图中的位置 >> figure; >> showMatchedFeatures(I1,I2,matchPoints1,matchPoints2);
4. Find Corresponding Points Using SURF Features -使用SURF匹配图像特征
>> I1=imread('cameraman.tif'); >> I2=imresize(imrotate(I1,-30),1.3); >> pionts1=detectSURFFeatures(I1); //检测SURF角点 >> points2=detectSURFFeatures(I2); >> [f1,vpts1]=extractFeatures(I1,pionts1); >> [f2,vpts2]=extractFeatures(I2,points2); >> indexPairs=matchFeatures(f1,f2); >> matchedPoints1=vpts1(indexPairs(:,1)); >> matchedPoints2=vpts2(indexPairs(:,2)); >> figure; >> showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2); >> legend('matched points1','matched points2');
不过发现一个问题,有些特征点匹配时错误的,仔细观察上图会发现。
下面介绍如何除去错误的匹配点,一个有效的方法是 RANSAC 算法。
去除无效点之后的图如下:[tform,inlierDistorted,inlierOriginal]=estimateGeometricTransform(matchedPoints2,matchedPoints1,'similarity'); figure; showMatchedFeatures(I1,I2,inlierOriginal,inlierDistorted); title('Matching points(inliers only)'); legend('I1','I2');
5. Detect SURF Interest Points in a Grayscale Image -在灰度图中检测SURF特征点
在上述代码中,使用 图像 I1 和 Points1
imshow(I1); hold on; plot(points1.selectStrongest(10));
![]()