Posted on January 15th, 2025
In the previous parts of this series, we tried various techniques to simplify images and achieve a Paint-by-Numbers effect. We saw how morphological transformations didn’t work as hoped but discovered that connected components could effectively eliminate small, unwanted regions. With that done, we’re now focusing on the problem of “thin regions” that still linger in our image. By the end of this post, we’ll also dive into boundary detection and labeling to give our picture that classic Paint-by-Numbers look.
Removing Thin Regions
When it comes to removing thin regions, two initial ideas might spring to mind:
- Width-to-height ratio. A region is considered “thin” if its width is much larger than its height, or vice versa.
- Region area to bounding box area. A low ratio means the region occupies only a small fraction of its bounding box, suggesting a thin shape.
Read more...
Posted on January 1st, 2025
Let's recap where this epic tale halted: we have a saturated, color-reduced, brush-stroked image that we want to transform into a "Paint by Number" composition. The main challenge is the abundance of small regions—if we leave them as is, the final result will be a mess of tiny pixel areas, nearly impossible to label or paint.
Attempt 1 - Morphological Transformations
After conferring with my genius bird photographer brother, he recommended Morphological Transformations - fundamental operations in image processing that are used to manipulate the structure of an image by altering its "shape" (hence morphological). To apply them, one needs a binary image (black and white) and a "structuring element" (a kernel).
There are two essential transformations and two that combine them:
Read more...
Posted on November 11th, 2024
At some point when you were fiddling around on Instagram (or maybe some other platform - not judging), I bet you were served a "Paint-by-Numbers" ad. Those are painting kits where you are given a black-and-white contour image with labeled numbers. You have to paint each number with a color, and at the end you have a fully colored painting that you did yourself (well, mostly).
Media targeting is pretty good nowadays, and of course I'm the kind of person to fall for it. On the other hand, for my own good, I also like to let things "cook" on a tab for a couple of days or weeks before making a purchase decision, so I don't buy anything emotionally. This saved me this time because, after two weeks, the website I opened (which seemed pretty legit) simply didn't exist anymore. Another one of those scams where you buy something and probably don't receive anything (or a brick).
Then I began asking myself: What if I could do it myself? I certainly didn't like most of the paintings I saw on those websites - maybe I could use my own pictures - and if I had something that worked, I could maybe even sell it and make it available for people who also want to create their own paint-by-numbers, with the additional benefit of not needing to spend a tedious amount of time making sure the websites are legit.
The plan was pretty simple in my head.
Read more...