MCPcopy Create free account
hub / github.com/IRMVLab/SemGauss-SLAM / initialize_camera_pose

Function initialize_camera_pose

sem_gauss.py:409–428  ·  view source on GitHub ↗
(params, curr_time_idx, forward_prop)

Source from the content-addressed store, hash-verified

407 return params, variables
408
409def initialize_camera_pose(params, curr_time_idx, forward_prop):
410 with torch.no_grad():
411 if curr_time_idx > 1 and forward_prop:
412 # Initialize the camera pose for the current frame based on a constant velocity model
413 # Rotation
414 prev_rot1 = F.normalize(params['cam_unnorm_rots'][..., curr_time_idx-1].detach())
415 prev_rot2 = F.normalize(params['cam_unnorm_rots'][..., curr_time_idx-2].detach())
416 new_rot = F.normalize(prev_rot1 + (prev_rot1 - prev_rot2))
417 params['cam_unnorm_rots'][..., curr_time_idx] = new_rot.detach()
418 # Translation
419 prev_tran1 = params['cam_trans'][..., curr_time_idx-1].detach()
420 prev_tran2 = params['cam_trans'][..., curr_time_idx-2].detach()
421 new_tran = prev_tran1 + (prev_tran1 - prev_tran2)
422 params['cam_trans'][..., curr_time_idx] = new_tran.detach()
423 else:
424 # Initialize the camera pose for the current frame
425 params['cam_unnorm_rots'][..., curr_time_idx] = params['cam_unnorm_rots'][..., curr_time_idx-1].detach()
426 params['cam_trans'][..., curr_time_idx] = params['cam_trans'][..., curr_time_idx-1].detach()
427
428 return params
429
430def dense_semantic_slam(config: dict):
431 # Loading Config

Callers 1

dense_semantic_slamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected