Inputs: poses: (3, 4) x: translational perturb range angle: rotation angle perturb range in degrees Outputs: new_c2w: (N_views, 3, 4) new poses
(poses, x, angle)
| 483 | return new_c2w |
| 484 | |
| 485 | def perturb_single_render_pose_norm(poses, x, angle): |
| 486 | """ |
| 487 | Inputs: |
| 488 | poses: (3, 4) |
| 489 | x: translational perturb range |
| 490 | angle: rotation angle perturb range in degrees |
| 491 | Outputs: |
| 492 | new_c2w: (N_views, 3, 4) new poses |
| 493 | """ |
| 494 | c2w=poses |
| 495 | |
| 496 | N_views = 1 # number of views |
| 497 | new_c2w = np.zeros((N_views, 3, 4)) |
| 498 | |
| 499 | # perturb translational pose |
| 500 | for i in range(N_views): |
| 501 | new_c2w[i] = c2w |
| 502 | trans_rand = np.random.uniform(-x,x,3) # random number of 3 axis pose perturbation |
| 503 | |
| 504 | # normalize 3 axis perturbation to x, this will make sure sum of 3-axis perturbation to be x constant |
| 505 | trans_rand = trans_rand / abs(trans_rand).sum() * x |
| 506 | new_c2w[i,:,3] = new_c2w[i,:,3] + trans_rand # perturb pos between -1 to 1 |
| 507 | |
| 508 | # perturb rotation pose |
| 509 | theta=np.random.uniform(-angle,angle,1) # in degrees |
| 510 | phi=np.random.uniform(-angle,angle,1) # in degrees |
| 511 | psi=np.random.uniform(-angle,angle,1) # in degrees |
| 512 | |
| 513 | rot_rand = np.array([theta, phi, psi]) |
| 514 | rot_rand = rot_rand / abs(rot_rand).sum() * angle |
| 515 | theta, phi, psi = rot_rand |
| 516 | |
| 517 | # normalize 3 axis perturbation to x, this will make sure sum of 3-axis perturbation to be x constant |
| 518 | new_c2w[i] = perturb_rotation(new_c2w[i], theta, phi, psi) |
| 519 | return new_c2w |
nothing calls this directly
no test coverage detected