All Projects → pvigier → Perlin Numpy

pvigier / Perlin Numpy

Licence: mit
A fast and simple perlin noise generator using numpy

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Perlin Numpy

Machinelearningcourse
A collection of notebooks of my Machine Learning class written in python 3
Stars: ✭ 35 (-39.66%)
Mutual labels:  numpy
Data Science Complete Tutorial
For extensive instructor led learning
Stars: ✭ 1,027 (+1670.69%)
Mutual labels:  numpy
Awesome Ebooks
收录开源的经典技术书籍 PDF 文件及相关网站,持续更新中...
Stars: ✭ 51 (-12.07%)
Mutual labels:  numpy
Nesly Sound
Create beautiful music on your NES
Stars: ✭ 35 (-39.66%)
Mutual labels:  noise
Wynullview
An easy way to use for view's empty state 一行代码显示空视图,高度自定义
Stars: ✭ 44 (-24.14%)
Mutual labels:  numpy
Eulerian Remote Heartrate Detection
Remote heart rate detection through Eulerian magnification of face videos
Stars: ✭ 48 (-17.24%)
Mutual labels:  numpy
Highdicom
High-level DICOM abstractions for the Python programming language
Stars: ✭ 32 (-44.83%)
Mutual labels:  numpy
25daysinmachinelearning
I will update this repository to learn Machine learning with python with statistics content and materials
Stars: ✭ 53 (-8.62%)
Mutual labels:  numpy
Machine Learning
notebooks with example for machine learning examples
Stars: ✭ 45 (-22.41%)
Mutual labels:  numpy
Numpy Convnet
A small and pure Numpy Convolutional Neural Network library.
Stars: ✭ 50 (-13.79%)
Mutual labels:  numpy
Pycall.jl
Package to call Python functions from the Julia language
Stars: ✭ 985 (+1598.28%)
Mutual labels:  numpy
Abu
阿布量化交易系统(股票,期权,期货,比特币,机器学习) 基于python的开源量化交易,量化投资架构
Stars: ✭ 8,589 (+14708.62%)
Mutual labels:  numpy
Ncar Python Tutorial
Numerical & Scientific Computing with Python Tutorial
Stars: ✭ 50 (-13.79%)
Mutual labels:  numpy
Tensorly
TensorLy: Tensor Learning in Python.
Stars: ✭ 977 (+1584.48%)
Mutual labels:  numpy
Gait Recognition
Distance Recognition of a Human Being with Deep CNN's
Stars: ✭ 51 (-12.07%)
Mutual labels:  numpy
Mlcourse.ai
Open Machine Learning Course
Stars: ✭ 7,963 (+13629.31%)
Mutual labels:  numpy
Iml
Курс "Введение в машинное обучение" (ВМК, МГУ имени М.В. Ломоносова)
Stars: ✭ 46 (-20.69%)
Mutual labels:  numpy
Mlkatas
A series of self-correcting challenges for practicing your Machine Learning and Deep Learning skills
Stars: ✭ 58 (+0%)
Mutual labels:  numpy
Numpy ringbuffer
Ring-buffer implementation that thinly wraps a numpy array
Stars: ✭ 52 (-10.34%)
Mutual labels:  numpy
Numerical Linear Algebra
Free online textbook of Jupyter notebooks for fast.ai Computational Linear Algebra course
Stars: ✭ 8,263 (+14146.55%)
Mutual labels:  numpy

perlin-numpy

I wrote two articles on my blog about this project, the first one is about the generation of 2D noise while the second one is about the generation of 3D noise, feel free to read them!

Description

A fast and simple perlin noise generator using numpy.

Installation

You can install this package via:

pip3 install git+https://github.com/pvigier/perlin-numpy

Usage

from perlin_numpy import (
    generate_fractal_noise_2d, generate_fractal_noise_3d,
    generate_perlin_noise_2d, generate_perlin_noise_3d
)

2D noise

The function generate_perlin_noise_2d generates a 2D texture of perlin noise. Its parameters are:

  • shape: shape of the generated array (tuple of 2 ints)
  • res: number of periods of noise to generate along each axis (tuple of 2 ints)
  • tileable: if the noise should be tileable along each axis (tuple of 2 bools)

Note: shape must be a multiple of res

The function generate_fractal_noise_2d combines several octaves of 2D perlin noise to make 2D fractal noise. Its parameters are:

  • shape: shape of the generated array (tuple of 2 ints)
  • res: number of periods of noise to generate along each axis (tuple of 2 ints)
  • octaves: number of octaves in the noise (int)
  • persistence: scaling factor between two octaves (float)
  • lacunarity: frequency factor between two octaves (float)
  • tileable: if the noise should be tileable along each axis (tuple of 2 bools)

Note: shape must be a multiple of lacunarity^(octaves-1)*res

3D noise

The function generate_perlin_noise_3d generates a 3D texture of perlin noise. Its parameters are:

  • shape: shape of the generated array (tuple of 3 ints)
  • res: number of periods of noise to generate along each axis (tuple of 3 ints)
  • tileable: if the noise should be tileable along each axis (tuple of 3 bools)

Note: shape must be a multiple of res

The function generate_fractal_noise_2d combines several octaves of 3D perlin noise to make 3D fractal noise. Its parameters are:

  • shape: shape of the generated array (tuple of 3 ints)
  • res: number of periods of noise to generate along each axis (tuple of 3 ints)
  • octaves: number of octaves in the noise (int)
  • persistence: scaling factor between two octaves (float)
  • lacunarity: frequency factor between two octaves (float)
  • tileable: if the noise should be tileable along each axis (tuple of 3 bools)

Note: shape must be a multiple of lacunarity^(octaves-1)*res

Recipes

Note these snippets require matplotlib.

2D Perlin and Fractal Noise

import matplotlib.pyplot as plt
import numpy as np
from perlin_numpy import (
    generate_perlin_noise_2d, generate_fractal_noise_2d
)

np.random.seed(0)
noise = generate_perlin_noise_2d((256, 256), (8, 8))
plt.imshow(noise, cmap='gray', interpolation='lanczos')
plt.colorbar()

np.random.seed(0)
noise = generate_fractal_noise_2d((256, 256), (8, 8), 5)
plt.figure()
plt.imshow(noise, cmap='gray', interpolation='lanczos')
plt.colorbar()
plt.show()

2D Perlin noise 2D fractal noise

3D Fractal Noise

import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
from perlin_numpy import generate_fractal_noise_3d

np.random.seed(0)
noise = generate_fractal_noise_3d(
    (32, 256, 256), (1, 4, 4), 4, tileable=(True, False, False)
)

fig = plt.figure()
images = [
    [plt.imshow(
        layer, cmap='gray', interpolation='lanczos', animated=True
    )]
    for layer in noise
]
animation_3d = animation.ArtistAnimation(fig, images, interval=50, blit=True)
plt.show()

3D fractal noise

3D Perlin Noise

import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
from perlin_numpy import generate_perlin_noise_3d

np.random.seed(0)
noise = generate_perlin_noise_3d(
    (32, 256, 256), (1, 4, 4), tileable=(True, False, False)
)

fig = plt.figure()
images = [
    [plt.imshow(
        layer, cmap='gray', interpolation='lanczos', animated=True
    )]
    for layer in noise
]
animation_3d = animation.ArtistAnimation(fig, images, interval=50, blit=True)
plt.show()

3D Perlin noise

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].