Muhammad Taqi Raza commited on
Commit
2ecb7ee
·
1 Parent(s): b5a313b

adding camera offsets values

Browse files
Files changed (1) hide show
  1. inference/v2v_data/demo.py +37 -1
inference/v2v_data/demo.py CHANGED
@@ -606,7 +606,43 @@ class GetAnchorVideos:
606
  ]
607
  ).to(opts.device).unsqueeze(0)
608
  )
609
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  # c2ws[:, 2, 3] -= r
611
  # if x is not None:
612
  # c2ws[:, 1, 3] += y
 
606
  ]
607
  ).to(opts.device).unsqueeze(0)
608
  )
609
+
610
+ theta = torch.deg2rad(torch.tensor(0)).to(opts.device)
611
+ sin_value_x = torch.sin(theta)
612
+ cos_value_x = torch.cos(theta)
613
+ rot_mat_x = (
614
+ torch.tensor(
615
+ [
616
+ [1, 0, 0, 0],
617
+ [0, cos_value_x, -sin_value_x, 0],
618
+ [0, sin_value_x, cos_value_x, 0],
619
+ [0, 0, 0, 1],
620
+ ]
621
+ )
622
+ .unsqueeze(0)
623
+ .repeat(c2ws.shape[0], 1, 1)
624
+ .to(opts.device)
625
+ )
626
+
627
+ phi = torch.deg2rad(torch.tensor(0)).to(opts.device)
628
+ sin_value_y = torch.sin(phi)
629
+ cos_value_y = torch.cos(phi)
630
+ rot_mat_y = (
631
+ torch.tensor(
632
+ [
633
+ [cos_value_y, 0, sin_value_y, 0],
634
+ [0, 1, 0, 0],
635
+ [-sin_value_y, 0, cos_value_y, 0],
636
+ [0, 0, 0, 1],
637
+ ]
638
+ )
639
+ .unsqueeze(0)
640
+ .repeat(c2ws.shape[0], 1, 1)
641
+ .to(opts.device)
642
+ )
643
+
644
+ c2ws = torch.matmul(rot_mat_x, c2ws)
645
+ c2w_init = torch.matmul(rot_mat_y, c2ws)
646
  # c2ws[:, 2, 3] -= r
647
  # if x is not None:
648
  # c2ws[:, 1, 3] += y