Skip to content

Commit

Permalink
implemented centriod tracker to track each person
Browse files Browse the repository at this point in the history
  • Loading branch information
aliizadi committed May 20, 2020
1 parent a97405c commit b37dae5
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions person-recognition/videos_tracker/centroidtracker.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from collections import OrderedDict

import cv2
import numpy as np
from scipy.spatial import distance as dist

import cv2
from videos_tracker.algorithms import recognize_faces


Expand Down Expand Up @@ -110,29 +110,23 @@ def new_person(person):


def __save_image(self, frame, image_id):
# print('trying to save image')
cv2.imwrite(f'static/images/{image_id}.png', frame)
print('image saved')


def update(self, frames_information):
# print('----------------------------', len(self.faces))

rects = [frame_information[0] for frame_information in frames_information]
trackable_face = [(frame_information[1], frame_information[2], frame_information[3], frame_information[4], frame_information[0]) for frame_information in frames_information]
# print(rects)
if len(rects) == 0:
# print('all faces disappeared')
self.__all_faces_disappeared()
return self.faces

input_centroids = self.__compute_rects_centers(rects)

if len(self.faces) == 0:
# print('first new faces appeared')
self.__first_new_faces_appeared(input_centroids, trackable_face)
else:
# print('track by centroids')
self.__track_by_centroids(input_centroids, trackable_face)

return self.faces
Expand Down

0 comments on commit b37dae5

Please sign in to comment.