Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

Show HN: Reorganize pixels of a painting into a smooth color palette using PCA

$
0
0

README.md

To install

pip install -r requirements.txt

If that doesn't work you will have to manually track down and install these pip packages.

To use

python palette.py /path/to/input_file.jpg

Output will be written to output.png

Example

Input:

Kupka - Mme Kupka Among Verticals

Input

Output:

Output

How it works

Mostly based on PCA a little tutorial on what that means here

  1. Organize pixels according to their first principal component (the direction along which variance is greatest)

  2. Grab a column of pixels at a time, and organize them according to their first principal component

  3. Use the resulting columns one by one in the final result. With each column, check to see if flipping it upside down gives a better match to the previous column.


Viewing all articles
Browse latest Browse all 25817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>