I recently stumbled upon this neat algorithm by Johannes Kopf and Dani Lischinski. In short, their algorithm takes a pixelart image, such as those found in 8-bit video games, and produces a new image that somehow makes you think “hey, that looks like what the artist actually had in mind”. In other words, it tries to generate the ideal image for which the pixel art is only an imperfect representation. The results explain it better:
If you are interested in this kind of stuff, I really recommend you read their paper, it is well written, easy to understand even for people with no deep knowledge of computer graphics (like myself) or for people with no programming training. I partially implemented their algorithm using Common Lisp and Zach Beane’s Vecto library, here’s a very very short description, just to illustrate the different steps. Some eye-candy at the end!
First, we find which regions of the original image are part of a single feature.
Once different regions have been found, pixels are re-shaped so that each region has a well defined contour.
Finally, edges are identified …
… and smoothed
Keep in mind that this is only a partial implementation, the original algorithm also re-shapes edges to make them look more natural, reducing zig-zag curves for example. (they also use a different type of curve, b-splines, which works better than what I’m using, catmull rom) and therefore produces much better results. Have a look at their examples in the linked article.
Click on the images to enlarge
Thanks to Javier Moreno, Norman Garcia and Angie Bloor for their comments.