selectLabelsByType

Select ground truth data for a set of labels by type

Description

example

gtLabel = selectLabelsByType(gTruth,labelTypes) returns gtLabel a groundTruth object or an array of groundTruth objects, containing any labels from gTruth that match those specified by labelTypes..

Examples

collapse all

Add the image directory to the MATLAB path.

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

Load the groundTruth object.

load('stopSignsAndCarsGroundTruth.mat');

View the label 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 Rectangle labelType.

rectGroundTruth = selectLabelsByType(stopSignsAndCarsGroundTruth,labelType.Rectangle);

Remove the image directory 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 types, specified as an enumeration.

Output Arguments

collapse all

Ground truth with only specified labels, returned as a groundTruth object or an array of groundTruth objects, containing any labels from gTruth that match those specified by labelTypes.

Introduced in R2019a