Otsu' Thresholding Method to Binarize an image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
xinito

Otsu' Thresholding Method to Binarize an image

Post by xinito »

Is there an implementation of ImageMagick? Did adaptive-threshold use this algorithm?

Thanks:?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

You may like to explain to us dummys what a "Otsu' Thresholding Method" is!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
xinito

Post by xinito »

Ots thresholding is to choose a level from the histogram of the intensity image to threshold the image. Any pixel greater than the level will be white; any one below will be black.

The idea is to maximize the inter-class variance or minimize the within-class variance.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Hmmm sounds like the threshold methods using a 2 color quantization.

Code: Select all

    convert  image.png  -colorspace gray  +dither  -colors 2  -normalize \
             threshold_colors.gif
this turns off dithering, then finds the best two grey level colors to represent the image, regardless of if the image is bright, dark or other. The two grey levels are then normalised to black and white.

For more info see
IM Examples, Color Quantization and Dithering, Two Color Quantization
http://www.cit.gu.edu.au/~anthony/graph ... colors_two
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply