error whith ACF detector

Dear all,
i want to track humans in video , i trained my own detector (Detector.mat)using ACF , and i want to track the detected human using kalamn filter , when i run the code i got this error :
Expected one output from a curly brace or dot indexing expression, but there were 0 results.
Error in detect (line 30)
results(i).Boxes = bboxes;
this is the code :
% This function is the main entrance
global obj;
vidReader = VideoReader('Berghouse Leopard Jog.mp4');
% Create video player for visualization
vidPlayer = vision.DeployableVideoPlayer;
load('Detector.mat');
% resizeRatio=1.5;
global tracks;
% obj = setupSystemObjects('trafficvideo_name.filetype');
tracks = initializeTracks(); % Create an empty array of tracks.
nextId = 1; % ID of the next track
showId = 1;
% Detect moving objects, and track them across video frames.
results = struct('Boxes',[],'Scores',[]);
i=1;
while(hasFrame(vidReader))
% GET DATA
frame = readFrame(vidReader);
% PROCESS
[bboxes, scores] = detect(detector,frame,'Threshold',0.9);
% Select strongest detection
[~,idx] = max(scores);
results(i).Boxes = bboxes;
results(i).Scores = scores;
% Compute the centroids
if isempty(bboxes)
centroids = [];
else
centroids = [(bboxes(:, 1) + bboxes(:, 3) / 2), ...
(bboxes(:, 2) + bboxes(:, 4) / 2)];
end
for i = 1:length(tracks)
% Predict the current location of the track.
bbox = tracks(i).bboxes(end, :);
% Predict the current location of the track.
predictedCentroid = predict(tracks(i).kalmanFilter);
% Shift the bounding box so that its center is at the predicted location.
tracks(i).predPosition = [predictedCentroid - bbox(3:4)/2, bbox(3:4)];
end
[assignments, unassignedTracks, unassignedDetections] = ...
detectionToTrackAssignment(centroids);
updateAssignedTracks(assignments,centroids, bboxes);
updateUnassignedTracks(unassignedTracks);
deleteLostTracks();
[nextId]=createNewTracks(centroids, unassignedDetections, bboxes,nextId);
annotation = sprintf('%s , Confidence %4.2f',detector.ModelName,scores(idx));
frame = insertObjectAnnotation(frame,'rectangle',bboxes(idx,:),annotation);
step(vidPlayer,frame);
i = i+1;
toc
end

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!