本文整理汇总了Python中texture.Texture.create_from_source_transfer_target方法的典型用法代码示例。如果您正苦于以下问题:Python Texture.create_from_source_transfer_target方法的具体用法?Python Texture.create_from_source_transfer_target怎么用?Python Texture.create_from_source_transfer_target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类texture.Texture
的用法示例。
在下文中一共展示了Texture.create_from_source_transfer_target方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: texture_transfer
# 需要导入模块: from texture import Texture [as 别名]
# 或者: from texture.Texture import create_from_source_transfer_target [as 别名]
def texture_transfer(args):
print "Texture Transfer Starting..."
source_texture = Texture()
source_texture.load_texture(args.source_texture)
target_image = Texture()
target_image.load_texture(args.target_image)
source_corr_texture = Texture()
target_corr_texture = Texture()
if args.corr_map_type == 0:
source_corr_texture.load_texture(args.source_texture, gray=True)
target_corr_texture.load_texture(args.target_image, gray=True)
elif args.corr_map_type == 1:
source_corr_texture.load_texture(args.source_texture,
gray=True, blur=True)
target_corr_texture.load_texture(args.target_image,
gray=True, blur=True)
patch_width = args.patch_width
patch_height = args.patch_height
new_t_height, new_t_width, dim = target_image.pixels.shape
texture = Texture()
texture.init_empty_texture(new_t_height, new_t_width, dim)
for step in range(args.iterations):
if args.iterations == 1:
alpha = .1
else:
alpha = .8 * step / (args.iterations-1) + .1
patches, source_patch_cmap = \
source_texture.create_patches(patch_height,
patch_width,
overlap=args.overlap_percent,
cmap=source_corr_texture)
texture = \
Texture.create_from_source_transfer_target(patches,
source_patch_cmap,
target_corr_texture,
texture,
alpha)
patch_width = int(patch_width * (1-args.patch_len_reduction))
patch_height = int(patch_height * (1-args.patch_len_reduction))
if patch_width == 0 or patch_height == 0:
print "patch width or height reduced to 0, stopping iterations"
break
texture.save_texture(args.output_file)
return