I have very little experience with image processing or signal processing in general, but I'm willing to learn.

I've been experimenting with a way to, uh... "flatten" the colors of certain kinds of images. For example, I have a photograph of an object that has been painted with few colors, and I want an image with only these colors, removing shadows, textures and other noise.

I've obtained mixed results using the following brute-force technique:

  • Create a matrix of pixels, starting as "unmapped".
  • Apply a "fuzzy floodfill" algorithm on the image, starting at a random position, with the modification that, instead of comparing pixels to a single starting color, I compare the colors of neighboring pixels. Also, instead of immediately modifying the image, I mark the filled pixels on a temporary matrix (so as to simulate the floodfill process correctly), and mark these pixels in the main matrix as belonging to this map.
  • Repeat until there are no "unmapped" pixels in the image.
  • The matrix will then be filled with many maps, each one representing a single set of similar colors.
  • Compute the average of the colors of each map, and paint the pixels corresponding to each map to each color.

Results: http://www.lgm.cl/whatisthis/

Hopefully, by seeing the images I've created, you'll be able to understand what I'm trying to achieve. The downside of my algorithm is that it's SLOW and inefficient, so I'm looking for a more efficient way to achieve at least the same results.

Note: I just stumbled upon the knowledge of Gradient Domain Image Processing and the wonderful things it can do. I haven't experimented with it yet, but at first it looks promising. However, I'm asking for further advice before going through another trial-and-error session. :)

  • $\begingroup$ Could you show an example of what you mean? $\endgroup$
    – Royi
    Mar 31, 2016 at 6:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.