如何将点云文件与 Matlab 中的另一个图重叠?
How to overlap a point cloud file with another plot in Matlab?
我有一个 .pcd
地形测量文件,是我使用此命令打开的:
% read point cloud
big_island_cloud = pcread('C:\Users\to\path\Desktop\big_island_5m.pcd');
pcshow(big_island_cloud)
现在,我按以下方式使用 readtable
从 .csv
文件中读取所有必要的列,并验证一切正常 file(1:3,:)
并使用 [=16= 绘制结果]:
file = readtable('C:\Users\to\path\Desktop\EKF_USBL_CAM_Pose_Projected.csv');
file(1:3,:)
timeStamp = file(:,1);
pose_pose_position_x = file(:,4);
pose_pose_position_y = file(:,5);
stackedplot(file,{'time','field_pose_pose_position_x'});
下面是我得到的,pose_pose_position_x
将是我必须在 .pcd
文件上绘制的轨迹:
如何获得以下输出?:
感谢您对此事的阐明
假设您有 [x,y,z]
作为轨迹数据,那么您可以使用 hold on
和 plot3
:
简单地叠加一个图
基于example in the MATLAB documentation:
numFaces = 600;
[x,y,z] = sphere(numFaces);
figure;
pcshow([x(:),y(:),z(:)]);hold on % keeps the first plot on screen
plot3([1,1,-1],[1,0.5,1],[1,-0.5,-1]) % adds the trajectory on the plot
title('Sphere with Default Color Map');
xlabel('X');
ylabel('Y');
zlabel('Z');
结果
编辑
如果您只有 [x,y]
那么 plot
将替换 plot3
plot([1,1,-1],[1,0.5,1]) % adds the trajectory on the plot
注意轨迹会画在有z=0
的平面上
我有一个 .pcd
地形测量文件,是我使用此命令打开的:
% read point cloud
big_island_cloud = pcread('C:\Users\to\path\Desktop\big_island_5m.pcd');
pcshow(big_island_cloud)
现在,我按以下方式使用 readtable
从 .csv
文件中读取所有必要的列,并验证一切正常 file(1:3,:)
并使用 [=16= 绘制结果]:
file = readtable('C:\Users\to\path\Desktop\EKF_USBL_CAM_Pose_Projected.csv');
file(1:3,:)
timeStamp = file(:,1);
pose_pose_position_x = file(:,4);
pose_pose_position_y = file(:,5);
stackedplot(file,{'time','field_pose_pose_position_x'});
下面是我得到的,pose_pose_position_x
将是我必须在 .pcd
文件上绘制的轨迹:
如何获得以下输出?:
感谢您对此事的阐明
假设您有 [x,y,z]
作为轨迹数据,那么您可以使用 hold on
和 plot3
:
基于example in the MATLAB documentation:
numFaces = 600;
[x,y,z] = sphere(numFaces);
figure;
pcshow([x(:),y(:),z(:)]);hold on % keeps the first plot on screen
plot3([1,1,-1],[1,0.5,1],[1,-0.5,-1]) % adds the trajectory on the plot
title('Sphere with Default Color Map');
xlabel('X');
ylabel('Y');
zlabel('Z');
结果
编辑
如果您只有 [x,y]
那么 plot
将替换 plot3
plot([1,1,-1],[1,0.5,1]) % adds the trajectory on the plot
注意轨迹会画在有z=0