MCPcopy Create free account
hub / github.com/SceneFun3D/scenefun3d / get_depth_frames

Method get_depth_frames

utils/data_parser.py:299–335  ·  view source on GitHub ↗

Retrieve the paths to the depth frames for a given scene and video sequence. Args: visit_id (str): The identifier of the scene. video_id (str): The identifier of the video sequence. data_asset_identifier (str, optional): The data asset type for t

(self, visit_id, video_id, data_asset_identifier="hires_depth")

Source from the content-addressed store, hash-verified

297 return frame_mapping
298
299 def get_depth_frames(self, visit_id, video_id, data_asset_identifier="hires_depth"):
300 """
301 Retrieve the paths to the depth frames for a given scene and video sequence.
302
303 Args:
304 visit_id (str): The identifier of the scene.
305 video_id (str): The identifier of the video sequence.
306 data_asset_identifier (str, optional): The data asset type for the depth frames.
307 Can be either "hires_depth" or "lowres_depth".
308 Defaults to "hires_depth".
309
310 Returns:
311 (dict): A dictionary mapping frame timestamps to their corresponding file paths.
312
313 Raises:
314 ValueError: If an unsupported data asset identifier is provided.
315 FileNotFoundError: If no depth frames are found at the specified path.
316 """
317 frame_mapping = {}
318 if data_asset_identifier == "hires_depth":
319 depth_frames_path = self.get_data_asset_path(data_asset_identifier="hires_depth", visit_id=visit_id, video_id=video_id)
320
321 elif data_asset_identifier == "lowres_depth":
322 depth_frames_path = self.get_data_asset_path(data_asset_identifier="lowres_depth", visit_id=visit_id, video_id=video_id)
323
324 else:
325 raise ValueError(f"Unknown data_asset_identifier {data_asset_identifier} for depth frames")
326
327 frames = sorted(glob.glob(os.path.join(depth_frames_path, "*.png")))
328 if not frames:
329 raise FileNotFoundError(f"No depth frames found in {depth_frames_path}")
330 frame_timestamps = [os.path.basename(x).split(".png")[0].split("_")[1] for x in frames]
331
332 # Create mapping from timestamp to full path
333 frame_mapping = {timestamp: frame for timestamp, frame in zip(frame_timestamps, frames)}
334
335 return frame_mapping
336
337 def get_camera_intrinsics(self, visit_id, video_id, data_asset_identifier="hires_wide_intrinsics"):
338 """

Callers 2

export_sceneFunction · 0.95
mainFunction · 0.95

Calls 1

get_data_asset_pathMethod · 0.95

Tested by

no test coverage detected