Coding, Java, JavaScript

Translating from JavaScript to Java (Continued)

Simon continued translating from JavaScript to Java as he followed Daniel Shiffman’s tutorial on creating a mirror based on the brightness values of the pixels from a live video feed. The tutorial was about working in p5.js and Simon worked in Processing (Java):

 

 

 

Coding, Java

Pixel Sorting in Processing (Java)

Pixel Sorting 1 Apr 2017 8

Today Simon showed me what he learned about pixel sorting in Processing (Java) by doing this coding challenge by Daniel Shiffman. Using a “selection sort” algorithm, he sorted the pixels of a sunflower image by brightness and hue. The results were amazing, it had this impressionistic effect, like a Van Gogh painting. Maybe Van Gogh also sorted pixels?

Here the pixels are sorted at random in black and white:

Pixel Sorting 1 Apr 2017 1

Here Simon added max RGB values:

Pixel Sorting 1 Apr 2017 2

Here the pixels are cloned from the image on the left:

Pixel Sorting 1 Apr 2017 3

The same, but in an easier way, by using the img.get() function:

Pixel Sorting 1 Apr 2017 4

Pixels sorted by brightness:

Pixel Sorting 1 Apr 2017 5

Pixels sorted by hue:

Pixel Sorting 1 Apr 2017 6

Beautiful, isn’t it?

Pixel Sorting 1 Apr 2017 7