- fractal_noise(shape, frequency=0.05, octaves=4, gain=0.5, mode='simplex', seed=None, cores=None, uniform=True)#
Generate fractal noise which can be thresholded to create binary images with realistic structures across scales.
shape (array_like) – The size of the image to generate, can be 2D or 3D.
frequency (scalar, default=0.05) – Controls the overall scale of the generated noise, with larger values giving smaller structures.
octaves (int, default=4) – Controls the number of scales across which structures are generated, with larger values giving more scale.
gain (scalar, default=0.5) – Controls the intensity of successively higher octaves. Values below 1.0 mean the higher octaves are less prominent.
mode (string) –
The type of noise to generate. Options are:
Classic Perlin noise. For more information on
perlin noisesee here.
Updated Perlin noise for more realistic textures. For more information on
simplex noisesee here.
Bilnear interpolation of white noise. For more information on
value noisesee here.
Cubic interpolation of white noise. For more information on
cubic noisesee here.
seed (int, optional) – The seed of the random number generator. Using the same
seedbetween runs will produce the same image.
cores (int, optional) – The number of cores to use. This function uses
pyfastnoisesimd, which has implemented SIMD processing which can be spread across cores. The default is to use all cores.
uniform (boolean, optional) – If
True(default) the random values are converted to a uniform distribution between 0 and 1, otherwise the resulting image contains the unprocesssed values, which have a ‘normal-esque’ distribution centered on 0.
This function provides a simplified wrapper for the functions in the pyfastnoisesimd package.
pyfastnoisesimdis itself a wrapper for a C-library called FastNoiseSIMD. To access the more elaborate functionality and options of these packages, explore the pyfastnoisesimd documentation.
Click here to view online example.