selectLabels
Description
selects ground truth data of the specified label names or types gtLabel
= selectLabels(gTruth
,labels
)labels
from a groundTruthLidar
object gTruth
. The
function returns a corresponding groundTruthLidar
object
gtLabel
that contains only the selected labels. If
gTruth
is a vector of groundTruthLidar
objects, then
the function returns a vector of corresponding groundTruthLidar
objects
that contain only the selected labels.
Examples
Select Ground Truth Lidar Labels by Label Name or Label Type
Load a groundTruthLidar
object containing labels of various groups, types, and names into the workspace.
lidarDir = fullfile(matlabroot,'toolbox','lidar','lidardata','lidarLabeler'); addpath(lidarDir) load('lidarLabelerGTruth.mat')
Inspect the label definitions. The object contains label definitions of types Cuboid
and Scene
with various label names.
lidarLabelerGTruth.LabelDefinitions
ans=4×5 table
Name Type LabelColor Group Description
______________ ______ ________________________ ___________ ___________
{'car' } Cuboid {[0.5862 0.8276 0.3103]} {'vehicle'} {0x0 char}
{'bike' } Cuboid {[ 0.5172 0.5172 1]} {'vehicle'} {0x0 char}
{'pole' } Cuboid {[0.6207 0.3103 0.2759]} {'None' } {0x0 char}
{'vegetation'} Cuboid {[ 0 1 0.7586]} {'None' } {0x0 char}
Create a new groundTruthLidar
object that contains only the label definitions with the name "car"
.
labelNames = "car";
gtLidarLabel = selectLabels(lidarLabelerGTruth,labelNames);
View the label definitions of the returned groundTruthLidar
object.
gtLidarLabel.LabelDefinitions
ans=1×5 table
Name Type LabelColor Group Description
_______ ______ ________________________ ___________ ___________
{'car'} Cuboid {[0.5862 0.8276 0.3103]} {'vehicle'} {0x0 char}
Create a new groundTruthLidar
object that contains the label definitions from lidarLabelerGTruth
for only the labels of type Cuboid
.
labelType = labelType.Cuboid; gtLidarLabel = selectLabels(lidarLabelerGTruth,labelType)
gtLidarLabel = groundTruthLidar with properties: DataSource: [1x1 vision.labeler.loading.PointCloudSequenceSource] LabelDefinitions: [4x5 table] LabelData: [3x4 timetable]
View the label definitions of the returned groundTruthLida
r object.
gtLidarLabel.LabelDefinitions
ans=4×5 table
Name Type LabelColor Group Description
______________ ______ ________________________ ___________ ___________
{'car' } Cuboid {[0.5862 0.8276 0.3103]} {'vehicle'} {0x0 char}
{'bike' } Cuboid {[ 0.5172 0.5172 1]} {'vehicle'} {0x0 char}
{'pole' } Cuboid {[0.6207 0.3103 0.2759]} {'None' } {0x0 char}
{'vegetation'} Cuboid {[ 0 1 0.7586]} {'None' } {0x0 char}
Input Arguments
gTruth
— Ground truth lidar data
groundTruthLidar
object | vector of groundTruthLidar
objects
Ground truth lidar data, specified as a groundTruthLidar
object or
vector of groundTruthLidar
objects.
labels
— Label names or types
one or more label names | one or more label types
Label names or types, specified as one or more label names or one or more label
types. Specify one or more label names as a character vector, string scalar, cell array
of character vectors, or vector of strings. Specify one or more label types as a labelType
enumeration or vector of labelType
enumerations.
To view all distinct label names in a groundTruthLidar
object,
enter the first of these commands at the MATLAB® command prompt. To view all distinct label types in a
groundTruthLidar
object, enter the
second.
unique(gTruth.LabelDefinitions.Name) unique(gTruth.LabelDefinitions.Type)
Example: 'car'
Example: "car"
Example: {'car','lane'}
Example: ["car" "lane"]
Example: labelType.Cuboid
Example: [labelType.Cuboid labelType.Scene]
Output Arguments
gtLabel
— Ground truth with only selected labels
groundTruthLidar
object | vector of groundTruthLidar
objects
Ground truth with only the selected labels, returned as a groundTruthLidar
object or vector of
groundTruthLidar
objects.
Each groundTruthLidar
object in the gtLabel
output corresponds to a groundTruthLidar
object in the
gTruth
input. The returned objects contain only those labels from
the input ground truth objects that are of the label types or the label names specified
in the labels
input.
Version History
Introduced in R2020b
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)