You can download the dataset from here. github
Now it’s time to write the code, i have written this code in matplotlib.
Let me show you the folder structure for my project.
Now let’s write code:
First we going to write createNewTracks.m
% function nextId = createNewTracks(centroids, unassignedDetections, bboxes,nextId)
% Create new tracks from unassigned detections
% Inputs:
% centroids array
% unassignedDetections: array
% bboxes: array
% nextId: integer
% Outputs:
% nextId: array
function nextId = createNewTracks(centroids, unassignedDetections, bboxes,nextId)
global obj;
global tracks;
centroids = centroids(unassignedDetections, :);
bboxes = bboxes(unassignedDetections, :);
for i = 1:size(centroids, 1)
centroid = centroids(i,:);
bbox = bboxes(i, :);
% Create a Particle filter object.
particles=ones(100,2)*0.5*[centroid;centroid];
% Create a new track.
newTrack = struct(...
'id', nextId, ...
'bbox', bbox, ...
'particles', particles, ...
'age', 1, ...
'totalVisibleCount', 1, ...
'consecutiveInvisibleCount', 0, ...
'showId', 0);
% Add it to the array of tracks.
tracks(end + 1) = newTrack;
% Increment the next id.
nextId = nextId + 1;
end
end
The rest of code is under paywall. Please subscribe to it, it helps me pay my tuition fees and also you will get access to hundreds of program with their source code, you will get access to detailed articles, private dataset and many other things. So please consider subscribing.