MCPcopy Create free account
hub / github.com/DNA-Rendering/DNA-Rendering / get_Keypoints2d

Method get_Keypoints2d

scripts/3DGS/SMCReader.py:285–319  ·  view source on GitHub ↗

Get keypoint2D by its Camera_group, Camera_id and Frame_id Args: Camera_id (int/str of a number): CameraID (str) in {'Camera_5mp': '0'~'47', 'Camera_12mp':'48'~'60',} Frame_id a.(int/str of a number): '0' ~ '

(self, Camera_id, Frame_id=None)

Source from the content-addressed store, hash-verified

283
284 ###Keypoints2d
285 def get_Keypoints2d(self, Camera_id, Frame_id=None):
286 """Get keypoint2D by its Camera_group, Camera_id and Frame_id
287
288 Args:
289 Camera_id (int/str of a number):
290 CameraID (str) in
291 {'Camera_5mp': '0'~'47',
292 'Camera_12mp':'48'~'60',}
293 Frame_id a.(int/str of a number): '0' ~ 'num_frame-1'('149')
294 b.list of numbers (int/str)
295 c.None: get batch of all imgs in order of time sequence
296 Returns:
297 a single img :
298 'color': HWC in bgr (uint8)
299 'mask' : HW (uint8)
300 'depth': HW (uint16)
301 """
302 if not 'Keypoints_2D' in self.smc:
303 print("=== no key: Keypoints_2D.\nplease check available keys!")
304 return None
305
306 Camera_id = f'{int(Camera_id):02d}'
307 assert(isinstance(Frame_id,(list,int, str, type(None))))
308 if isinstance(Frame_id, (str,int)):
309 Frame_id = int(Frame_id)
310 return self.smc['Keypoints_2D'][Camera_id][()][Frame_id,:]
311 else:
312 if Frame_id is None:
313 return self.smc['Keypoints_2D'][Camera_id][()]
314 elif isinstance(Frame_id, list):
315 Frame_id_list = Frame_id
316 rs = []
317 for fi in tqdm.tqdm(Frame_id_list):
318 rs.append(self.get_Keypoints2d(Camera_id,fi))
319 return np.stack(rs,axis=0)
320
321 ###Keypoints3d
322 def get_Keypoints3d(self, Frame_id=None):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected