ImageRestyle

ImageRestyle[image,sample]

attempts to restyle image so as to follow the graphical style of sample.

ImageRestyle[image,wsample]

uses restyle weighting w.

ImageRestyle[image,{sample1,}]

attempts to restyle image using a blend of the graphical styles of the samplei.

ImageRestyle[image,{w1sample1,}]

uses weightings wi for the samplei.

Details and Options

  • ImageRestyle is also known as style transfer and is typically used to restyle an image using a reference style.
  • The restyle weights w must be numbers between 0 and 1. Larger weights imply larger modifications to the appearance of image.
  • The following options are supported:
  • PerformanceGoal "Speed"what aspect of performance to optimize
    PreserveColor Falsewhether to preserve colors of the original image
    RandomSeeding 1234seeding of the pseudorandom generator
    TargetDevice "CPU"the target device on which to compute
  • Possible settings for PerformanceGoal include:
  • "Quality"maximize restyling quality
    "Speed"maximize restyling speed
  • PerformanceGoal->"Speed" uses a feedforward stylization method, while PerformanceGoal->"Quality" selects an optimization-based method.
  • ImageRestyle uses machine learning. Its methods, training sets and biases included therein may change and yield varied results in different versions of the Wolfram Language.
  • ImageRestyle may download resources that will be stored in your local object store at $LocalBase, and can be listed using LocalObjects[] and removed using ResourceRemove.

Examples

open allclose all

Basic Examples  (2)

Restyle an image:

Lower the emphasis on the style:

Scope  (3)

Specify the restyle weighting:

Blend the styles of two samples:

Specify the weightings for each sample:

Options  (4)

PerformanceGoal  (1)

The default setting, "Speed", uses a feedforward stylization method:

The setting "Quality" uses a slower, optimization-based method that usually yields better results. A GPU is recommended in this case, as it will take up to an hour on CPU:

PreserveColor  (1)

By default, style transfer affects the image color:

Use PreserveColor->True to preserve the colors of the original image:

RandomSeeding  (1)

When setting PerformanceGoal->"Quality", RandomSeeding will specify the seeding method. A GPU is recommended in this case, as it will take up to an hour on CPU:

TargetDevice  (1)

Restyle using the default system GPU, if available:

If a compatible GPU is not available, a message is issued and the computation is aborted:

Properties & Relations  (1)

A weighting of 0 completely ignores the sample's style:

A weighting of 1 completely ignores the content of the original image:

Possible Issues  (1)

The default setting for PerformanceGoal is fast but can fail at capturing some features of the style, especially textures and stroke geometry:

With PerformanceGoal->"Quality", the style is more faithfully reproduced. A GPU is recommended in this case, as it will take up to an hour on CPU:

Neat Examples  (1)

Explore increasing stylization weightings with an animation:

Wolfram Research (2017), ImageRestyle, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageRestyle.html.

Text

Wolfram Research (2017), ImageRestyle, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageRestyle.html.

CMS

Wolfram Language. 2017. "ImageRestyle." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageRestyle.html.

APA

Wolfram Language. (2017). ImageRestyle. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageRestyle.html

BibTeX

@misc{reference.wolfram_2024_imagerestyle, author="Wolfram Research", title="{ImageRestyle}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/ImageRestyle.html}", note=[Accessed: 24-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_imagerestyle, organization={Wolfram Research}, title={ImageRestyle}, year={2017}, url={https://reference.wolfram.com/language/ref/ImageRestyle.html}, note=[Accessed: 24-November-2024 ]}