Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fungos/rtp
American Gothic in the palette of Mona Lisa: Rearrange the pixels
https://github.com/fungos/rtp
Last synced: 22 days ago
JSON representation
American Gothic in the palette of Mona Lisa: Rearrange the pixels
- Host: GitHub
- URL: https://github.com/fungos/rtp
- Owner: fungos
- Created: 2014-11-08T03:28:24.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-08T03:28:38.000Z (about 10 years ago)
- Last Synced: 2024-05-01T23:25:05.297Z (7 months ago)
- Language: C++
- Size: 1.78 MB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Code Golf - Rearrange the pixels
This is my implementation of the following challange:
http://codegolf.stackexchange.com/questions/33172/american-gothic-in-the-palette-of-mona-lisa-rearrange-the-pixels
I've implemented a "reference" implementation on that link with the idea in the top scored solution (Java - GUI with progressive randomized transformation) that I used to compare my results.
My algorithms are composition of "technique" and "distance" algorithms, that means all color comparision are done ba some kind of distance formulae. The technique is how do we iterate to compare the distance.
As for distance, I've implemented four algorithms:
- Color Metric (http://www.compuphase.com/cmetric.htm)
- CieDe 2000 (https://github.com/THEjoezack/ColorMine/blob/master/ColorMine/ColorSpaces/Comparisons/CieDe2000Comparison.cs)
- Cie 1967
- HSV Hue CompareAs for technique, there are three simple implementations:
- Random Pixel Swap (reference - best score on stack exchange)
- The idea is just to pick two random pixels on both image, compare them and swap them only if they are closer.
- Indexed Replace
- Sort all pixels on both images, then replace from first image on the second based on the array index only.
- Bisect
- Single: Sort all pixels on both images, find using bisect the closer one on the second image for each pixel in the first one, consuming both.
- Threaded: Same, but we do with subsections of the image, this cause banding on the image depending on the pixel color quantity and distribution.
- The results are very nice and is fast.This was a nice exercice to remember Qt and do some C++11 coding, the challange was just an excuse anyway ;)