This project explores various texture synthesis techniques and implements texture transfer. Texture transfer is giving an object the appearance of having the same texture as a sample while preserving its basic shape. Texture transfer is achieved by encouraging sampled patches to have similar appearance to a given target image, as well as matching overlapping regions of already sampled patches. For texture synthesis, the main idea is to sample patches and lay them down in overlapping patterns, such that the overlapping regions are similar. This project is based on the SIGGRAPH 2001 paper by Efros and Freeman.
The first approach to texture synthesis is to randomly choose patches of a certain size. As shown in the image output image to the right, this will lead to noticable overlap and seams, making it the worst of all the methods explored in this project.
The logic behind this approach is to choose patches that minimize the ssd cost between overlaps in the output image. To do this we compute a cost image, where each pixels value is a weighted ssd (sum of squared difference) cost of choosing the patch centered at that pixel. We then define a parameter "tol" that tells us how many of the least cost patches to randomly choose from. Once we choose our patch, we simply copy the patch into the corresponding pixels in the output image. This produces better results than the first approach, although there are still some noticable seams.
The seam finding approach has very similar logic to the overlap approach. Except now we use a shortest path algorithm to construct masks for each direction of the overlap. We then apply the masks to take determine which pixels to take from each patch. This approach produces the best results out of the three. The additional results below are using this method.
As mentioned intially, texture transfer is giving an object the appearance of having the same texture as a sample while preserving its basic shape. Texture transfer is achieved by encouraging sampled patches to have similar appearance to a given target image, as well as matching overlapping regions of already sampled patches. The implementaiton of texture transfer is very similar to seam carving. There is just an additonal cost term in the SSD calculation to determine the weighting from the SSD of the guidance image and the SSD of the target image. Unfortunately, I ran into difficulties finding good images to apply the algorithm to.
Input Texture
Guidance Image
Output Image