I know how to call binary Otsu method for a greyscale image:
threshold(image, opencv_otsu_result, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
But I don't understand how to use this function if I want divide my image into 3, 4,... colors. I am trying to find some function like:
threshold(image, result, SOME_FLAGS, number_of_colors);