CS129 Project4 Texture Synthesis and Transfer

Yun Miao, Oct 24 2012

Texture Synthesis

Given a small texture, we can synthesize a large texture by selecting small patches from the texture and stitch them together. Naively , we could randomly select patches from a texture and stitch the patches together. This method produces less than ideal result.

A better method is to find patches that match on the edge and stitch them together. During the process of synthesis, we can use random sampling to find some random patches, and then use SSD to find the patch that best matches the previous synthesized result. This method produces a better result than the naive method.

A even better method is to find a seam near the edge of the patch that has the minimum error. And cut the patch along that seam. This is the min-cut algorithm, similar to seam carving, which we have implemented in project 3.

A figure from the lecture illustrates the three algorithms:

Different results from using the three algorithms.

random ssd min cut

More ImagesFewer Images

Texture synthesis continued: using different patch and overlap size

Using different patch and overlap size can have a surprising impact on the end result. Usually large repetitive pattern works well with larger patches and overlap size. Here are some comparisons:

tilesize 30 overlap 10 tilesize 100 overlap 16
tilesize 60 overlap 12 tilesize 90 overlap 20
tilesize 40 overlap 10 tilesize 80 overlap 16
tilesize 40 overlap 10 tilesize 60 overlap 20
tilesize 40 overlap 10 tilesize 80 overlap 12

Texture Transfer

With texture synthesis algorithm, we are well equipped to implement texture transfer since texture transfer is a restrained texture synthesis. Text transfer finds correlation between the texture and the source image, and apply darker texture to the dark area of an image, and the opposite to the light area of an image. We can define any reasonable image property for computing the correspondence, e.g, image intensity.

As we go through the source image patch by patch, we find the best patch in the texture to replace the corresponding part of the image. The best patch has the minimum difference (error) using the correspondence we defined.

The paper by Efros and Freeman also suggests we use multiple iterations to achieve texture transfer. A formula is given to us for implementing texture transfer:
error = alpha * (overlap_error + previous_synthesized_error) + (1-alpha) * correspondence_error .
alpha increases each iteration, which means the original image has less impact on the output image.

The following result is achieved using the toast texture with 1st iteration tile size 30, overlap size 10.

Original 1st iteration 2nd iteration 3rd iteration

The tile size has a large impact in texture transfer as well. The following image is achieved using tile size 15.

More images

original texture 1st iteration 2nd iteration 3rd iteration