• 大小: 3KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: Matlab
  • 标签: MATLAB  

资源简介

基于MATLAB的三维点云的配准和融合

资源截图

代码片段和文件信息

%% 点云的配准
clc;
clear;
close all;

%% 导入数据
dataFile = fullfile(toolboxdir(‘vision‘) ‘visiondata‘ ‘livingRoom.mat‘);
load(dataFile);

%% 依次将点云数据存出来
for i=1:length(livingRoomData)
    pcwrite(livingRoomData{i}[‘house_init‘num2str(i)]‘PLYFormat‘‘binary‘);
end

%% 参考点云数据
% Extract two consecutive point clouds and use the first point cloud as
% reference.
ptCloudRef = livingRoomData{1};
ptCloudCurrent = livingRoomData{2};

%% 显示点云
figure;
pcshow(ptCloudRef);
figure;
pcshow(ptCloudCurrent);

%% 点云的预处理
% Note that the downsampling step does not only speed up the registration
% but can also improve the accuracy.
gridSize = 0.1;
fixed = pcdownsample(ptCloudRef ‘gridAverage‘ gridSize);
moving = pcdownsample(ptCloudCurrent ‘gridAverage‘ gridSize);

%% 确定点云之间的变换关系
% finding the rigid transformation for aligning the second point cloud with the first point cloud.
tform = pcregrigid(moving fixed ‘Metric‘‘pointToPlane‘‘Extrapolate‘ true);
ptCloudAligned = pctransform(ptCloudCurrenttform);

%% 点云的融合
%The overlapped region is filtered using a 1.5cm box grid filter. 
%Increase the merge size to reduce the storage requirement of the 
%resulting scene point cloud and decrease th

评论

共有 条评论