MarcPartensky / Fourier

Make fun of fourier transform.
MIT License
17 stars 6 forks source link
fourier fourier-analysis fourier-methods fourier-optics fourier-series fourier-transform fourier-transformation

Use fourier transform to draw epicycles with your drawings.

Draw a picture or sample one, press space, then watch an epic simulation of epicycles being drawned identically as your picture. Thanks the the fourier transform your drawing will be reproduced in a real-time simulation only using epicycles.

Demo

Fourier Animation

Install

#Clone the repository
git clone https://github.com/MarcPartensky/Fourier.git
cd Fourier

#Install requirements
pip install -r requirements.txt

Usage

Put your model image image.png in the FourierImages folder.

python __main__.py image.png
python __main__.py
> image name:

Then give your image:

> image name:image.png

Run with docker

# Download the docker-compose.yml file and cd into its parent folder
# Put your image in the FourierImages folder then run
# Replace 'image.png' by your own image filename
docker-compose run --rm fourier image.png

Or choose your own folder

# Download the docker-compose.yml file and cd into its parent folder
# Replace the first occurence of 'FourierImages' by your custom image folder
# Replace 'image.png' by your own image too
docker-compose run --rm \
    -v ./FourierImages:/opt/FourierImages \
    fourier image.png

Or run the full docker command without the docker-compose.yml file

docker run --rm \
-v $PWD/image.jpg:./image.jpg \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--device /dev/dri \
-e DISPLAY \
marcpartensky/fourier /image.jpg

Or store the coefficients and the images in a folder

docker run --rm \
-v $PWD/FourierImages:/opt/FourierImages \
-v $PWD/FourierObjects:/opt/FourierObjects \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--device /dev/dri \
-e DISPLAY \
marcpartensky/fourier image.jpg

Description

There are 3 modes in this program:

Controls

Hide or Show the graphical components

Press the following numbers to toggle:

Enjoy!