Skip to content

Commit

Permalink
Redone data stored people_tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
KenH2 committed Nov 20, 2023
1 parent 5060b48 commit e61bc4d
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 175 deletions.
10 changes: 6 additions & 4 deletions people_tracking/msg/ColourCheckedTarget.msg
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
float64 time
int32 batch_nr
int32 idx_person
int32 x_position
int32 y_position
int32 z_position
int32 nr_persons
int32[] x_positions
int32[] y_positions
int32[] z_positions
sensor_msgs/Image detected_person

bool[] face_detections
22 changes: 12 additions & 10 deletions people_tracking/src/face_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,20 @@ def process_latest_data(self):
idx_match = None

if nr_batch > self.last_batch_processed:
face_detections = [False] * nr_persons
match, idx_match = self.recognize_faces(detected_persons)
if match:
msg = ColourCheckedTarget()
msg.time = time
msg.batch_nr = int(nr_batch)
msg.idx_person = int(idx_match)
msg.x_position = x_positions[idx_match]
msg.y_position = y_positions[idx_match]
msg.z_position = z_positions[idx_match]
msg.detected_person = detected_persons[idx_match]

self.publisher.publish(msg)
face_detections[idx_match] = True
msg = ColourCheckedTarget()
msg.time = time
msg.batch_nr = int(nr_batch)
msg.nr_persons = nr_persons
msg.x_positions = x_positions
msg.y_positions = y_positions
msg.z_positions = z_positions
msg.face_detections = face_detections

self.publisher.publish(msg)
self.last_batch_processed = nr_batch

if nr_persons > 0 and match:
Expand Down
Loading

0 comments on commit e61bc4d

Please sign in to comment.