本文整理汇总了Python中menpo.image.Image.from_vector_inplace方法的典型用法代码示例。如果您正苦于以下问题:Python Image.from_vector_inplace方法的具体用法?Python Image.from_vector_inplace怎么用?Python Image.from_vector_inplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menpo.image.Image
的用法示例。
在下文中一共展示了Image.from_vector_inplace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_image_from_vector_inplace_no_copy_warning
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import from_vector_inplace [as 别名]
def test_image_from_vector_inplace_no_copy_warning():
pixels = np.random.rand(10, 20, 2)
pixels2 = np.random.rand(10, 20, 2)
image = Image(pixels)
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
image.from_vector_inplace(pixels2.ravel()[::-1], copy=False)
assert len(w) == 1
示例2: test_image_from_vector_inplace_copy_explicit
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import from_vector_inplace [as 别名]
def test_image_from_vector_inplace_copy_explicit():
pixels = np.random.rand(10, 20, 2)
pixels2 = np.random.rand(10, 20, 2)
image = Image(pixels)
image.from_vector_inplace(pixels2.ravel(), copy=True)
assert(not is_same_array(image.pixels, pixels2))
示例3: test_image_from_vector_inplace_no_copy
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import from_vector_inplace [as 别名]
def test_image_from_vector_inplace_no_copy():
pixels = np.random.rand(10, 20, 2)
pixels2 = np.random.rand(10, 20, 2)
image = Image(pixels)
image.from_vector_inplace(pixels2.ravel(), copy=False)
assert(is_same_array(image.pixels, pixels2))
示例4: test_image_from_vector_inplace_copy_default
# 需要导入模块: from menpo.image import Image [as 别名]
# 或者: from menpo.image.Image import from_vector_inplace [as 别名]
def test_image_from_vector_inplace_copy_default():
pixels = np.random.rand(2, 10, 20)
pixels2 = np.random.rand(2, 10, 20)
image = Image(pixels)
image.from_vector_inplace(pixels2.ravel())
assert(not is_same_array(image.pixels, pixels2))