コード例 #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)
コード例 #2
0
ファイル: model.py プロジェクト: jtaylor/pysfm
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)
コード例 #3
0
ファイル: tests.py プロジェクト: gurpreetshanky/pysfm
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)