Skip to content

Commit

Permalink
6
Browse files Browse the repository at this point in the history
  • Loading branch information
villares committed Dec 7, 2024
1 parent c487fb5 commit da8b425
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Binary file added 2024/sketch_2024_12_06/sketch_2024_12_06.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions 2024/sketch_2024_12_06/sketch_2024_12_06.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import numpy as np
import py5
from skimage import measure

# from https://scikit-image.org/docs/stable/auto_examples/edges/plot_contours.html
x, y = np.ogrid[-np.pi : np.pi : 400j, -np.pi : np.pi : 400j]
r = np.sin(np.exp(np.sin(x) ** 3 + np.cos(y) ** 2))
r = r.T
r *= 255

def setup():
global img
py5.size(400, 400)
py5.color_mode(py5.HSB)
img = py5.create_image_from_numpy(r.T, 'L')

def draw():
py5.image(img, 0, 0)
t = py5.mouse_x / py5.width * 255
contours = measure.find_contours(r, t)

for i, contour in enumerate(contours):
py5.fill(i * 32, 255, 255, 150)
with py5.begin_closed_shape():
py5.vertices(contour)

py5.run_sketch(block=False)
10 changes: 10 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ Here are listed some of the tools I have been using more recently:
2024 \| [<b>2023</b>](2023.md) \| [<b>2022</b>](2022.md) \| [<b>2021</b>](2021.md) \| [<b>2020</b>](2020.md) \| [<b>2019</b>](2019.md) \| [<b>2018</b>](2018.md)


---

### sketch_2024_12_06

![sketch_2024_12_06](https://raw.githubusercontent.com/villares/sketch-a-day/main/2024/sketch_2024_12_06/sketch_2024_12_06.gif)

[sketch_2024_12_06](https://github.com/villares/sketch-a-day/tree/main/2024/sketch_2024_12_06) [[py5](https://py5coding.org/)]



---

### sketch_2024_12_05
Expand Down

0 comments on commit da8b425

Please sign in to comment.