% gti: Gaussian Texture Inpainting

This software is written by
     Bruno Galerne <bruno.galerne@parisdescartes.fr>
     Arthur Leclaire <arthur.leclaire@cmla.ens-cachan.fr>

This program is free software: you can use, modify and/or
redistribute it under the terms of the simplified BSD
License. You should have received a copy of this license along
this program. If not, see
<http://www.opensource.org/licenses/bsd-license.html>.

This is the version 1.0 of gti, released December 2016.
Future versions and updates on the IPOL website.

# OVERVIEW

The program performs inpainting of texture images.
It relies on conditional simulation of a Gaussian texture model
on the mask, knowing the values of the texture on a border of the mask.
The Gaussian texture model is estimated on the mask complement.
The linear system involved in the Gaussian conditional simulation
is solved with a conjugate gradient descent.

For more information consult the corresponding paper at the address
http://...

# COMPILATION

This software requires an ANSI C compiler and the libpng library[1-2],
version >= 1.2. Pre-compiled versions of the libpng library are
available for Linux (libpng-dev in most distributions), Mac OS X (in
fink[1]) and Windows (provided by GnuWin32[3]).

Several parts of this software can run faster thanks to parallel
computations relying on the OpenMP library.

To compile gti, use the makefile with simply `make`. 
Alternately you can call your C compiler with
	cc src/io_png.c src/gti.c -Wall -std=c99 -Wextra -pedantic -O3 -ftree-vectorize -funroll-loops -fopenmp -lpng -lfftw3f_omp -lfftw3f -lgomp -lm -o gti

You can also build a version with optimization options for gcc with
`make opti` and one with debugging symbols with `make debug`.

[1] http://www.libpng.org/pub/png/libpng.html
[2] http://pdb.finkproject.org/pdb/browse.php?summary=libpng
[3] http://gnuwin32.sourceforge.net/packages/libpng.htm

# DOCUMENTATION

You can generate the documentation for this software by going
in the doc directory and running the command
	doxygen doxygen.conf
After that, you can open the file doc/html/index.html in your
web browser.

# USAGE

This program only reads and writes PNG files. The call syntax is
    gti in.png mask.png out.png [ep niter w]
where
     in.png, mask.png	are the input images
     in.png  		is the image to be inpainted
     mask.png		is the mask image (white on inpainting domain)
     out.png		output image     
     ep, niter, w	are optional parameters
     ep	 		is the desired precision for linear solving
     niter		is the max number of iterations of gradient descent
     w			is the width of the conditioning border

The software will fill the inpainting domain (defined by the white
zone in mask.png) with a texture sample derived from the values of
in.png outside the mask. The inpainted image is stored in out.png.

# EXAMPLES

An example input image is provided in the data folder.

* simple inpainting
    gti data/in.png data/mask.png data/out.png

* inpainting with specific parameters
    gti data/in.png data/mask.png data/out.png 0.00001 10000 5
