Texture Synthesis

  • ==>

  • Description

    The Texture Synthesis progream is constructed with freeiamge. It takes common image formats like JPG,GIF,PNG,PPM as input and generates images with windows, whose sizes are specified by the user input, serach and match pattern in the local pixel space, and patch the new texutre. The result varies, depends on the input the complexity of the image.

  • Download


  • Run the program

    The program is compiled on Ubuntu 12.04_x86_x64, so there is no guarantee that it would run on a x86 system. However, if you have access to my source code, you can compile, with freeimage installed, on your machine or use a virtual machine to run the program.

    • To run tasks on all sample images in the directory, /samples
      • Assignment4
    • To run a task on a specific image
      • Assigment4 image.png output_size window_size
    • Adding -t flag let you tilte the sample images


  • File Struture

    • Supported sample image formats are in PNG,JPG,GIF,PPM
    • For unsupported formats, one can use 3rd party tools to convert.
      • eg. on Linux, I use: mogrify -format new_type *.old_type
    • Output images are also in PNG format (Implemented using freeimage)

  • Algorithm

    • load input sample into pixels
    • search the best matches and put them together
      • For each pixel(x,y),make a size n x n window which contains the the pixel(x,y)
      • In the window, search for best match(least error pixel) and save the best match pixel coordinate
      • Set the pixel(x,y) to the new match color in the generated texture.
    • save the output pxiel to a PNG format image

  • Optimization

    • OpenMP parallel for used

  • Screenshots/ Output Images

  • Miscellaneous

    Insterstingly, in some simple tilting case the generated texture align perfectly.