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

Method get_camera_data

train/eval.py:241–255  ·  view source on GitHub ↗
(self, camera_type = 'lit')

Source from the content-addressed store, hash-verified

239 time.sleep(2)
240
241 def get_camera_data(self, camera_type = 'lit'):
242 valid_types = {'lit', 'object_mask', 'depth'}
243 if camera_type not in valid_types:
244 raise ValueError(f"Invalid camera type. Expected one of {valid_types}, but got '{camera_type}'.")
245
246 if camera_type == 'lit':
247 data = self._client.request('vget /camera/1/lit png')
248 return cv2.imdecode(np.frombuffer(data, np.uint8), cv2.IMREAD_COLOR)
249 elif camera_type == 'object_mask':
250 data = self._client.request('vget /camera/1/object_mask png')
251 return cv2.imdecode(np.frombuffer(data, np.uint8), cv2.IMREAD_COLOR)
252 elif camera_type == 'depth':
253 data = self._client.request('vget /camera/1/depth npy')
254 depth_np = np.load(io.BytesIO(data))
255 return depth_np # Return depth data
256
257 def save_image(self, image_data, file_path):
258 cv2.imwrite(file_path, image_data)

Callers 2

process_camera_dataMethod · 0.95
mainFunction · 0.45

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected