MCPcopy Create free account
hub / github.com/SHAILAB-IPEC/OpenFly-Platform / get_camera_data

Method get_camera_data

scripts/sim/ue_bridge.py:118–132  ·  view source on GitHub ↗
(self, camera_type)

Source from the content-addressed store, hash-verified

116 time.sleep(2)
117
118 def get_camera_data(self, camera_type):
119 valid_types = {'lit', 'object_mask', 'depth'}
120 if camera_type not in valid_types:
121 raise ValueError(f"Invalid camera type. Expected one of {valid_types}, but got '{camera_type}'.")
122
123 if camera_type == 'lit':
124 data = self._client.request('vget /camera/1/lit png')
125 return cv2.imdecode(np.frombuffer(data, np.uint8), cv2.IMREAD_COLOR)
126 elif camera_type == 'object_mask':
127 data = self._client.request('vget /camera/1/object_mask png')
128 return cv2.imdecode(np.frombuffer(data, np.uint8), cv2.IMREAD_COLOR)
129 elif camera_type == 'depth':
130 data = self._client.request('vget /camera/1/depth npy')
131 depth_np = np.load(io.BytesIO(data))
132 return depth_np # Return depth data
133
134 def save_image(self, image_data, file_path):
135 cv2.imwrite(file_path, image_data)

Callers 1

process_camera_dataMethod · 0.95

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected