本文整理汇总了Python中menpo.image.Image.blank方法的典型用法代码示例。如果您正苦于以下问题:Python Image.blank方法的具体用法?Python Image.blank怎么用?Python Image.blank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menpo.image.Image
的用法示例。
在下文中一共展示了Image.blank方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_warp_to_mask_image
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_warp_to_mask_image():
img = Image.blank((10, 10), n_channels=2)
img.pixels[:, :5, :] = 0.5
template_mask = BooleanImage.blank((10, 10))
template_mask.pixels[5:, :] = False
t = Affine.identity(2)
warped_img = img.warp_to_mask(template_mask, t)
assert(type(warped_img) == MaskedImage)
result = Image.blank((10, 10), n_channels=2).pixels
result[:5, :5, :] = 0.5
assert(np.all(result == warped_img.pixels))
示例2: test_warp_to_mask_masked_image
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_warp_to_mask_masked_image():
mask = BooleanImage.blank((10, 10))
# make a funny mask on the original image
mask.pixels[2:, :] = False
img = MaskedImage.blank((10, 10), n_channels=2, mask=mask)
img.pixels[...] = 2.5
template_mask = BooleanImage.blank((10, 10), fill=False)
template_mask.pixels[:5, :5] = True
t = Affine.identity(2)
warped_img = img.warp_to_mask(template_mask, t)
assert(type(warped_img) == MaskedImage)
result = Image.blank((10, 10), n_channels=2).pixels
result[:5, :5, :] = 2.5
result_mask = BooleanImage.blank((10, 10), fill=False).pixels
result_mask[:2, :5] = True
assert(warped_img.n_true_pixels() == 10)
assert(np.all(result == warped_img.pixels))
assert(np.all(result_mask == warped_img.mask.pixels))
示例3: test_rescale_to_diagonal
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_rescale_to_diagonal():
image = Image.blank((8, 6), n_channels=2)
assert image.diagonal == 10
rescaled = image.rescale_to_diagonal(5)
assert rescaled.shape == (4, 3)
assert rescaled.n_channels == 2
示例4: test_diagonal_kchannel_ndim
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_diagonal_kchannel_ndim():
image = Image.blank((100, 250, 50), n_channels=5)
assert image.diagonal == (100 ** 2 + 250 ** 2 + 50 ** 2) ** 0.5
示例5: test_diagonal_color
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_diagonal_color():
image = Image.blank((100, 250), n_channels=3)
assert image.diagonal == (100 ** 2 + 250 ** 2) ** 0.5
示例6: test_diagonal_greyscale
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_diagonal_greyscale():
image = Image.blank((100, 250), n_channels=1)
assert image.diagonal == (100 ** 2 + 250 ** 2) ** 0.5
示例7: test_image_blank_n_channels
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_image_blank_n_channels():
image = Image(np.zeros((6, 4, 7)))
image_blank = Image.blank((6, 4), n_channels=7)
assert(np.all(image_blank.pixels == image.pixels))
示例8: test_image_blank_fill
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_image_blank_fill():
image = Image(np.ones((6, 4, 1)) * 7)
image_blank = Image.blank((6, 4), fill=7)
assert(np.all(image_blank.pixels == image.pixels))
示例9: test_image_blank
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def test_image_blank():
image = Image(np.zeros((6, 4, 1)))
image_blank = Image.blank((6, 4))
assert(np.all(image_blank.pixels == image.pixels))
示例10: trimesh_viewer_test
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
from collections import OrderedDict
import numpy as np
from nose.tools import raises
from nose.plugins.attrib import attr
from menpo.image import Image
from menpo.landmark import LandmarkGroup
from menpo.shape import TriMesh, TexturedTriMesh, ColouredTriMesh, PointCloud
fake_triangle = np.array([[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0]])
fake_trilist = np.array([[0, 1, 2]], dtype=np.uint32)
fake_texture = Image.blank([10, 10])
fake_tcoords = np.array([[0, 0], [0.5, 0.5], [1.0, 1.0]])
@raises(ImportError)
@attr('viewing')
def trimesh_viewer_test():
TriMesh(fake_triangle, trilist=fake_trilist, copy=False).view()
@raises(ImportError)
@attr('viewing')
def textured_trimesh_viewer_test():
TexturedTriMesh(fake_triangle, fake_tcoords, fake_texture,
trilist=fake_trilist, copy=False).view()
@raises(ImportError)
示例11: _set_up
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import blank [as 别名]
def _set_up(self):
# work out feature length per patch
patch_img = Image.blank(self.patch_shape, fill=0)
self._feature_patch_length = compute_features(
patch_img, self.regression_features).n_parameters