Why is it slow when I use segmentGroundFromLidarData function with pointCloud I made?
4 次查看(过去 30 天)
显示 更早的评论
This File is segmentGroundFromLidarData example.
When I use segmentGroundFromLidarData function after extracting only location from orginal pointCloud and rebuilding this location into pointCloud,
SegmentGroundFromLidarData's speed is more slower upto 2-times.
Why this situation is happened?
velodyneFileReaderObj = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E');
% Create a point cloud player using pcplayer. Define its x-, y-, and z-axes limits, in meters, and label its axes.
xlimits = [-40 40];
ylimits = [-15 15];
zlimits = [-3 3];
player = pcplayer(xlimits,ylimits,zlimits);
% Label the pcplayer axes.
xlabel(player.Axes,'X (m)')
ylabel(player.Axes,'Y (m)')
zlabel(player.Axes,'Z (m)')
% Set the colormap for labeling points. Use RGB triplets to specify green for ground-plane points, and red for obstacle points.
colors = [0 1 0; 1 0 0];
greenIdx = 1;
redIdx = 2;
% Iterate through the first 200 point clouds in the Velodyne PCAP file, using readFrame to read in the data. Segment the ground points from each point cloud. Color all ground points green and nonground points red. Plot the resulting lidar point cloud.
colormap(player.Axes,colors)
title(player.Axes,'Segmented Ground Plane of Lidar Point Cloud');
for i = 1 : 200
% Read current frame.
ptCloud = velodyneFileReaderObj.readFrame(i);
% Create label array.
colorLabels = zeros(size(ptCloud.Location,1),size(ptCloud.Location,2));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Find the ground points.
tic
groundPtsIdx = segmentGroundFromLidarData(ptCloud);
toc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% tic
% l = ptCloud.Location;
% pt = pointCloud(l);
% groundPtsIdx = segmentGroundFromLidarData(pt);
% toc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Map color ground points to green.
colorLabels(groundPtsIdx (:)) = greenIdx;
% Map color nonground points to red.
colorLabels(~groundPtsIdx (:)) = redIdx;
% Plot the results.
view(player,ptCloud.Location,colorLabels)
end
0 个评论
回答(1 个)
Venkata Ram Prasad Vanguri
2020-9-24
HI,
The extra time is due to point cloud creation. Keep point cloud creation out of time measuring block, then you will have similar timing results.
l = ptCloud.Location;
pt = pointCloud(l);
tic
groundPtsIdx = segmentGroundFromLidarData(pt);
toc
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Point Cloud Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!