Multi.zip

  • PUDN用户
    了解作者
  • matlab
    开发工具
  • 1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2021-04-24 20:29
    上传日期
点云拼接实现场景三维建图,需自己下载数据集。
Multi.zip
  • Multi.m
    5.5KB
内容介绍
clear all close all clc load('livingRoom.mat'); % Extract two consecutive point clouds and use the first point cloud as % reference. %提取两个连续的点云,并使用第一个点云作为参考。 ptCloudRef = livingRoomData{1}; ptCloudCurrent = livingRoomData{2}; ptCloud2 = livingRoomData{3}; ptCloud3 = livingRoomData{4}; ptCloud4 = livingRoomData{5}; ptCloud5 = livingRoomData{6}; ptCloud6 = livingRoomData{7}; ptCloud7 = livingRoomData{8}; gridSize = 0.1; fixed = pcdownsample(ptCloudRef, 'gridAverage', gridSize); moving = pcdownsample(ptCloudCurrent, 'gridAverage', gridSize); % Note that the downsampling step does not only speed up the registration, % but can also improve the accuracy. %注意,下采样步骤不仅加快了配准速度,但也可以提高准确度。 tform = pcregistericp(moving, fixed, 'Metric','pointToPlane','Extrapolate', true); ptCloudAligned = pctransform(ptCloudCurrent,tform); mergeSize = 0.015; ptCloudScene = pcmerge(ptCloudRef, ptCloudAligned, mergeSize); % Visualize the input images. %可视化输入图像。 figure subplot(2,2,1) imshow(ptCloudCurrent.Color) title('First input image','Color','w') drawnow subplot(2,2,3) imshow(ptCloud2.Color) title('Second input image','Color','w') drawnow fixed1 = pcdownsample(ptCloudCurrent, 'gridAverage', gridSize); moving1 = pcdownsample(ptCloud2, 'gridAverage', gridSize); tform1 = pcregistericp(moving1, fixed1, 'Metric','pointToPlane','Extrapolate', true); ptCloudAligned1 = pctransform(ptCloud2,tform1); ptCloudScene1 = pcmerge(ptCloudCurrent, ptCloudAligned1, mergeSize); subplot(2,2,[2,4]) pcshow(ptCloudScene1, 'VerticalAxis','Y', 'VerticalAxisDir', 'Down') title('Initial world scene') figure subplot(2,2,1) imshow(ptCloud4.Color) title('First input image','Color','w') drawnow subplot(2,2,3) imshow(ptCloud5.Color) title('Second input image','Color','w') drawnow fixed2 = pcdownsample(ptCloud4, 'gridAverage', gridSize); moving2 = pcdownsample(ptCloud5, 'gridAverage', gridSize); tform2 = pcregistericp(moving2, fixed2, 'Metric','pointToPlane','Extrapolate', true); ptCloudAligned2 = pctransform(ptCloud5,tform2); ptCloudScene2 = pcmerge(ptCloud4, ptCloudAligned2, mergeSize); subplot(2,2,[2,4]) pcshow(ptCloudScene2, 'VerticalAxis','Y', 'VerticalAxisDir', 'Down') title('Initial world scene') figure subplot(2,2,1) imshow(ptCloud6.Color) title('First input image','Color','w') drawnow subplot(2,2,3) imshow(ptCloud7.Color) title('Second input image','Color','w') drawnow fixed3 = pcdownsample(ptCloud6, 'gridAverage', gridSize); moving3 = pcdownsample(ptCloud7, 'gridAverage', gridSize); tform3 = pcregistericp(moving3, fixed3, 'Metric','pointToPlane','Extrapolate', true); ptCloudAligned3 = pctransform(ptCloud7,tform3); ptCloudScene3 = pcmerge(ptCloud6, ptCloudAligned3, mergeSize); subplot(2,2,[2,4]) pcshow(ptCloudScene3, 'VerticalAxis','Y', 'VerticalAxisDir', 'Down') title('Initial world scene') figure subplot(2,2,1) imshow(ptCloudRef.Color) title('First input image','Color','w') drawnow subplot(2,2,3) imshow(ptCloudCurrent.Color) title('Second input image','Color','w') drawnow % Visualize the world scene. %世界场景。 subplot(2,2,[2,4]) pcshow(ptCloudScene, 'VerticalAxis','Y', 'VerticalAxisDir', 'Down') title('Initial world scene') xlabel('X (m)') ylabel('Y (m)') zlabel('Z (m)') % Store the transformation object that accumulates the transformation. %存储累积转换的转换对象。 accumTform = tform; figure hAxes = pcshow(ptCloudScene, 'VerticalAxis','Y', 'VerticalAxisDir', 'Down'); title('Updated world scene') % Set the axes property for faster rendering %设置“轴”属性以加快渲染速度 hAxes.CameraViewAngleMode = 'auto'; hScatter = hAxes.Children; for i = 3:length(livingRoomData) ptCloudCurrent = livingRoomData{i}; % Use previous moving point cloud as reference. %使用上一个移动点云作为参照。 fixed = moving; moving = pcdownsample(ptCloudCurrent, 'gridAverage', gridSize); % Apply ICP registration. %申请ICP注册 tform = pcregistericp(moving, fixed, 'Metric','pointToPlane','Extrapolate', true); % Transform the current point cloud to the reference coordinate system % defined by the first point cloud. %将当前点云转换为第一个点云定义的参考坐标系 accumTform = affine3d(tform.T * accumTform.T); ptCloudAligned = pctransform(ptCloudCurrent, accumTform); % Update the world scene. %更新世界场景 ptCloudScene = pcmerge(ptCloudScene, ptCloudAligned, mergeSize); % Visualize the world scene. %想象世界场景。 hScatter.XData = ptCloudScene.Location(:,1); hScatter.YData = ptCloudScene.Location(:,2); hScatter.ZData = ptCloudScene.Location(:,3); hScatter.CData = ptCloudScene.Color; drawnow('limitrate') end % During the recording, the Kinect was pointing downward. To visualize the % result more easily, let's transform the data so that the ground plane is % parallel to the X-Z plane. %在录制过程中,指向下方为了更容易地可视化结果,让我们转换数据,使地平面与X-Z平面平行。 angle = -pi/10; A = [1,0,0,0;... 0, cos(angle), sin(angle), 0; ... 0, -sin(angle), cos(angle), 0; ... 0 0 0 1]; ptCloudScene = pctransform(ptCloudScene, affine3d(A)); pcshow(ptCloudScene, 'VerticalAxis','Y', 'VerticalAxisDir', 'Down', ... 'Parent', hAxes) title('Updated world scene') xlabel('X (m)') ylabel('Y (m)') zlabel('Z (m)')
评论
    相关推荐
    • 基于Halcon的图像拼接算法研究_谭杰.zip
      基于Halcon的图像拼接算法研究,可以将图像进行拼接
    • 基于ply文件的特征匹配点云配准matlan程序
      基于ply文件的特征匹配点云配准matlab程序,直接从ply文件读取数据绘图内附两个ply文件,不同文件dist筛选标准不一样,可根据生成的图5调试参数
    • 基于PCA的点云位姿估计与粗拼接,matlab实现
      使用主元分析法PCA对两片点云数据作粗略的拼接配准,可以作为ICP算法的预处理步骤。尝试规定了PCA主元向量的朝向。附带ply文件格式的bunny多视角数据。
    • 基于特征匹配和RANSAC的三维点云拼接配准方法,matlab实现
      读研期间做的文献复原,关键点提取、建立特征描述符、匹配特征点、RANSAC去除误匹配、坐标配准全部流程都走了一遍,用bunny数据做的测试,每一步都有画图,结果精度还不错。有没做好的地方欢迎指正。
    • Kinect Live 3D点云匹配Demo:宋万斌的仓库-matlab开发
      实时 3D 重建与点云拼接。 这个演示中的亮点是实时 3D 重建。 用户可以使用 ICP(迭代最近点)算法轻松组合多个点云以重建 3D 场景。 它可用于各种应用,例如开发对象的 3D 模型或为 SLAM(同步定位和映射)构建 3D...
    • 3D点云图构建实验
      3D点云图构建实验指导书和源码,根据五张RGB图片和五张深度图片,构建3D点云图
    • opencv点云拼接.zip
      基于C++语言,建立工程文件,编写opencv点云拼接操作代码
    • Matlab:MATLAB-研究-点云
      配准和拼接一系列点云点云数据细分为集群 1.1注册和缝合一系列点云示例:使用迭代最近点(ICP)算法的3D场景重建: 来源: : veloReader = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E'); ...
    • 经典的ICP点云拼接配准算法,matlab实现,带例程,附带RMS误差分析
      自己实现的经典ICP算法,采用PCA作了粗拼接,然后使用K-d树算法加速选取对应点,使用bunny数据进行了拼接实验,并计算了其RMS误差。经典ICP算法中不包含筛选删除误匹配点对的步骤,因此精度较低。
    • codesforimageprocessing.rar
      实现简单图像处理,包括256色转灰度图、Hough变换、Walsh变换、中值滤波、二值化变换、亮度增减、傅立叶变换、反色、取对数、取指数、图像平移、图像旋转、图像细化、图像缩放、图像镜像、均值滤波、对比度拉伸、拉普拉斯锐化(边缘检测)、方块编码、梯度锐化、灰度均衡、直方图均衡、离散余弦变换、维纳滤波处理、逆滤波处理、阈值变换、高斯平滑。