メインコンテンツ

LiDAR データからの地面の点と地面以外の点の抽出

関数 velodyneFileReader を使用して、PCAP ファイルから LiDAR データを読み取ります。

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

入力 LiDAR データから一連の LiDAR データ フレームを抽出する時間区間を指定します。

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

関数 pcplayer を使用して、入力 LiDAR データ フレームと抽出された地面の点を Figure ウィンドウに表示するように構成します。

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);

LiDAR データ フレームを読み取り、関数 segmentGroundFromLidarData を使用して LiDAR データに含まれる地面の点を抽出します。その後、抽出された地面の点のインデックスを使用して、フレームから地面以外の点をセグメント化します。

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.

参考

| | |

トピック