Example #1
0
def generate_synthetic_model(n_frames, n_basis, n_points):

    Bs = np.random.randn(n_basis, 3, n_points) * 10
    R = rotvecs_to_Rs(np.random.randn(n_frames, 3))
    C = np.random.randn(n_frames, n_basis)

    return BasisShapeModel(R, Bs, C=C)
Example #2
0
def generate_synthetic_model(n_frames, n_basis, n_points):

    Bs = np.random.randn(n_basis, 3, n_points) * 10
    R = rotvecs_to_Rs(np.random.randn(n_frames, 3))
    C = np.random.randn(n_frames, n_basis)

    return BasisShapeModel(R, Bs, C=C)
Example #3
0
def test_rot_code():

    # It would be very unlikely for any of
    F = 10
    np.random.seed(0)

    # Create a bunch of random rotation vectors.
    omega = np.random.randn(F, 3) * 5

    # Make sure one has zero norm.
    omega[3, :] = 0.0

    # Use the sfm implemenation which relies on Rodriguez' formula.
    Rs_hat = util.rotvecs_to_Rs(omega)

    # Calculate it the slow way using the matrix exponential.
    omega_hats = util.hat_operator(omega)
    Rs_gt = np.asarray([expm(omega_hat) for omega_hat in omega_hats])

    npt.assert_allclose(Rs_hat, Rs_gt)