MagickRandomThresholdImage

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
*void

MagickRandomThresholdImage

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

For a discussion of random thresholding, see http://www.cit.gu.edu.au/~anthony/graph ... -threshold
*void

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Looks like a cut and paste error. We will fix the documentation. Thanks for the problem report.
Post Reply