filmov
tv
Pixel Sorting Narukami Island (ft. Selection Sort)

Показать описание
I tried pixel sorting Narukami Island using selection sort. Throughout the video, you see mountain pixels being swapped with the sky pixels. You also see pixels changing from left to right and top to bottom. Every time it does that, the pixels in some areas change color. The result looked like a pink glazed mountain holding onto a brown cloud with its purple arm.
I was thinking of using counting sort, but I wanted to use a simpler sorting algorithm that involves swapping elements. The first selection sort sorts the pixels by hue. The second selection sort sorts the pixels by saturation. And the third selection sort sorts the pixels by blue values. Blue values are integers for the third parameter of the RGB function, which is used to color the canvas, shapes, and text. If you're wondering why the white pixels got swapped, it's because the color white has a blue value of 255. I coded it to make sure it only sorts any pixel that has a blue value greater than 220.
Animating what this pixel sorting looks like was my favorite part in doing this coding challenge. However, it took a few hours to generate, so I had to use a smaller image to generate it faster.
Timestamps:
0:01 Sorting by hue
2:06 Sorting by saturation
3:48 Sorting by blue value
Music by Approaching Nirvana
Song: Kyoto
Inspired by The Coding Train's pixel sorting video:
I was thinking of using counting sort, but I wanted to use a simpler sorting algorithm that involves swapping elements. The first selection sort sorts the pixels by hue. The second selection sort sorts the pixels by saturation. And the third selection sort sorts the pixels by blue values. Blue values are integers for the third parameter of the RGB function, which is used to color the canvas, shapes, and text. If you're wondering why the white pixels got swapped, it's because the color white has a blue value of 255. I coded it to make sure it only sorts any pixel that has a blue value greater than 220.
Animating what this pixel sorting looks like was my favorite part in doing this coding challenge. However, it took a few hours to generate, so I had to use a smaller image to generate it faster.
Timestamps:
0:01 Sorting by hue
2:06 Sorting by saturation
3:48 Sorting by blue value
Music by Approaching Nirvana
Song: Kyoto
Inspired by The Coding Train's pixel sorting video: