Skip to content

Commit

Permalink
depth image 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 5f9e6f3 commit 1014c3e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion people_tracking/src/people_tracking/person_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def process_latest_image(self):
depth_image = 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)
else:
cv_depth_image = None

detected_persons = []
depth_detected = []
Expand All @@ -146,7 +148,7 @@ def process_latest_image(self):
cropped_image = cv_image[y1:y2, x1:x2]
image_message = self.bridge.cv2_to_imgmsg(cropped_image, encoding="passthrough")

if depth_camera:
if depth_camera and cv_depth_image is not None:
mask_depth = np.zeros_like(cv_depth_image, dtype=np.uint8)
cv2.fillPoly(mask_depth, [seg], (255, 255, 255))

Expand Down

0 comments on commit 1014c3e

Please sign in to comment.