%% Detect Vehicles in Image
% Load the pre-trained detector for vehicles

detector = vehicleDetectorACF('front-rear-view');

%
% Load an image and run the detector.

I = imread('highway.png');
[bboxes,scores] = detect(detector,I);

%
% Overlay bounding boxes and scores for vehicles detected in the image.

I = insertObjectAnnotation(I,'rectangle',bboxes,scores);
figure
imshow(I)
title('Detected Vehicles and Detection Scores')

% Copyright 2012 The MathWorks, Inc.