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 Polygon Labels
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
gTruth
— Ground truth data
groundTruth
object | vector of groundTruth
objects
Ground truth data, specified as a groundTruth
object or vector of groundTruth
objects.
typeOfLabel
— Label types
vector of labelType
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.
SampleFactor
— Sample factor
1
(default) | positive integer
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.
GroupLabelData
— Group columns from label data
'LabelName'
(default) | 'LabelType'
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
labelData
— Label data
cell array of tables
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
gatherLabelData
function does not gather label data for sublabels or attributes. If a label contains sublabels or attributes, in thelabelData
output, the function returns the position of the parent label only.
Version History
Introduced in R2021aR2022b: Project cuboids from 3-D world coordinates to 2-D image coordinates
Updated 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.
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 (한국어)