Page 1 of 1

documentation question in -threshold IM 6.4.4.-6

Posted: 2008-10-14T23:28:19-07:00
by fmw42
The documentation for -threshold at http://www.imagemagick.org/script/comma ... #threshold says:

"If only a single 0 is provided, auto-thresholding will be performed."

Can someone tell me how auto-thresholding works or point me to the specific c code in the IM source code? When I do -threshold 0 all I get is a totally white image.

convert rose: -threshold 0 rose_auto_thresh.png
convert logo: -threshold 0 logo_auto_thresh.png

both result in a totally white image!!!

Also, while looking at the code in threshold.c, I see listed an A d a p t i v e T h r e s h o l d I m a g e, but I do not see any IM option at http://www.imagemagick.org/script/comma ... ptions.php for any such thing. What happened to this?

Thanks.

Re: documentation question in -threshold IM 6.4.4.-6

Posted: 2008-10-14T23:47:18-07:00
by anthony
The manual is wrong. the command is right. Otherwise it makes it hard to seperate pure black pixels from non-black pixels.
See IM examples, Quantization, for reference to its proper behaviour.

Re: documentation question in -threshold IM 6.4.4.-6

Posted: 2008-10-15T10:07:19-07:00
by fmw42
anthony wrote:The manual is wrong. the command is right. Otherwise it makes it hard to seperate pure black pixels from non-black pixels.
See IM examples, Quantization, for reference to its proper behaviour.

OK, I have edited the documentation to remove the inaccurate line.

Also is there any autothresholding function and is there any adaptive thresholding function (there is code for the latter, but no option listed)?

Thanks

Re: documentation question in -threshold IM 6.4.4.-6

Posted: 2008-10-15T18:17:50-07:00
by anthony
One 'auto thresholding' method is to reduce the image to two colors without dither.

I look at this in IM examples, quantization, Two color quantization
http://www.imagemagick.org/Usage/quantize/#two_color

Re: documentation question in -threshold IM 6.4.4.-6

Posted: 2008-10-15T21:15:06-07:00
by fmw42
anthony wrote:One 'auto thresholding' method is to reduce the image to two colors without dither.

I look at this in IM examples, quantization, Two color quantization
http://www.imagemagick.org/Usage/quantize/#two_color
How does -monochrome handle its thresholding? Does it dither? Either way, your approach with -colors 2 seems to produce a better result.

The reason I am asking about auto thresholding is that I am looking into scripting some various approaches to see how they work.

Re: documentation question in -threshold IM 6.4.4.-6

Posted: 2008-10-15T22:42:07-07:00
by anthony
-monocrome dithers always. It currently ignores the -dther setting.

It works by first grayscaling the image, then doing a two color gray colorspace quantization. See IM examples, Quantization