# CoherentTransformations

Documentation for CoherentTransformations.

CoherentTransformations is the beautiful combinations of CoherentNoise.jl and ImageTransformations.jl.

A matrix of noise is generated with `CoherentNoise`

and used to generate a vector field to translate different pixels. `ImageTransformations`

takes care of reconstructing the pixels according to this map. At the end the image is cropped and resized to match the original image without any empty pixels.

The most important function is `noise_warp`

which takes and image and a noise source to warp it.

`CoherentTransformations.noise_warp`

— Function`noise_warp(img, noise_source::AbstractSampler; squared = true, variance = 0.1, crop = true)`

`noise_warp`

takes both an `img`

and a `noise_source`

built from `CoherentNoise.jl`

and returns a warpped image. The principle is simple:

- Two matrices of noise are generated using
`noise_source`

. - These matrices are converted into vector field by centering the values around 0

and scaling them with `variance * size`

.

- The vector field corresponds to the displacement of the pixels in the x/y coordinate field.
`ImageTransformations`

apply the transformations and adaptively warp the image.- If
`crop`

is true, the image will be cropped to ensure no`NaN`

values are contained.

There are also a few helper functions to directly use existing settings, see for example `checker_warp`

and the examples in Example.

`CoherentTransformations.checker_warp`

— FunctionUse the `checkered_2d`

noise from `CoherenNoise`

for a checker effect

`CoherentTransformations.ridged_warp`

— FunctionUse a combination of `opensimplex2_3d`

and `ridged_fractal_3d`

for a ridged effect.

`CoherentTransformations.cylinder_warp`

— FunctionUse the `cylinders_2d`

noise from `CoherenNoise`

for a cylinder effect

`CoherentTransformations.sphere_warp`

— FunctionUse the `spheres_3d`

noise from `CoherenNoise`

for a spherical effect

There is also the helper function.

`CoherentTransformations.gen_coherent_matrix`

— FunctionThis is a cheaper version of `gen_image`

from `CoherentNoise`

, which does not generate a `RGB`

matrix but a matrix of type `T`

.