how to super impose the label data information from lidar labeller app to original data

4 ビュー (過去 30 日間)
I have lablelled raw lidar data using Lidar labeler app in matlab and we know while saving the data we will just get the label data info not tje whole traffic scene, so now i want to super impose this label info to my original data so can you suggest me a code for it, or can you tell me any other way to save the label data from lidar labller app so it will save it as original with bounding boxes. Any way I need y data with bounding boxes.

採用された回答

Hassaan
Hassaan 2024 年 1 月 22 日
  1. Load the labeled data which contains the bounding box information.
  2. Load the original LiDAR data (point cloud).
  3. Use visualization functions to display the point cloud.
  4. Overlay the bounding boxes onto the displayed point cloud.
% Load the labeled data from the MAT-file created by Lidar Labeler
labeledData = load('labeledData.mat');
% Load the original LiDAR data (replace with your actual file/data loading)
% It should match the labeled data in terms of dimensions and orientation
originalData = pcread('originalData.pcd'); % Example for .pcd files
% Display the original LiDAR data
pcshow(originalData.Location, 'VerticalAxis','Y', 'VerticalAxisDir', 'Down');
hold on;
title('LiDAR Data with Labeled Bounding Boxes');
% Assuming labeledData contains bounding boxes in a table format with variables
% 'Position' and 'Label' (update these variable names based on your labeledData structure)
for i = 1:size(labeledData.bbox, 1)
% Extract the bounding box information
bbox = labeledData.bbox.Position(i,:);
label = labeledData.bbox.Label{i};
% Define the corners of the bounding box
x = bbox(1);
y = bbox(2);
z = bbox(3);
w = bbox(4);
l = bbox(5);
h = bbox(6);
% Define vertices of the bounding box
vertices = [x, y, z;
x+w, y, z;
x+w, y+l, z;
x, y+l, z;
x, y, z+h;
x+w, y, z+h;
x+w, y+l, z+h;
x, y+l, z+h];
% Define the faces of the bounding box
faces = [1 2 3 4;
5 6 7 8;
1 2 6 5;
2 3 7 6;
3 4 8 7;
4 1 5 8];
% Plot the bounding box
patch('Vertices', vertices, 'Faces', faces, ...
'EdgeColor', 'r', 'FaceColor', 'none', 'LineWidth', 1.5);
% Add the label text
text(x, y, z, label, 'Interpreter', 'none', 'Color', 'r');
end
hold off;
Please adjust the code to match your labeled data's structure. This example assumes that the bounding boxes are stored in a table with columns for the position and label, and that your LiDAR data is in a format that pcread can handle (like .pcd). If your data is in a different format, you'll need to use the appropriate function to load it.
This code will visualize your original LiDAR data and overlay the labeled bounding boxes. The loop goes through each label and draws a box at the specified position. The pcshow function is used to display the point cloud, and the patch function creates the wireframe boxes.
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.
  3 件のコメント
Hassaan
Hassaan 2024 年 1 月 23 日
What is the error?
gaurav
gaurav 2024 年 1 月 31 日
The error are based on data structures and multiple errors. Below I am providing the properties of my data
gTruth =
groundTruthLidar with properties:
DataSource: [1×1 vision.labeler.loading.PointCloudSequenceSource]
LabelDefinitions: [1×5 table]
LabelData: [500×1 timetable]
>> gTruth.DataSource
ans =
PointCloudSequenceSource with properties:
Name: "Point Cloud Sequence"
Description: "A PointCloud sequence reader"
SourceName: "C:\Users\asus\Desktop\Lidar\Lidar"
SourceParams: [1×1 struct]
SignalName: "Lidar"
SignalType: PointCloud
Timestamp: {[500×1 duration]}
NumSignals: 1
>> gTruth.LabelDefinitions
ans = 1×5
table Name Type LabelColor Group Description ______________ ______ ________________________ ________ ___________ {'Pedestrian'} Cuboid {[0.5862 0.8276 0.3103]} {'None'} {0×0 char}
>> gTruth.LabelData
ans =
500×1
timetable Time Pedestrian ___________ ____________ 00:00.00000 {3×9 double} 00:01.00000 {3×9 double} 00:02.00000 {4×9 double} 00:03.00000 {4×9 double} 00:04.00000 {4×9 double} 00:05.00000 {4×9 double} 00:06.00000 {4×9 double} : : 08:13.00000 {4×9 double} 08:14.00000 {4×9 double} 08:15.00000 {4×9 double} 08:16.00000 {4×9 double} 08:17.00000 {4×9 double} 08:18.00000 {4×9 double} 08:19.00000 {4×9 double}

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePreprocessing についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by