当前位置: 首页>>代码示例>>Python>>正文


Python Image.landmarks['temp']方法代码示例

本文整理汇总了Python中menpo.image.Image.landmarks['temp']方法的典型用法代码示例。如果您正苦于以下问题:Python Image.landmarks['temp']方法的具体用法?Python Image.landmarks['temp']怎么用?Python Image.landmarks['temp']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在menpo.image.Image的用法示例。


在下文中一共展示了Image.landmarks['temp']方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_rotate_image_90_180

# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import landmarks['temp'] [as 别名]
def test_rotate_image_90_180():
    image = Image(np.array([[1., 2., 3., 4.],
                            [5., 6., 7., 8.],
                            [9., 10., 11., 12.]]))
    image.landmarks['temp'] = PointCloud(np.array([[1., 1.], [1., 2.],
                                                   [2., 1.], [2., 2.]]))
    # rotate 90 degrees
    rotated_img = image.rotate_ccw_about_centre(theta=90, order=0)
    rotated_img.landmarks['temp'] = rotated_img.landmarks['temp'].constrain_to_bounds(
        rotated_img.bounds())
    assert_allclose(rotated_img.pixels, np.array([[[4., 8., 12.],
                                                   [3., 7., 11.],
                                                   [2., 6., 10.],
                                                   [1., 5., 9.]]]))
    assert_almost_equal(rotated_img.landmarks['temp'].points,
                        np.array([[2., 1.], [1., 1.], [2., 2.], [1., 2.]]))

    # rotate 180 degrees
    rotated_img = image.rotate_ccw_about_centre(theta=180, order=0)
    rotated_img.landmarks['temp'] = rotated_img.landmarks['temp'].constrain_to_bounds(
        rotated_img.bounds())
    assert_allclose(rotated_img.pixels, np.array([[[12., 11., 10., 9.],
                                                   [8., 7., 6., 5.],
                                                   [4., 3., 2., 1.]]]))
    assert_almost_equal(rotated_img.landmarks['temp'].points,
                        np.array([[1., 2.], [1., 1.], [0., 2.], [0., 1.]]))
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:28,代码来源:image_warp_test.py

示例2: test_mirror_vertical_image

# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import landmarks['temp'] [as 别名]
def test_mirror_vertical_image():
    image = Image(np.array([[1., 2., 3., 4.],
                            [5., 6., 7., 8.],
                            [9., 10., 11., 12.]]))
    image.landmarks['temp'] = PointCloud(np.array([[1., 0.], [1., 1.],
                                                   [2., 1.], [2., 2.]]))
    mirrored_img = image.mirror()
    assert_allclose(mirrored_img.pixels,
                    np.array([[[4., 3., 2., 1.],
                               [8., 7., 6., 5.],
                               [12., 11., 10., 9.]]]))
    assert_allclose(mirrored_img.landmarks['temp'].points,
                    np.array([[1., 3.], [1., 2.], [2., 2.], [2., 1.]]))
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:15,代码来源:image_warp_test.py

示例3: test_mirror_horizontal_image

# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import landmarks['temp'] [as 别名]
def test_mirror_horizontal_image():
    image = Image(np.array([[1., 2., 3., 4.],
                            [5., 6., 7., 8.],
                            [9., 10., 11., 12.]]))
    image.landmarks['temp'] = PointCloud(np.array([[1., 1.], [1., 2.],
                                                   [2., 1.], [2., 2.]]))
    mirrored_img = image.mirror(axis=0)
    assert_allclose(mirrored_img.pixels,
                    np.array([[[9., 10., 11., 12.],
                               [5., 6., 7., 8.],
                               [1., 2., 3., 4.]]]))
    assert_allclose(mirrored_img.landmarks['temp'].points,
                    np.array([[1., 1.], [1., 2.], [0., 1.], [0., 2.]]))
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:15,代码来源:image_warp_test.py

示例4: test_rotate_image_45

# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import landmarks['temp'] [as 别名]
def test_rotate_image_45():
    image = Image(np.array([[1., 2., 3., 4.],
                            [5., 6., 7., 8.],
                            [9., 10., 11., 12.],
                            [13., 14., 15., 16.]]))
    image.landmarks['temp'] = PointCloud(np.array([[1., 1.], [1., 2.],
                                                   [2., 1.], [2., 2.]]))
    rotated_img = image.rotate_ccw_about_centre(theta=45, order=0)
    assert_allclose(rotated_img.pixels,
                    np.array([[[0., 0., 4., 0., 0.],
                               [0., 3., 7., 8., 0.],
                               [1., 6., 7., 11., 16.],
                               [0., 5., 10., 15., 15.],
                               [0., 0., 13., 14., 0.]]]))
    assert_almost_equal(rotated_img.landmarks['temp'].points,
                        np.array([[2.121, 1.414], [1.414, 2.121],
                                  [2.828, 2.121], [2.121, 2.828]]), decimal=3)
开发者ID:grigorisg9gr,项目名称:menpo,代码行数:19,代码来源:image_warp_test.py


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