# 【Matlab Computer Vision System ToolBox】学习笔记-3 -点云配准 | 噪音去除 | 降采样

【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. Hide and Show 3-D Point Cloud Figure - 显示和隐藏3D图

player=pcplayer(ptCloud.XLimits,ptCloud.YLimits,ptCloud.ZLimits);

>> hide(player)            // 隐藏
>> show(player)            // 显示
>> view(player,ptCloud);   // 显示点云

# 2. Align Two Point Clouds -点云匹配

A=[cos(pi/6) sin(pi/6) 0 0; -sin(pi/6) cos(pi/6) 0 0; 0 0 1 0; 5 5 10 1];
tform1=affine3d(A);

ptCloudTformed=pctransform(ptCloud,tform1);
figure
pcshow(ptCloudTformed);
title('Transformed Teapot');

tform=pcregrigid(ptCloudTformed,ptCloud,'Extrapolate',true);          //求点云匹配矩阵

disp(tform1.T);
tform2=invert(tform);
disp(tform2.T);

# 3. Merge Two Identical Point Clouds Using Box Grid Filter -用网格滤波合并两个点云

>> ptCloudA=pointCloud(100*rand(1000,3));
>> ptCloudB=copy(ptCloudA);
>> ptCloudC=pcmerge(ptCloudA,ptCloudB,1);
>> pcshow(ptCloudC);

# 4. Remove Outliers from Noisy Point Cloud -从点云中除去离群值

gv=0:0.01:1;
[X,Y]=meshgrid(gv,gv);
ptCloud=pointCloud([X( : ),Y( : ),0.5*ones(numel(X),1)]);   //创建点云平面

figure
pcshow(ptCloud);
title('Original Data');

noise=rand(500,3);
ptCloudA=pointCloud([ptCloud.Location;noise]);             //生成随机噪音点

figure
pcshow(ptCloudA);
title('Noisy Data');

% Remove outliers
ptCloudB=pcdenoise(ptCloudA);                               //除去离群值

figure
pcshow(ptCloudB);
title('Denoised Data');


# 5. Downsample Point Cloud Using Box Grid Filter -用格子滤波进行降采样

ptCloud=pcread('teapot.ply');
gridStep=0.1;
ptCloudA=pcdownsample(ptCloud,'gridAverage',gridStep);         //box grid filter 降采样

figure;
pcshow(ptCloud);
figure;
pcshow(ptCloudA);

stepSize=floor(ptCloud.Count/ptCloudA.Count);                //固定步长降采样
indices=1:stepSize:ptCloud.Count;
ptCloudB=select(ptCloud,indices);

figure;
pcshow(ptCloudB);


©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客