Anime Color Palette Experiment
27 Mar 2014This was a novel attempt at 'extracting' color palettes from illustration-styled artwork, and specifically, from anime.
Starting with the assumption/requirement that shapes in the source image should have fairly well-defined boundaries, the image is partitioned into a collection of two-dimensional polygons (OpenCV's findContours
plus approxPolyDP
).
Each chunk is then sampled for its surface area and its average color (based on a second assumption that each chunk will have a more-or-less fairly uniform color). The resulting chunks' colors are then grouped together based on "proximity" by treating HSV values as three-dimensional positions, and each color group is ranked based on surface area, resulting in a final color palette.
In the end, the results were mixed, but predictably better with artwork with well-defined outlines and flat colors.
As a bonus, though, since each chunk is represented internally as a polygon, they can be treated as independent objects, and can therefore be subjected to potentially interesting visual treatments.
This is demonstrated in the video by (predictably enough...) doing some tween-ey things on the z-axis. As well as a quick "pencil-drawn" effect.
FWIW, the still images are from Kill La Kill, and the video is the OP of UN-GO.
From 3/2012. C++, cinder, OpenCV.