How to reduce the number of colors in an image with OpenCV?
This subject was well covered on OpenCV 2 Computer Vision Application Programming Cookbook: Chapter 2 shows a few reduction operations, one of them demonstrated here in C++ and later in Python: #include <iostream> #include <vector> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> void colorReduce(cv::Mat& image, int div=64) { int nl = image.rows; // number of lines int nc … Read more