Code Monkey home page Code Monkey logo

fourier.me's Introduction

fourier.me

Try it out here! https://fourier-me.vercel.app/

In this project I am building a tool that takes your photos and turns them into Fourier Epicycle Drawings.

Not getting it ? Here's the inspiration: https://youtu.be/r6sGWTCMz2k

How it works ?

Here's a TLDR of how it works:

  1. Takes any image(jpg/jpeg/png...etc) as input.
  2. Resizes this image to feasible proportions.
  3. Uses ControlNet's LineartDetector Model to find the outline of image.
  4. From this image, it gets the coordinates of the outline pixels.
  5. Using the Christofides' algorithm, it finds the shortest closed tour of the points.(doing this is important for the epicycles to work as intended)
  6. Converts these points into complex numbers.
  7. Takes the Complex Discrete Fourier Transform of these points(using numpy's fft(fast fourier transform) function).
  8. Saves the fft data along with other details like frequency, amplitude in a csv file.
  9. Now comes the animation part, the manim code reads this csv file and makes the corresponding rotating arrows and circles and animates them.

Sample Renders

Robot.png Robot.gif

How to run locally

git clone https://github.com/shlok-007/fourier.me.git
cd fourier.me
mkdir images
mkdir arrow_data
cd Manim
pip install requirements.txt

If you don't have chocolatey installed, follow this to install it.

Now,

choco install manimce

Now, you can run the main.py file by giving it the path to your desired image as input.

python main.py path/to/image

For example:

python main.py ../sample_images/robot.png

You can checkout and try varying the parameters declared at the top of the files getLineArt.py, getVectors.py, and epicycle_manim.py to control various aspects of the process. Also, you can checkout the manim.cfg file for varying the parameters related to animation rendering.

fourier.me's People

Contributors

shlok-007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.