From 0e797a62c0640d248a73895b3a20eacd33963451 Mon Sep 17 00:00:00 2001 From: Ishaan Datta Date: Thu, 14 Nov 2024 10:03:50 -0800 Subject: [PATCH] int types --- .../python_workspace/zed_camera_node.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/workspace_python/ros2_ws/src/python_workspace/python_workspace/zed_camera_node.py b/workspace_python/ros2_ws/src/python_workspace/python_workspace/zed_camera_node.py index e980c3f..1af61b0 100644 --- a/workspace_python/ros2_ws/src/python_workspace/python_workspace/zed_camera_node.py +++ b/workspace_python/ros2_ws/src/python_workspace/python_workspace/zed_camera_node.py @@ -19,7 +19,7 @@ def __init__(self): self.declare_parameter('camera_side', 'left') self.declare_parameter('shift_constant', 0) - self.declare_parameter('roi_dimensions', [0, 0, 100, 100]) + self.declare_parameter('roi_dimensions', (0, 0, 100, 100)) self.camera_side = self.get_parameter('camera_side').get_parameter_value().string_value self.shift_constant = self.get_parameter('shift_constant').get_parameter_value().integer_value @@ -94,12 +94,10 @@ def publish_zed_frames(self): def preprocess_image(self, image): tic = time.perf_counter_ns() roi_x1, roi_y1, roi_x2, roi_y2 = self.roi_dimensions - shifted_x1 = roi_x1 + abs(self.velocity[0]) * self.shift_constant - shifted_x2 = roi_x2 + abs(self.velocity[0]) * self.shift_constant + shifted_x1 = int(roi_x1 + abs(self.velocity[0]) * self.shift_constant) + shifted_x2 = int(roi_x2 + abs(self.velocity[0]) * self.shift_constant) - # replace with util... - - preprocessed_img = image[roi_y1:roi_y2, shifted_x1:shifted_x2, :3] + preprocessed_img = image[int(roi_y1):int(roi_y2), shifted_x1:shifted_x2, :3] # replace w/ util preprocessed_img = cv2.resize(preprocessed_img, self.model_dimensions) # check if necessary? preprocessed_img_msg = self.bridge.cv2_to_imgmsg(preprocessed_img, encoding='rgb8')