0

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);

Maxim Gotovchits
  • 729
  • 3
  • 11
  • 22
  • There's no OpenCV function to do this. However, you can find examples for [3](http://stackoverflow.com/q/34856019/5008845) and [4](http://stackoverflow.com/q/35056760/5008845) levels – Miki Apr 13 '16 at 22:13
  • Or you can go through Matlab [multithresh](http://uk.mathworks.com/help/images/ref/multithresh.html) code and port to OpenCV – Miki Apr 13 '16 at 22:16
  • @Miki Actually I implemented my own multi-threshold Otsu and I'd like to compare it with opencv realization. Thank You – Maxim Gotovchits Apr 13 '16 at 23:49
  • @Miki Could you write it as an answer for my question so I will mark it as a solution :) – Maxim Gotovchits Apr 13 '16 at 23:54

0 Answers0