Skip to content

Commit

Permalink
save data fix
Browse files Browse the repository at this point in the history
Signed-off-by: Ken Haagh <[email protected]>
  • Loading branch information
KenH2 committed Dec 14, 2023
1 parent 8168c44 commit 9f63c61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion people_tracking/src/people_tracking/depth_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_depth_data(self, data):
# rospy.logwarn("No depth image available.")
# return Image()

return self.bridge.cv2_to_imgmsg(self.depth_images[-1][1], encoding="passthrough")
return self.depth_images[-1][1]


if __name__ == '__main__':
Expand Down
5 changes: 4 additions & 1 deletion people_tracking/src/people_tracking/person_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def process_latest_image(self):
# Save Image
if save_data:
cv2.imwrite(f"{save_path}{batch_nr}.jpg", cv_image)
cv2.imwrite(f"{save_path}{batch_nr}_depth.jpg", cv_image)

# People detection
classes, segmentations, bounding_box_corners = self.detect(self.model, cv_image)
if classes is None or segmentations is None:
Expand All @@ -127,6 +127,9 @@ def process_latest_image(self):
depth_image = self.request_depth_image(self.latest_image_time)#self.request_depth_image(self.latest_image_time).image
cv_depth_image = self.bridge.imgmsg_to_cv2(depth_image, desired_encoding='passthrough')
cv_depth_image = cv2.GaussianBlur(cv_depth_image, (5, 5), 0)

if save_data:
cv2.imwrite(f"{save_path}{batch_nr}_depth.jpg", cv_depth_image)
else:
cv_depth_image = None

Expand Down

0 comments on commit 9f63c61

Please sign in to comment.