本人初次接触matlab学习点云处理工作,现根据matlab自带的实例整理了一些常用的函数,以供将来的算法学习。
matlab2020a
bins = pcbin(ptCloud,numBins)
bins =pcbin(ptCloud,numBins,spatialLimits)
[bins,binLocations] = pcbin()
从点云构建占用网格
openExample('vision/BuildOccupancyGridFromPointCloudExample')
从点云中构建鸟瞰密度网格
openExample('vision/BuildBirdsEyeViewDensityGridFromPointCloudExample')
ptCloudOut = pcdenoise(ptCloudIn)
[ptCloudOut,inlierIndices,outlierIndices] = pcdenoise(ptCloudIn)
[ptCloudOut,___] = pcdenoise(___Name,Value)
从嘈杂点云中移除异常值
openExample('vision/RemoveOutliersFromNoisyPointCloudExample')
ptCloudOut = pcdownsample(ptCloudIn,‘random’,percentage)
ptCloudOut = pcdownsample(ptCloudIn,‘gridAverage’,gridStep)
ptCloudOut = pcdownsample(ptCloudIn,‘nonuniformGridSample’,maxNumPoints)
使用盒式网格过滤器对点云进行下采样
openExample('vision/DownsampleAPointCloudWithBoxGridFilterExample')
从点云中删除冗余点
openExample('vision/RemoveRedundantPointsFromPointCloudExample')
normals = pcnormals(ptCloud)
normals = pcnormals(ptCloud,k)
点云的估计法线
openExample('vision/EstimateNormalsOfPointCloudExample')
ptCloudOut = pcmerge(ptCloudA,ptCloudB,gridStep)
使用方格滤镜合并两个相同的点云
openExample('vision/MergeTwoIdenticalPointCloudsWithBoxGridFilterExample')
labels = pcsegdist(ptCloud,minDistance)
[labels,numClusters] = pcsegdist(ptCloud,minDistance)
基于欧氏距离的聚类点云
openExample('vision/ClusterSphericalPointCloudBasedOnEuclideanDistanceExample')
基于欧氏距离的集群激光雷达点云技术
openExample('vision/ClusterLidarPointCloudBasedOnEuclideanDistanceExample')
labels = segmentLidarData(ptCloud,distThreshold)
labels = segmentLidarData(ptCloud,distThreshold,angleThreshold)
[labels,numClusters] = segmentLidarData(___)
集群组织的合成激光雷达数据
openExample('vision/ClusterOrganizedSyntheticLidarDataExample')
集群组织的激光雷达点云
openExample('vision/ClusterOrganizedLidarPointCloudExample')
groundPtsIdx = segmentGroundFromLidarData(ptCloud)
groundPtsIdx = segmentGroundFromLidarData(ptCloud,Name,Value)
对有组织的激光雷达数据进行分割和绘图
openExample('vision/FindGroundPointsFromOrganizedPointCloudExample')
使用PCAP文件对地面平面进行分割和绘制
openExample('vision/FindGroundFromPointCloudsPCAPFileExample')
[indices,dists] = findNearestNeighbors(ptCloud,point,K)
[indices,dists] = findNearestNeighbors(ptCloud,point,K,camMatrix)
[indices,dists] = findNearestNeighbors(___,Name,Value)
在点云中找到K-最近点领域
openExample('vision/FindKNearestNeighborsExample')
在有组织的点云中找到K-最近点领域
openExample('vision/FindKNearestInOrganizedPointCloudExample')
[indices,dists] = findNeighborsInRadius(ptCloud,point,radius)
[indices,dists] = findNeighborsInRadius(ptCloud,point,radius,camMatrix)
[indices,dists] = findNeighborsInRadius(___,Name,Value)
查找点云径向邻居
openExample('vision/FindNeighborsWithinRadiusOfAPointExample')
在有组织的点云中找到径向邻居
openExample('vision/FindRadialNeighborsInOrganizedPointCloudExample')
indices = findPointsInROI(ptCloud,roi)
indices = findpointsInROI(ptCloud,roi,camMatrix)
在长方体ROI点寻找点云openExample('vision/FindPointsWithinCuboidExample')
在长方体ROI组织点寻找点云
openExample('vision/FindCuboidInOrganizedPointCloudExample')
[ptCloudOut,indices] = removeInvalidPoints(ptCloud)
从点云中删除无效点
openExample(‘vision/RemoveInfinitevaluedPointsFromAPointCloudExample’)
G = createPoseGraph(vSet)
创建点云视图集姿态图形
openExample('vision/CreatePoseGraphFromPointCloudViewSetExample')
vSetOptim = optimizePoses(vSet)
vSetOptim = optimizePoses(vSet,Name,Value)
openExample('vision/CreateAndOptimizeAPoseGraphExample')
ptCloudOut = pctransform(ptCloudIn,tform)
ptCloudOut = pctransform(ptCloudIn,D)
旋转3d点云使用刚体变换
openExample('vision/Rotate3DPointCloudUsingRigidTransformationExample')
3d点云的仿射变换
openExample('vision/Rotate3DPointCloudExample')
使用位移场点云转换
openExample('vision/PointCloudTransformationUsingDisplacementFieldExample')
tform = pcregistericp(moving,fixed)
[tform,movingReg] = pcregistericp(moving,fixed)
[___,rmse] = pcregistericp(moving,fixed)
[___] = pcregistericp(moving,fixed,Name,Value)
使用ICP算法对齐两个点云
openExample('vision/AlignTwoPointCloudsUsingICPAlgorithmExample')
tform = pcregistercpd(moving,fixed)
[tform,movingReg] = pcregistercpd(moving,fixed)
[___,rmse] = pcregistercpd(moving,fixed)
[___] = pcregistercpd(moving,fixed,Name,Value)
使用cpd算法对齐两个点云
openExample('vision/AlignTwoPointCloudsUsingCPDAlgorithmExample')
tform = pcregisterndt(moving,fixed,gridStep)
[tform,movingReg] = pcregisterndt(moving,fixed,gridStep)
[___,rmse] = pcregisterndt(moving,fixed,gridStep)
[___] = pcregisterndt(moving,fixed,gridStep,Name,Value)
使用ndt算法对齐两个点云
openExample('vision/AlignTwoPointCloudsUsingNDTAlgorithmExample')
tform = rigid3d
tform = rigid3d(t)
tform = rigid3d(rot,trans)
与定义的平移和旋转生成刚性3-d对象
openExample('vision/ConstructARigid3DObjectThatDefinesTranslationAndRotationExample')
model = pcfitcylinder(ptCloudIn,maxDistance)
model = pcfitcylinder(ptCloudIn,maxDistance,referenceVector)
model = pcfitcylinder(ptCloudIn,maxDistance,referenceVector,maxAngularDistance)
[model,inlierIndices,outlierIndices] = pcfitcylinder(ptCloudIn,maxDistance)
[___,meanError] = pcfitcylinder(ptCloudIn,maxDistance)
[___] = pcfitcylinder(___,Name,Value)
点云中提取圆柱
openExample('vision/DetectACylinderFromPointCloudExample')
检测圆柱的点云
openExample('vision/DetectCylinderInPointCloudExample')
model = pcfitplane(ptCloudIn,maxDistance)
model = pcfitplane(ptCloudIn,maxDistance,referenceVector)
model = pcfitplane(ptCloudIn,maxDistance,referenceVector,maxAngularDistance)
[model,inlierIndices,outlierIndices] = pcfitplane(ptCloudIn,maxDistance)
[___,meanError] = pcfitplane(ptCloudIn,maxDistance)
[___] = pcfitplane(ptCloudIn,maxDistance,Name,Value)
点云检测多个平面
openExample('vision/DetectMultiplePlanesFromPointCloudExample')
model = pcfitsphere(ptCloudIn,maxDistance)
[model,inlierIndices,outlierIndices] = pcfitsphere(ptCloudIn,maxDistance)
[___,meanError] = pcfitsphere(ptCloudIn,maxDistance)
[___] = pcfitsphere(___,Name,Value)
点云检测球
openExample('vision/DetectSpherePointCloudExample')
P = fitPolynomialRANSAC(xyPoints,N,maxDistance)
[P,inlierIdx] = fitPolynomialRANSAC(___)
[___] = fitPolynomialRANSAC(___,Name,Value)
符合抛物线噪声数据使用RANSAC
[model,inlierIdx] = ransac(data,fitFcn,distFcn,sampleSize,maxDistance)
[___] = ransac(___,Name,Value)
拟合线2d点使用最小二乘和RANSAC算法
openExample('vision/FitLineTo2DPointsUsingLeastSquaresAndRANSACAlgorithmsExample')
model = cylinderModel(params)
model = planeModel(Parameters)
model = sphereModel(params)
ptCloud = pcread(filename)
openExample('vision/ReadAPointCloudFromAPLYFileExample')
pcwrite(ptCloud,filename)
pcwrite(ptCloud,filename,‘Encoding’,encodingType)
Ply
openExample('vision/WriteA3DPointCloudToAPLYFileExample')
Pcd
openExample('vision/Write3DOrganizedPointCloudToPCDFileExample')
ptCloud = pcfromkinect(depthDevice,depthImage)
ptCloud = pcfromkinect(depthDevice,depthImage,colorImage)
ptCloud = pcfromkinect(depthDevice,depthImage,colorImage,alignment)
veloReader = velodyneFileReader(fileName,deviceModel)
veloReader = velodyneFileReader(fileName,deviceModel,‘CalibrationFile’,calibFile)
openExample('vision/DisplayPointCloudsFromVelodynePCAPFileExample')
pcshow(ptCloud)
pcshow(xyzPoints)
pcshow(xyzPoints,color)
pcshow(xyzPoints,colorMap)
pcshow(filename)
pcshow(___,Name,Value)
ax = pcshow(___)
绘制球面点云与纹理映射
openExample('vision/PlotColorSphericalPointCloudExample')
pcshowpair(ptCloudA,ptCloudB)
pcshowpair(ptCloudA,ptCloudB,Name,Value)
ax = pcshowpair(___)
可视化两个点云之间的区别
openExample('vision/VisualizeDifferenceBetweenTwoPointCloudsExample')
player = pcplayer(xlimits,ylimits,zlimits)
player = pcplayer(xlimits,ylimits,zlimits,Name,Value)
openExample('vision/VisualizeDifferenceBetweenTwoPointCloudsExample')
vSet = pcviewset
使用点云登记进行雷达测程
openExample('vision/LidarOdometryUsingPointCloudRegistrationExample')
ptCloud = pointCloud(xyzPoints)
ptCloud = pointCloud(xyzPoints,Name,Value)
openExample('vision/CreatePointCloudObjectAndInspectPropertiesExample')