Skip to content

Commit

Permalink
easyvolcap: tuning intrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
dendenxu committed Apr 5, 2024
1 parent d52110c commit e522b47
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions easyvolcap/models/cameras/optimizable_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def forward_srcs(self, batch: dotdict):

intri_resd = self.intri_resd[f_inds, v_inds].to(batch.src_ixts) # B, S, 4
src_ixts = torch.zeros_like(batch.src_ixts)
src_ixts[..., 0, 0] = intri_resd[..., 0, 0].clip(self.focal_limit) + batch.src_ixts[..., 0, 0] # fx
src_ixts[..., 1, 1] = intri_resd[..., 1, 1].clip(self.focal_limit) + batch.src_ixts[..., 1, 1] # fy
src_ixts[..., 0, 2] = intri_resd[..., 0, 2].clip(self.shift_limit) + batch.src_ixts[..., 0, 2] # cx
src_ixts[..., 1, 2] = intri_resd[..., 1, 2].clip(self.shift_limit) + batch.src_ixts[..., 1, 2] # cy
src_ixts[..., 0, 0] = intri_resd[..., 0, 0].sign() * intri_resd[..., 0, 0].abs().clip(self.focal_limit) + batch.src_ixts[..., 0, 0] # fx
src_ixts[..., 1, 1] = intri_resd[..., 1, 1].sign() * intri_resd[..., 1, 1].abs().clip(self.focal_limit) + batch.src_ixts[..., 1, 1] # fy
src_ixts[..., 0, 2] = intri_resd[..., 0, 2].sign() * intri_resd[..., 0, 2].abs().clip(self.shift_limit) + batch.src_ixts[..., 0, 2] # cx
src_ixts[..., 1, 2] = intri_resd[..., 1, 2].sign() * intri_resd[..., 1, 2].abs().clip(self.shift_limit) + batch.src_ixts[..., 1, 2] # cy
src_ixts[..., 2, 2] = 1.0
return batch

Expand Down Expand Up @@ -169,10 +169,10 @@ def forward_pose(self, batch: dotdict):
intri_resd = self.intri_resd[latent_index, view_index].to(batch.R) # fancy indexing? -> B, 4
int_ori = batch.K
int_opt = torch.zeros_like(int_ori)
int_opt[..., 0, 0] = intri_resd[..., 0].clip(self.focal_limit) + int_ori[..., 0, 0] # fx
int_opt[..., 1, 1] = intri_resd[..., 1].clip(self.focal_limit) + int_ori[..., 1, 1] # fy
int_opt[..., 0, 2] = intri_resd[..., 2].clip(self.shift_limit) + int_ori[..., 0, 2] # cx
int_opt[..., 1, 2] = intri_resd[..., 3].clip(self.shift_limit) + int_ori[..., 1, 2] # cy
int_opt[..., 0, 0] = intri_resd[..., 0].sign() * intri_resd[..., 0].abs().clip(self.focal_limit) + int_ori[..., 0, 0] # fx
int_opt[..., 1, 1] = intri_resd[..., 1].sign() * intri_resd[..., 1].abs().clip(self.focal_limit) + int_ori[..., 1, 1] # fy
int_opt[..., 0, 2] = intri_resd[..., 2].sign() * intri_resd[..., 2].abs().clip(self.shift_limit) + int_ori[..., 0, 2] # cx
int_opt[..., 1, 2] = intri_resd[..., 3].sign() * intri_resd[..., 3].abs().clip(self.shift_limit) + int_ori[..., 1, 2] # cy
int_opt[..., 2, 2] = 1.0
int_resd = int_opt - int_ori

Expand Down

0 comments on commit e522b47

Please sign in to comment.