資源簡介
基于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
- 上一篇:基于MATLAB的GPS網平差
- 下一篇:LDPC編碼構造的matlab實現
評論
共有 條評論