# Source code for random phase noise texture synthesis

### 1.3

Random phase texture synthesis

using ./random_phase_noise"

This source code is an ANSI C implementation of the random phase noise texture synthesis algorithm describes in the IPOL webpage Random Phase Texture Synthesis.

The last release should be available at <http://www.ipol.im/pub/algo/ggm_random_phase_texture_synthesis/>.

This code is provided with an HTML documentation produced by doxygen <http://www.ipol.im/pub/algo/ggm_random_phase_texture_synthesis/srcdoc/>.

Author:
  Bruno Galerne ; <bruno.galerne@cmla.ens-cachan.fr> ; <http://www.cmla.ens-cachan.fr/~galerne>

Requirements:

- ANSI C compiler
- getopt
- libpng
- libfftw3

Compilation:

Execute the provided Makefile (function make).

Usage: (displayed in executing ./random_phase_noise -h)

random_phase_noise -r ratio -x nxout -y nyout -a alpha -s seed image_in.png image_out.png

Required parameters:
image_in.png : name of the input PNG image
image_out.png : name of the output PNG image

Optionnal parameters:
ratio : float > 1 that specifies the increase of size of image_out.png relatively to the size of image_in.png
nxout : int to specify the width of image_out.png. Must be greater than the width of image_in.png
nyout : int to specify the height of image_out.png. Must be greater than the height of image_in.png
alpha : float in (0,0.5) that specifies the proportion of the smoothing zone for the spot extension (alpha = 0.1 by default)
seed : unsigned int to specify the seed for the random number generator (seed = time(NULL) by default)

Test: To test the module run:
./random_phase_noise -s 1 sample.png output.png
output.png should be the same as the image sample_rpn.png provided with the source code.

Releases:

- version 1.0: first version

- version 1.1: (optimization) Use the FFTW functions fftw_plan_dft_r2c_2d and fftw_plan_dft_c2r_2d for discrete Fourier transforms computation (reduce the size of all complex arrays).

- version 1.2: New version of the spot extension technique (see the spot_extension_color function): For the smooth transition the cumulative histogram of a standard molifier is used instead of a Gaussian decay. This is mathematically more coherent, but does not lead to significant changes for the produced textures. In addition, the new option -s enables to specify the seed for the random number generator. This permits to use the same random phase with different input images.

- version 1.21: The source files have been reorganized: all the relevant functions are now in the file random_phase_noise_lib.c. Besides, the source code for png input/output is a more recent version due to Nicolas Limare <nicolas.limare@cmla.ens-cachan.fr>.

- version 1.3: Minor bug fixed thanks to the reviewer (unsigned int different from size_t for 64 bits). A small png image and its corresponding output are added to the release to enable a quick test of the module. Change of input/output routines: input and output images have now the .png image format.