outImg,outThreshold = | kapurThresholdImg (inImg) |
scalar = | kapurThresholdImg (inImg,outBinImg) |
outImg,outThreshold = | kapurThresholdImg (inImg,histogram) |
scalar = | kapurThresholdImg (inImg,histogram,outBinImg) |
Compute the Kapur threshold of an input image, and binarize the image using this threshold.
Kapur's method is used to automatically perform the binarization of an input image. It assumes that the image is bi-modal (pixel intensities can be distinguished in 2 classes: background pixels and foreground pixels). It then calculates the optimal threshold that separates these 2 classes, by maximizing the sum of their entropies [1].
On output, binarized image values are given by:
with the threshold computed from Kapur's method.
Input and output images must have same size and buffer type.
Here is an example of automatic Kapur image thresholding applied to a 8-bits grey level image (on ouput, computed threshold equals 123) :
[1] Kapur, J.; Sahoo, P. & Wong, A., "A new method for gray-level picture thresholding using the entropy of the histogram", Computer Vision, Graphics, and Image Processing, 1985, 29, 273 - 285