This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

selectLabels

Select ground truth data for a set of labels

The selectLabels function will be removed in a future release. Use selectLabelsByGroupselectLabelsByType and selectLabelsByName instead.

For more information, see selectLabels object function will be removed

Syntax

gtLabel = selectLabels(gTruth,labelNames)
gtLabel = selectLabels(gTruth,types)

Description

example

gtLabel = selectLabels(gTruth,labelNames) returns a new groundTruth object, or array of groundTruth objects, containing only the labels specified by labelNames.

example

gtLabel = selectLabels(gTruth,types) returns a new groundTruth object, or array of groundTruth objects, containing only the label types specified by types.

Examples

collapse all

Add the image folder to the MATLAB path.

imageDir = fullfile(matlabroot,'toolbox','vision','visiondata','stopSignImages');
addpath(imageDir);

Load the ground truth object.

load('stopSignsAndCarsGroundTruth.mat');

View the definitions.

stopSignsAndCarsGroundTruth.LabelDefinitions
ans=3×3 table
       Name         Type       Group 
    __________    _________    ______

    'stopSign'    Rectangle    'None'
    'carRear'     Rectangle    'None'
    'carFront'    Rectangle    'None'

Obtain the ground truth data for labelName 'stopSign'.

stopSignGroundTruth = selectLabels(stopSignsAndCarsGroundTruth,'stopSign');

Obtain the ground truth data for labelType Rectangle.

rectGroundTruth = selectLabels(stopSignsAndCarsGroundTruth,labelType.Rectangle);

Obtain ground truth for 'carRear' and 'carFront'.

carGroundTruth = selectLabels(stopSignsAndCarsGroundTruth,{'carRear','carFront'});

Remove the image folder from the path.

rmpath(imageDir);

Input Arguments

collapse all

Ground truth labels, specified as a groundTruth object or as an array of groundTruth objects.

Label names, specified as a cell array of character vectors.

Label type, specified as a labelType enumeration.

Output Arguments

collapse all

Ground truth with only specified labels or types, returned as a groundTruth object or as an array of groundTruth objects.

Compatibility Considerations

expand all

Not recommended starting in R2019a

Introduced in R2017a