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

Detect objects using aggregate channel features

Description

Create a trained aggregate channel features (ACF) object detector. 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.

Creation

Use the trainACFObjectDetector function with training data to create an ACF object detector.

Syntax

detector = trainACFObjectDetector(trainingData)
detector = trainACFObjectDetector(trainingData,Name,Value)

Description

example

detector = trainACFObjectDetector(trainingData) returns a trained aggregate channel features (ACF) object detector.

example

detector = trainACFObjectDetector(trainingData,Name,Value) returns an ACF object detector with additional options specified by one or more Name,Value pair arguments.

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.

Example: 'stopSign'

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.

Object Functions

detectDetect objects using ACF object detector

Examples

expand all

Load the training data.

load('stopSignsAndCars.mat')

Select the ground truth for stop signs.

stopSigns = stopSignsAndCars(:, 1:2);

Add the fullpath to image files.

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

Train the ACF detector.

acfDetector = trainACFObjectDetector(stopSigns,'NegativeSamplesFactor',2,'Verbose',false);

Test the ACF detector on a test image.

img = imread('stopSignTest.jpg');

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

Display the detection result.

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