主要内容

从激光雷达数据中提取地面点和非地面点

R2026b

使用 velodyneFileReader 函数从 PCAP 文件中读取激光雷达数据。

veloReader = velodyneFileReader("lidarData_ConstructionRoad.pcap","HDL32E");

指定时间间隔,以从输入激光雷达数据中提取一组激光雷达数据帧。

veloReader.CurrentTime = veloReader.StartTime + seconds(0.5);
StopTime = veloReader.StartTime + seconds(10);

使用 pcplayer 函数配置图窗窗口,以显示输入激光雷达数据帧和提取的地面点。

fig = figure(Position=[0 0 800 600]);

xlimits = [-30 30];
ylimits = [-30 30];
zlimits = [-10 20];
hPanel = uipanel(fig,Position=[0 0.5 1 0.5]);
hPlot = axes(hPanel);
player = pcplayer(xlimits,ylimits,zlimits,Parent=hPlot);

hPanel_groundData = uipanel(fig,Position=[0 0 0.5 0.5]);
hPlot_groundData = axes(hPanel_groundData);
player_groundData = pcplayer(xlimits,ylimits,zlimits,Parent=hPlot_groundData);

hPanel_nongroundData = uipanel(fig,Position=[0.5 0 0.5 0.5]);
hPlot_nongroundData = axes(hPanel_nongroundData);
player_nongroundData = pcplayer(xlimits,ylimits,zlimits,Parent=hPlot_nongroundData);

使用 segmentGroundFromLidarData 函数读取激光雷达数据帧,并提取激光雷达数据中的地面点。然后,利用所提取地面点的索引,从该帧中分割出非地面点。

while (hasFrame(veloReader) && veloReader.CurrentTime < StopTime)
    % Read a lidar data frame
    ptCloud = readFrame(veloReader);

    % Extract ground points from lidar data frame
    groundPtsIdx = segmentGroundFromLidarData(ptCloud);
    ptCloudGround = select(ptCloud,groundPtsIdx,OutputSize="full");

    % Extract non-ground points from lidar data frame
    ptCloudNonGround = select(ptCloud,~groundPtsIdx,OutputSize="full");
    
    % Display the input lidar data and the extracted points 
    view(player,ptCloud)
    title(hPlot,"Input Lidar Data")
    view(player_groundData,ptCloudGround)
    title(hPlot_groundData,"Extracted Ground Points")
    view(player_nongroundData,ptCloudNonGround)
    title(hPlot_nongroundData,"Extracted Non-Ground Points")
    colormap(autumn)
    pause(0.01);
end

Figure contains 3 axes objects and other objects of type uipanel. Axes object 1 with title Input Lidar Data, xlabel X, ylabel Y contains an object of type scatter. Axes object 2 with title Extracted Ground Points, xlabel X, ylabel Y contains an object of type scatter. Axes object 3 with title Extracted Non-Ground Points, xlabel X, ylabel Y contains an object of type scatter.

另请参阅

| | |

主题