gatherLabelData
Syntax
Description
returns label data gathered from ground truth data, labelData = gatherLabelData(gTruth,typeOfLabel)gTruth. The function
returns label data specified by typeOfLabel.
[
additionally returns the image timestamps associated with the gathered label data, using the
arguments from the previous syntax.labelData,timestamps] = gatherLabelData(___)
[___] = gatherLabelData(___,
uses name-value arguments to specify how to gather data. For example, Name=Value)labelData =
gatherLabelData(gTruth,typeofLabel,SampleFactor=5) specifies to drop every 5th
frame.
Examples
Gather all of the polygon labels from the groundtruth image.
data = load('groundtruthVisionTeam.mat');
gtruth = data.groundtruthVisionTeam;Gather all of the polygon objects.
labelData = gatherLabelData(gtruth, labelType('Polygon'), 'GroupLabelData', 'LabelType'); polygons = labelData{1}.PolygonData{1}(:,1); polygonLabels = labelData{1}.PolygonData{1}(:,2);
Visualize the polygon labels.
im = imread('visionteam.jpg'); imshow(im); showShape('polygon', polygons, 'Label', polygonLabels);

Input Arguments
Ground truth data, specified as a groundTruth object or vector of groundTruth
objects.
Label types from which to gather label data, specified as a vector of labelType objects. The gatherLabelData function gathers
label data from each groundTruth object specified by input
gTruth The label data is grouped in columns either by label name
or by label type, specified by the GroupLabelData name-value
argument.
Valid Enumeration Types
You can specify one or more of these enumeration types.
labelType.Rectangle— Rectangle ROI labelslabelType.RotatedRectangle— Rotated Rectangle ROI labelslabelType.Cuboid— Cuboid ROI labels (point clouds)labelType.ProjectedCuboid— Projected cuboid ROI labels (images and video data)labelType.Line— Line ROI labelslabelType.PixelLabel— Pixel ROI labelslabelType.Polygon— Pixel ROI labelslabelType.Scene— Scene labels
To gather label data for scenes, you must specify labelTypes
as the labelType.Scene enumeration scalar. You cannot specify any
other label types with labelType.Scene.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: labelData =
gatherLabelData(gTruth,typeofLabel,SampleFactor=5) specifies to drop every 5th
frame.
Sample factor to subsample label data, specified as a positive integer. A sample factor of K includes every Kth frame. Increase the sample factor to drop redundant frames from signals with high sample rates, such as video.
Group columns from label data, specified as 'LabelName' or
'LabelType'.
'LabelName'— Groups the label data by label definitions.'LabelType'— Groups the label data by label type. Use this option to gather label data with the region-of-interest (ROI) stacking order retained by the label type.
Group label data with the scene label type (labelType.Scene) by
label definitions only.
Output Arguments
Label data, returned as an M-by-1 cell array
of tables, where M is the number of groundTruth
objects in gTruth. The columns of the tables represent label data
grouped by either label name or label type, specified by the
GroupLabelData name-value argument.
For each cell in the table, the format of the returned label data depends on the type of label.
| Label Type | Storage Format for Labels at Each Timestamp |
|---|---|
labelType.Rectangle |
|
labelType.RotatedRectangle |
For one or more rotated rectangles, specify in spatial coordinates as an M-by-5 numeric matrix, where each row specifies a rotated rectangle of the form [xctr yctr w h yaw].
|
|
The figure shows how these values determine the position of a cuboid.
|
|
The figure shows how these values determine the position of a cuboid.
|
labelType.Line |
|
labelType.PixelLabel | Label data for all pixel label definitions is stored in a
single M-by-1 |
labelType.Polygon |
|
labelType.Scene | Logical 1 (true) if the scene label
is applied, otherwise logical 0
(false) |
Limitations
The
gatherLabelDatafunction does not gather label data for sublabels or attributes. If a label contains sublabels or attributes, in thelabelDataoutput, the function returns the position of the parent label only.
Version History
Introduced in R2021aUpdated to support 3-D projected cuboid labels.
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)

