Main Content

selectLabels

Select ground truth data for a set of labels

The selectLabels function will be removed in a future release. Use selectLabelsByGroup, selectLabelsByType, and selectLabelsByName instead.

For more information, see selectLabels object function will be removed

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.

Version History

Introduced in R2017a

expand all