Fourier and Images
Last updated Feb 21, 2024
85
Stars
4
Forks
1
Issues
0
Stars/day
Attention Score
1
Topics
Language breakdown
Python 100.0%
โธ Files
click to expand
README
Fourier and Images
Fourier and Images is a project that tries to draw images with circles.
Setup
pip3 install -r requirements.txt- Modify
main.pyto reflect where your images are. python3 main.py
Example
Getting one set of circles with one image:
im = Image("pikachu.png", (200, 200)) path = im.sort() period, tupcirclerads, tupcirclelocs = Fourier(napprox = 1000, coord1 = path).get_circles() Plot(period, tupcirclerads, tupcirclelocs, speed = 8).plot()
Pikachu
Getting two sets of circles with one image:
im = Image("einstein.jpg", (200, 200))
path = im.sort()
period, tupcirclerads, tupcirclelocs = Fourier(napprox = 1000, coord1 = path).get_circles(mode=2)
Plot(period, tupcirclerads, tupcirclelocs, speed = 8).plot()
Note that the circle on the bottom left is NOT drawing any particular image.
Einstein
Getting two set of circles with two image:
im_1 = Image("images/formula.jpeg", (200, 200)) im_2 = Image("images/dickbutt.jpg", (200, 200)) path1 = im1.sort() path2 = im2.sort() period, tupcirclerads, tupcirclelocs = Fourier(napprox = 1000, coord1 = path1, coord2 = path2).getcircles() Plot(period, tupcirclerads, tupcirclelocs, speed = 8).plot()
Dickbutt and Euler's Formula
Getting visualization of how number of Fourier Series terms affects the image:
im = Image("images/obama.jpg", (200, 200)) path = im.sort() period, tupcirclerads, tupcirclelocs = Fourier(coord1 = path).getcircles() Plot(period, tupcirclerads, tupcirclelocs, visualize = True).plot()
Obama
Warnings
Too big of an image might cause your computer to freeze! Resizing the image to (200, 200) is a safe choice and anything above (500, 500) starts to get a bit sketchy.Animation
Anything above 1000 n_approximations takes a bit of time to animate. Recommend speed = 8. In this setting, saving the animation takes about 10 minutes.Improvements
1) Use FFT to calculate the Fourier Series coefficients 2) Improve edge detection algorithm 3) Improve the function(s) that order the points from the edge detection algorithmHave fun!
๐ More in this category



