matlab点云文件预处理

论坛 期权论坛 脚本     
匿名技术用户   2020-12-30 18:34   298   0

1、Ply文件转矩阵

clc; 
clear; 
close all;
%% 载入数据 (TXT格式变为MAT格式  便于后续load data使用)
pointCloud1 = pcread('H:\配准\数据集\office\s1.ply');
pointCloud2=pcread('H:\配准\数据集\office\s2.ply');
% 显示DData
figure
pcshow(pointCloud1 );
xlabel('X');
ylabel('Y');
zlabel('Z');
title('Original pointCloud1 ');
%% 将DData转化为矩阵
DData1(:,1)= double(pointCloud1.Location(1:5:end,1));
DData1(:,2)= double(pointCloud1.Location(1:5:end,2));
DData1(:,3)= double(pointCloud1.Location(1:5:end,3));
%% 将MData转化为矩阵
MData1(:,1)= double(pointCloud2.Location(1:5:end,1));
MData1(:,2)= double(pointCloud2.Location(1:5:end,2));
MData1(:,3)= double(pointCloud2.Location(1:5:end,3));
%% 保存点云数据
office(1,1)={DData1};
office(1,2)={'001'};
office(2,1)={MData1};
office(2,2)={'002'};
save H:\配准\数据集\office\result\office.mat

2、显示三维点集(以‘.’形式显示)

scatter3(MDataNormals(:,1),MDataNormals(:,2),MDataNormals(:,3),'.')

3、以点云数据集中每10个点为小平面求的法向量,显示(ptMData已经被封装成点云类,MDataNormals是求得的法向量)

showptNormals(ptMData,MDataNormals)

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP