How to write helper functions in Lidar 3-D object detections
Afficher commentaires plus anciens
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
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.
Shahana Bano
le 19 Juin 2021
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
Ramya Sivanandham
le 23 Sep 2021
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>>
Ramya Sivanandham
le 23 Sep 2021
Though, that particular file is available in that path, this error still exists...
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Process Point Clouds dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!