Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Well, OpenCV is an image processing library, but most of what you need to do is not really image processing.

To make the image lower resolution, you can see an example in THIS tutorial.

And to reduce the number of colors, THESE tutorials explain how kmeans works and how to use it for posterizing the image. There is also the kmeans.cpp sample code to show how to use kmeans in C++ instead of Python.

Then it's just a matter of checking which color each pixel is and then adding it to the appropriate list and printing the lists to a file.

Of course, if you use adobe illustrator for reducing colors and resolution, you don't really need OpenCV at all, except possibly to read the image, which is trivial.