The steps for texture synthesis are shown below:
Step 01: Take random samples from a source picture and every sample will be used for an edge colour of tiles in texture synthesis. For example, if we have 4 edge colours for a tile (red, blue, yellow and green), then we will take 4 random sample images from the source picture. Moreover, the size of sample images should be larger than the output texture size. The sample size = texture size + overlap pixel.
Step 02: Get 4 samples according to the edge colours of a tile and then get the pixels which will be put in the output texture. The following figures demonstrate how to get pixel from sample image. Figure 4.13a demonstrates how the 4 samples construct the output texture and 4.13b shows the process to transfer pixels from sample image to texture.
|
Combine 4 samples |
|
|
Transfer pixels from sample image to texture |
Step 03: Merge the 4 images of edges with the order: a. north and west; b. south and east; c. northwest and southeast. The merging algorithm is derived from the work of Efros and Freeman [Efros and Freeman 2001], and changes the algorithm from vertical or horizontal merging boundaries to diagonal boundaries. The algorithm used in this thesis is shown below:
1) Get the sum error of RGB values from two sample images within the overlap area (If the overlap length is 5, then the cells before and after the diagonal cell within the range of 2 are in the overlap area). Figure 4.14a shows the result table of sum error.
2) Except for the first line, all the values of the cells will add the minimum value of the 3 neighbour cells at the previous line. The formula for this step is: C i,j = C i,j + MIN( C i-1,j-1 , C i,j-1 , C i+1,j-1 ) (S stands for the value in cells and this formula will not be applied for the first line). The resulting table of this step is shown in Figure 4.14b.
3) Choose the minimum value in the last line, and then choose the minimum value from the 3 neighbour cells of previous line until the first line. Figure 4.14c shows a cutting edge which is constructed from this algorithm and the red numbers marked in the figure are the mixing border of two images.
4) Merge the two sample images using the blur radii value. The following figure shows the mixing pixels when blur radii value is 1
|
|
Get sum error of two sample images |
Accumulate the weights of the path of cutting edge |
|
|
|
|
Get the cutting edge from the table |
Merge the two sample images with blur radii |
An Example of Automatical Texture Generation:
Step 01: Original images
|
|
Origin Image for area 1 |
Origin Image for area 2 |
Step 02: Texture images derived from the source images above
Step 03: Resulting image construct with the textures
|