jblog
toc

J-Filters VI

2016-02-20, post № 105

programming, Pygame, Python, #angle, #around, #filter, #image, #image filter, #image manipulation, #manipulation, #spinning, #spun, #spun around, #stir, #vector

Using a vector and an angle, rotating each pixel’s position by an angle determined by its distance to the image’s center and a constant, this filter gives the image a unique spin.
For demonstration I used — once again — an image from my post Stacking Stones.

j-filters-vi_spin-14.png
j-filters-vi_spin-10.png
j-filters-vi_spin-11.png
Source code: j-filters-vi_spin.py

Conway’s Game of Life

2016-02-13, post № 104

games, mathematics, programming, Pygame, Python, #cells, #cell, #cell simulation, #cellular, #cellular automation, #cellular game, #cellular simulation, #John Conway, #simulation

This program is a simulation of the famous cellular automaton created by John Conway. The so-called ‘game’ is rather a simulated evolution of cells in a two-dimensional world. Each cell can either be dead (black) or alive (white) and always has eight neighbours surrounding them. In each cycle of the simulation their state will be changed based on two simple rules, which are listed below.
Despite the rule’s simplicity, the outcomes are often very interesting and complex.
For more details on the game of life, check this Wikipedia entry.

The Rules

  • A live cell can only survive with exactly 𝟤 or 𝟥 neighbours, or else it dies.
  • A dead cell with exactly 𝟥 neighbours comes to life.

Controls

  • Left click turns cell at current mouse position alive,
  • Right click turns cell at current mouse position dead,
  • ‘r’ turns every cell dead,
  • ‘q’ cycles once,
  • ‘w’ cycles continuously.
conways-game-of-life-1.gif
conways-game-of-life-4.gif
conways-game-of-life-3.gif
Source code: conways-game-of-life.py

J-Filters V

2016-02-06, post № 103

programming, Pygame, Python, #contrast, #detection.sobel, #digital image filter, #edge, #edge detection, #filter, #image, #image filter, #img, #img filter, #J-Filter

This filter runs an edge detection algorithm on a given image.
For demonstration I used — as in my previous filter posts — an image from my post Stacking Stones.

j-filters-v_original.jpg

The image with applied edge detection filter:

j-filters-v_edge-detection.png
Source code: j-filters-v_edge-detection.py
Jonathan Frech's blog; built 2021/04/16 21:21:49 CEST