Page 1 of 1

MagickRandomThresholdImage

Posted: 2006-12-27T17:33:18-07:00
by *void
I can't make sense of the description of this function. I don't understand "geometry string" in the context of the function prototype.

Here is the text from magick-image.html:

MagickRandomThresholdImage

MagickRandomThresholdImage() changes the value of individual pixels based on the intensity of each pixel compared to threshold. The result is a high-contrast, two color image.

The format of the MagickRandomThresholdImage method is:

MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
const double low,const double high)
MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
const ChannelType channel,const double low,const double high)

A description of each parameter follows:
wand

The magick wand.
channel

The image channel(s).
low,high

a geometry string containing low,high thresholds. If the string contains 2x2, 3x3, or 4x4, an ordered dither of order 2, 3, or 4 is performed instead.

Posted: 2006-12-27T18:34:52-07:00
by magick
For a discussion of random thresholding, see http://www.cit.gu.edu.au/~anthony/graph ... -threshold

Posted: 2006-12-30T16:35:39-07:00
by *void
I didn't explain myself very well. I was puzzled by the description of the two floating point arguments high, and low as "a geometry string".

I consider it unlikely that the MagickWand API expects me to somehow pass a string in two floating point numbers, so I presume the garbled description was writted by someone familiar with the command line but not much familiarity with programming. (I also did not understand even the term "geometry string", which I now understand is an artifact of the ImageMagick command line.) http://www.imagemagick.org/Magick++/Geometry.html

The reference you cited decribes random thresholding in the context of the ImageMagick command line, which was helpful at least to the extent of understand the concept of the function. From reading the cited ref, I think I can deduce that what goes into the low and high arguments are real numbers in either the interval [0...1] or, possibly [1....100]. I may be able to figure out which is correct by reading the source code, or I can try some experiments.

Posted: 2006-12-30T17:29:08-07:00
by magick
Looks like a cut and paste error. We will fix the documentation. Thanks for the problem report.