【问题标题】:How to overlap a point cloud file with another plot in Matlab?如何将点云文件与 Matlab 中的另一个图重叠?
【发布时间】:2026-01-04 18:35:01
【问题描述】:

我有一个.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,:) 并使用stackedplot 绘制结果:

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 文件之上绘制的轨迹:

如何获得以下输出?:

感谢您对此事的了解

【问题讨论】:

    标签: matlab image-processing point-clouds


    【解决方案1】:

    假设您的轨迹数据有[x,y,z],那么您可以简单地使用hold onplot3 叠加一个图:

    基于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的平面上

    【讨论】:

      最近更新 更多