Multi otsu(multi-thresholding) with openCV

后端 未结 6 1619
忘掉有多难
忘掉有多难 2020-12-02 23:53

I am trying to carry out multi-thresholding with otsu. The method I am using currently is actually via maximising the between class variance, I have managed to get the same

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 00:41

    I've written an example on how otsu thresholding work in python before. You can see the source code here: https://github.com/subokita/Sandbox/blob/master/otsu.py

    In the example there's 2 variants, otsu2() which is the optimised version, as seen on Wikipedia page, and otsu() which is more naive implementation based on the algorithm description itself.

    If you are okay in reading python codes (in this case, they are pretty simple, almost pseudo code like), you might want to look at otsu() in the example and modify it. Porting it to C++ code is not hard either.

提交回复
热议问题