MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / get_kinect_depth

Method get_kinect_depth

detrsmpl/data/data_structures/smc_reader.py:383–415  ·  view source on GitHub ↗

Get several frames captured by a kinect depth camera. Args: kinect_id (int): ID of a kinect, starts from 0. frame_id (int, list or None, optional): int: frame id of one selected frame list: a list of frame id

(self, kinect_id, frame_id=None, disable_tqdm=True)

Source from the content-addressed store, hash-verified

381 print('Model {} is not supported...'.format(mode))
382
383 def get_kinect_depth(self, kinect_id, frame_id=None, disable_tqdm=True):
384 """Get several frames captured by a kinect depth camera.
385
386 Args:
387 kinect_id (int):
388 ID of a kinect, starts from 0.
389 frame_id (int, list or None, optional):
390 int: frame id of one selected frame
391 list: a list of frame id
392 None: all frames will be returned
393 Defaults to None.
394 disable_tqdm (bool, optional):
395 Whether to disable the entire progressbar wrapper.
396 Defaults to True.
397
398 Returns:
399 ndarray:
400 An ndarray in shape [frame_number, height, width, channels].
401 """
402 frames = []
403 frame_list = []
404 if frame_id is None or type(frame_id) == list:
405 frame_list = range(self.get_kinect_num_frames())
406 if frame_id:
407 frame_list = frame_id
408 else:
409 assert frame_id < self.get_kinect_num_frames(),\
410 'Index out of range...'
411 frame_list.append(frame_id)
412 for i in tqdm.tqdm(frame_list, disable=disable_tqdm):
413 frames.append(
414 self.smc['Kinect'][str(kinect_id)]['Depth'][str(i)][()])
415 return np.stack(frames, axis=0)
416
417 def __read_color_from_bytes__(self, color_array):
418 """Decode an RGB image from an encoded byte array."""

Callers 2

get_kinect_rgbdMethod · 0.95

Calls 1

get_kinect_num_framesMethod · 0.95

Tested by

no test coverage detected