MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / list_cameras

Method list_cameras

embodiedscan/explorer.py:152–183  ·  view source on GitHub ↗

List all the camera frames in the scene. Args: scene (str): Scene name. Returns: list[str] or None: List of all the frame names. If there is no frames, we will return None.

(self, scene)

Source from the content-addressed store, hash-verified

150 return res
151
152 def list_cameras(self, scene):
153 """List all the camera frames in the scene.
154
155 Args:
156 scene (str): Scene name.
157
158 Returns:
159 list[str] or None: List of all the frame names. If there is no
160 frames, we will return None.
161 """
162 for sample in self.data:
163 if sample['sample_idx'] == scene:
164 res = []
165 dataset = sample['dataset']
166 for img in sample['images']:
167 img_path = img['img_path']
168 if dataset == 'scannet':
169 cam_name = img_path.split('/')[-1][:-4]
170 elif dataset == '3rscan':
171 cam_name = img_path.split('/')[-1][:-10]
172 elif dataset == 'matterport3d':
173 cam_name = img_path.split(
174 '/')[-1][:-8] + img_path.split('/')[-1][-7:-4]
175 elif dataset == 'arkitscenes':
176 cam_name = img_path.split('/')[-1][:-4]
177 else:
178 cam_name = img_path.split('/')[-1][:-4]
179 res.append(cam_name)
180 return res
181
182 print('No such scene')
183 return None
184
185 def list_instances(self, scene):
186 """List all the instance annotations in the scene.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected