• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python transform.Rotation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中menpo.transform.Rotation的典型用法代码示例。如果您正苦于以下问题:Python Rotation类的具体用法?Python Rotation怎么用?Python Rotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Rotation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_basic_2d_rotation_axis_angle

def test_basic_2d_rotation_axis_angle():
    rotation_matrix = np.array([[0, 1],
                                [-1, 0]])
    rotation = Rotation(rotation_matrix)
    axis, angle = rotation.axis_and_angle_of_rotation()
    assert_allclose(axis, np.array([0, 0, 1]))
    assert_allclose((90 * np.pi)/180, angle)
开发者ID:AshwinRajendraprasad,项目名称:menpo,代码行数:7,代码来源:test_homogeneous.py


示例2: test_rotation_compose_before_homog

def test_rotation_compose_before_homog():
    # can't do this inplace - so should just give transform chain
    rotation = Rotation(np.array([[1, 0],
                                  [0, 1]]))
    homog = Homogeneous(np.array([[0, 1, 0],
                                  [1, 0, 0],
                                  [0, 0, 1]]))
    res = rotation.compose_before(homog)
    assert(type(res) == Homogeneous)
开发者ID:AshwinRajendraprasad,项目名称:menpo,代码行数:9,代码来源:test_h_compose.py


示例3: test_align_2d_rotation

def test_align_2d_rotation():
    rotation_matrix = np.array([[0, 1], [-1, 0]])
    rotation = Rotation(rotation_matrix)
    source = PointCloud(np.array([[0, 1], [1, 1], [-1, -5], [3, -5]]))
    target = rotation.apply(source)
    # estimate the transform from source and target
    estimate = AlignmentRotation(source, target)
    # check the estimates is correct
    assert_allclose(rotation.h_matrix, estimate.h_matrix, atol=1e-14)
开发者ID:kritsong,项目名称:menpo,代码行数:9,代码来源:h_align_test.py


示例4: test_3d_rotation_as_vector

def test_3d_rotation_as_vector():
    a = np.sqrt(3.0) / 2.0
    b = 0.5
    # this is a rotation of -30 degrees about the x axis
    rotation_matrix = np.array([[1, 0, 0],
                                [0, a, b],
                                [0, -b, a]])
    rotation = Rotation(rotation_matrix)
    assert_allclose(np.round(rotation.as_vector()[2:]), np.array([0., 0.]))
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:9,代码来源:h_rotation_test.py


示例5: test_align_2d_rotation_set_h_matrix_raises_notimplemented_error

def test_align_2d_rotation_set_h_matrix_raises_notimplemented_error():
    rotation_matrix = np.array([[0, 1], [-1, 0]])
    rotation = Rotation(rotation_matrix)
    source = PointCloud(np.array([[0, 1], [1, 1], [-1, -5], [3, -5]]))
    target = rotation.apply(source)
    # estimate the transform from source and source
    estimate = AlignmentRotation(source, source)
    # and set the target
    estimate.set_h_matrix(rotation.h_matrix)
开发者ID:kritsong,项目名称:menpo,代码行数:9,代码来源:h_align_test.py


示例6: test_3d_rotation_inverse_eye

def test_3d_rotation_inverse_eye():
    a = np.sqrt(3.0)/2.0
    b = 0.5
    # this is a rotation of -30 degrees about the x axis
    rotation_matrix = np.array([[1, 0, 0],
                                [0, a, b],
                                [0, -b, a]])
    rotation = Rotation(rotation_matrix)
    transformed = rotation.compose_before(rotation.pseudoinverse())
    assert_allclose(np.eye(4), transformed.h_matrix, atol=1e-15)
开发者ID:AshwinRajendraprasad,项目名称:menpo,代码行数:10,代码来源:test_homogeneous.py


示例7: test_basic_3d_rotation

def test_basic_3d_rotation():
    a = np.sqrt(3.0)/2.0
    b = 0.5
    # this is a rotation of -30 degrees about the x axis
    rotation_matrix = np.array([[1, 0, 0],
                                [0, a, b],
                                [0, -b, a]])
    rotation = Rotation(rotation_matrix)
    starting_vector = np.array([0, 1, 0])
    transformed = rotation.apply(starting_vector)
    assert_allclose(np.array([0, a, -b]), transformed)
开发者ID:AshwinRajendraprasad,项目名称:menpo,代码行数:11,代码来源:test_homogeneous.py


示例8: test_basic_3d_rotation_axis_angle

def test_basic_3d_rotation_axis_angle():
    a = np.sqrt(3.0)/2.0
    b = 0.5
    # this is a rotation of -30 degrees about the x axis
    rotation_matrix = np.array([[1, 0, 0],
                                [0, a, b],
                                [0, -b, a]])
    rotation = Rotation(rotation_matrix)
    axis, angle = rotation.axis_and_angle_of_rotation()
    assert_allclose(axis, np.array([1, 0, 0]))
    assert_allclose((-30 * np.pi)/180, angle)
开发者ID:AshwinRajendraprasad,项目名称:menpo,代码行数:11,代码来源:test_homogeneous.py


示例9: test_transform_about_centre

def test_transform_about_centre():
    pixels_16 = np.arange(16, dtype=np.float)
    image = Image(pixels_16.reshape(4, 4))
    transform = Rotation.init_from_2d_ccw_angle(180).compose_before(
        UniformScale(2, n_dims=2))
    # rotate 90 + scale degrees
    transformed_img = image.transform_about_centre(transform, order=0)
    expected_pixels = np.rot90(np.repeat(np.repeat(pixels_16, 2).reshape(4, -1),
                                         2, axis=0)[1:, 1:],
                               k=2)

    assert transformed_img.shape == (7, 7)
    assert_allclose(transformed_img.pixels[0], expected_pixels)
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:13,代码来源:image_warp_test.py


示例10: fit_from_camera

    def fit_from_camera(self, image, camera, instance=None, gt_mesh=None,
                        max_iters=50, camera_update=False,
                        focal_length_update=False, shape_prior_weight=1.,
                        texture_prior_weight=1., return_costs=False):
        # Execute multi-scale fitting
        algorithm_results = self._fit(
            image, camera, instance=instance, gt_mesh=gt_mesh,
            max_iters=max_iters, camera_update=camera_update,
            focal_length_update=focal_length_update,
            reconstruction_weight=1.,
            shape_prior_weight=shape_prior_weight,
            texture_prior_weight=texture_prior_weight,
            landmarks_prior_weight=None, landmarks=None,
            return_costs=return_costs)

        # Return multi-scale fitting result
        return self._fitter_result(
            image=image, algorithm_results=algorithm_results,
            affine_transform=Rotation.init_identity(n_dims=2),
            gt_mesh=gt_mesh)
开发者ID:HaoyangWang,项目名称:menpo3d,代码行数:20,代码来源:fitter.py


示例11: test_init_3d_from_quaternion

def test_init_3d_from_quaternion():
    q = np.array([1., 0., 0.27, 0.])
    r = Rotation.init_3d_from_quaternion(q)
    axis, angle = r.axis_and_angle_of_rotation()
    assert_allclose(r.axis_and_angle_of_rotation()[0], np.array([0., 1., 0.]))
    assert np.round(angle * 180 / np.pi) == 30.
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:6,代码来源:h_rotation_test.py


示例12: test_3d_rotation_n_parameters

def test_3d_rotation_n_parameters():
    assert Rotation.init_identity(3).n_parameters == 4
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:2,代码来源:h_rotation_test.py


示例13: test_rotation2d_identity

def test_rotation2d_identity():
    assert_allclose(Rotation.init_identity(2).h_matrix, np.eye(3))
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:2,代码来源:h_rotation_test.py


示例14: test_basic_2d_rotation

def test_basic_2d_rotation():
    rotation_matrix = np.array([[0, 1],
                                [-1, 0]])
    rotation = Rotation(rotation_matrix)
    assert_allclose(np.array([0, -1]), rotation.apply(np.array([1, 0])))
开发者ID:AshwinRajendraprasad,项目名称:menpo,代码行数:5,代码来源:test_homogeneous.py


示例15: test_rotation2d_as_vector_raises_notimplementederror

def test_rotation2d_as_vector_raises_notimplementederror():
    with raises(NotImplementedError):
        Rotation.init_identity(2).as_vector()
开发者ID:AshwinRajendraprasad,项目名称:menpo,代码行数:3,代码来源:test_homogeneous.py


示例16: test_rotation_set_h_matrix_raises_notimplementederror

def test_rotation_set_h_matrix_raises_notimplementederror():
    r = Rotation(np.array([[1, 0], [0, 1]]))
    r.set_h_matrix(r.h_matrix)
开发者ID:dubzzz,项目名称:menpo,代码行数:3,代码来源:homogeneous_test.py


示例17: test_rotation3d_as_vector_raises_notimplementederror

def test_rotation3d_as_vector_raises_notimplementederror():
    Rotation.identity(3).as_vector()
开发者ID:dubzzz,项目名称:menpo,代码行数:2,代码来源:homogeneous_test.py


示例18: init_from_image_shape_and_vector

 def init_from_image_shape_and_vector(cls, image_shape, vector):
     r = Rotation.init_identity(n_dims=3)
     t = Translation.init_identity(n_dims=3)
     p = PerspectiveProjection(focal_length=1, image_shape=image_shape)
     return cls(r, t, p).from_vector(vector)
开发者ID:patricksnape,项目名称:menpo3d,代码行数:5,代码来源:camera.py


示例19: test_rotation2d_from_vector_raises_notimplementederror

def test_rotation2d_from_vector_raises_notimplementederror():
    Rotation.init_identity(2).from_vector(0)
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:2,代码来源:homogeneous_test.py


示例20: test_rotation3d_identity

def test_rotation3d_identity():
    assert_allclose(Rotation.identity(3).h_matrix, np.eye(4))
开发者ID:Amos-zq,项目名称:menpo,代码行数:2,代码来源:h_rotation_test.py



注:本文中的menpo.transform.Rotation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python transform.Scale类代码示例发布时间:2022-05-27
下一篇:
Python transform.NonUniformScale类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap