GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

"""Animation shows the code bellow and an interactive demo it produces in a small window with colored regions over image changing with mouse movement""" 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)

Download link

Notices where this attachment appears

  1. Embed this notice
    Alexandre B A Villares (villares@pynews.com.br)'s status on Saturday, 07-Dec-2024 10:21:15 JST Alexandre B A Villares Alexandre B A Villares

    Code at: https://github.com/villares/sketch-a-day/tree/main/2024/sketch_2024_12_06
    More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
    I really need your support to keep going, if you can, donate any amount at: https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724 #Processing #Python #py5 #CreativeCoding

    In conversation Saturday, 07-Dec-2024 10:21:15 JST from pynews.com.br permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.