Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

acfObjectDetector class

Detect objects using aggregate channel features

Description

example

acfObjectDetector contains a trained aggregate channel features (ACF) object detector returned by the trainACFObjectDetector function. The ACF object detector recognizes specific objects in images, based on the training images and the object ground truth locations that are input to trainACFObjectDetector.

After the detector is trained, use the detect method to find objects in an image.

Properties

expand all

Name of the classification model, specified as a character vector. By default, the name is set to the heading of the second column of the groundTruth table specified in trainACFObjectDetector.

This property is read-only.

Size of training images, specified as a [height width] vector.

Example: [100,100]

This property is read-only.

Number of weak learners used in the detector, specified as a scalar integer. This property is set based on the ‘MaxWeakLearners' name-value pair in the trainACFObjectDetector function.

Methods

detectDetect objects using ACF object detector
Common to All System Objects
clone

Create System object™ with same property values

getNumInputs

Expected number of inputs to a System object

getNumOutputs

Expected number of outputs of a System object

isLocked

Check locked states of a System object (logical)

release

Allow System object property value changes

Examples

expand all

Use the trainACFObjectDetector with training images to create an ACF object detector that can detect stop signs. Test the detector with a separate image.

Load the training data.

load('stopSignsAndCars.mat')

Select the ground truth for stop signs. These ground truth is the set of known locations of stop signs in the images.

stopSigns = stopSignsAndCars(:,1:2);

Add the full path to the image files.

stopSigns.imageFilename = fullfile(toolboxdir('vision'),...
    'visiondata',stopSigns.imageFilename);

Train the ACF detector.

acfDetector = trainACFObjectDetector(stopSigns,'NumStages',3,'Verbose',false);

Test the ACF detector on a test image.

img = imread('stopSignTest.jpg');

[bboxes,scores] = detect(acfDetector,img);

Display the detection results and insert the bounding boxes for objects into the image.

for i = 1:length(scores)
   annotation = sprintf('Confidence = %.1f',scores(i));
   img = insertObjectAnnotation(img,'rectangle',bboxes(i,:),annotation);
end

figure
imshow(img)

References

[1] Dollar, P., R. Appel, S. Belongie, and P. Perona. "Fast Feature Pyramids for Object Detection." Pattern Analysis and Machine Intelligence, IEEE Transactions. Vol. 36, Issue 8, 2014, pp. 1532–1545.

Introduced in R2017a

Was this topic helpful?