How to write helper functions in Lidar 3-D object detections

Can anyone help me with the getting these helper functions in matlab, cropFrontViewFromLidarData helper function, saveptCldToPCD helper function, generateGTDataForAugmentation helper function, groundTruthDataAugmentation helper function,

4 commentaires

Pavan Kumar B N
Pavan Kumar B N le 16 Juin 2021
Modifié(e) : Pavan Kumar B N le 16 Juin 2021
Hi @Ganesh Sai Doggali are you able to detect objects in LiDAR data? Could you please provide some details about your implementation? I am also working on the same. Thank you.
function [croppedPointCloudObj, processedLabels] = cropFrontViewFromLidarData(lidarData, boxLabels, gridParams)
% This function crops the front view from the input full-view point cloud
% and also processes the corresponding box labels according to the
% specified grid parameters.
tmpStr = '';
numFiles = size(boxLabels,1);
processedLabels = cell(size(boxLabels));
croppedPointCloudObj = cell(size(numFiles));
% Get the classes from the ground truth labels.
classNames = boxLabels.Properties.VariableNames;
for i = 1:numFiles
ptCloud = read(lidarData);
groundTruth = boxLabels(i,:);
% Set the limits for the point cloud.
[x,y] = find( ptCloud.Location(:,:,1) < gridParams{1,2}{1} ...
& ptCloud.Location(:,:,1) > gridParams{1,1}{1} ...
& ptCloud.Location(:,:,2) < gridParams{1,2}{2} ...
& ptCloud.Location(:,:,2) > gridParams{1,1}{2} ...
& ptCloud.Location(:,:,3) < gridParams{1,2}{3} ...
& ptCloud.Location(:,:,3) > gridParams{1,1}{3});
ptCloud = select(ptCloud, x, y, 'OutputSize', 'full');
processedData = removeInvalidPoints(ptCloud);
for ii = 1:numel(classNames)
labels = groundTruth(1,classNames{ii}).Variables;
if(iscell(labels))
labels = labels{1};
end
if ~isempty(labels)
% Get the label indices that are in the selected RoI.
labelsIndices = labels(:,1) > gridParams{1,1}{1} ...
& labels(:,1) < gridParams{1,2}{1} ...
& labels(:,2) > gridParams{1,1}{2} ...
& labels(:,2) < gridParams{1,2}{2} ...
& labels(:,4) > 0 ...
& labels(:,5) > 0 ...
& labels(:,6) > 0;
labels = labels(labelsIndices,:);
if ~isempty(labels)
% Find the number of points inside each ground truth
% label.
numPoints = arrayfun(@(x)(findPointsInsideCuboid(cuboidModel(labels(x,:)),processedData)),...
(1:size(labels,1)).','UniformOutput',false);
posLabels = cellfun(@(x)(length(x) > 50), numPoints);
labels = labels(posLabels,:);
end
end
processedLabels{i,ii} = labels;
end
croppedPointCloudObj{i,1} = processedData;
end
% Print completion message when done.
msg = sprintf('Processing data 100%% complete');
fprintf(1,'%s',[tmpStr, msg]);
processedLabels = cell2table(processedLabels);
numClasses = size(processedLabels,2);
for j = 1:numClasses
processedLabels.Properties.VariableNames{j} = classNames{j};
end
end
Thank you @Shahana Bano. I have tried this function. But im getting some parse error. If possible, could you help me to solve this issue?
rror using matlab.io.datastore.FileDatastore/read (line 29)
Error using ReadFcn @(x)pcread(x) for file:
C:\ .....\Lidar_Dataset\Pandaset\Lidar\0472.pcd
Error using visionPcdRead
Internal file parsing error. Please see the documentation for more details.
Error in pcread (line 99)
properties = visionPcdRead(filename,requiredProperties,optionalProperties);
Error in main_Lidar>@(x)pcread(x) (line 33)
lidarData = fileDatastore(path,'ReadFcn',@(x) pcread(x));
Error in cropFrontViewFromLidarData (line 17)
ptCloud = read(lidarData);
Error in main_Lidar (line 83)
[croppedPointCloudObj,processedLabels] = cropFrontViewFromLidarData(lidarData,boxLabels,gridParams);
29 [data, info] = matlab.io.datastore.FileBasedDatastore.errorHandlerRoutine(fds,e);
473 throwAsCaller(ME);
K>>
Though, that particular file is available in that path, this error still exists...

Connectez-vous pour commenter.

 Réponse acceptée

Mahesh Taparia
Mahesh Taparia le 29 Mar 2021
Modifié(e) : Mahesh Taparia le 30 Mar 2021
Hi
The helper functions are shipped with the example. You can check the helper functions in the example folder by using command mentioned in that particular example. In your case, you are referring to this pointPillars example, whose command is present at the right side of the documentation (as View MATLAB Command), which is given below:
openExample('deeplearning_shared/Lidar3DObjectDetectionUsingPointPillarsExample')
Run this command, it will redirect to respective folder where all the associated functions are present.
Hope it will help!

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by