MCPcopy Create free account
hub / github.com/ActiveVisionLab/DFNet / perturb_single_render_pose

Function perturb_single_render_pose

script/feature/misc.py:448–483  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

446 return c2w
447
448def perturb_single_render_pose(poses, x, angle):
449 """
450 Inputs:
451 poses: (3, 4)
452 x: translational perturb range
453 angle: rotation angle perturb range in degrees
454 Outputs:
455 new_c2w: (N_views, 3, 4) new poses
456 """
457 c2w=poses
458
459 N_views = 1 # number of views
460 new_c2w = np.zeros((N_views, 3, 4))
461
462 for i in range(N_views):
463 new_c2w[i] = c2w
464 loc = deepcopy(new_c2w[i,:,3]) # this is a must
465 # print("new_c2w[i,:,3]", new_c2w[i,:,3])
466
467 # perturb rotation pose
468 rot_rand=np.random.uniform(-angle,angle,3) # in degrees
469 theta, phi, psi = rot_rand
470
471 new_c2w[i] = perturb_rotation(new_c2w[i], theta, phi, psi)
472 # print("rot new_c2w[i,:,3]", new_c2w[i,:,3])
473
474 # perturb translational pose
475 trans_rand = np.random.uniform(-x,x,3) # random number of 3 axis pose perturbation
476 # print("trans_rand", trans_rand)
477
478 # # normalize 3 axis perturbation to x, this will make sure sum of 3-axis perturbation to be x constant
479 # trans_rand = trans_rand / abs(trans_rand).sum() * x
480 new_c2w[i,:,3] = loc + trans_rand # perturb pos between -1 to 1
481 # print("new new_c2w[i,:,3]", new_c2w[i,:,3])
482
483 return new_c2w
484
485def perturb_single_render_pose_norm(poses, x, angle):
486 """

Callers 1

train_featureFunction · 0.85

Calls 1

perturb_rotationFunction · 0.70

Tested by

no test coverage detected