Page 1 of 1

MagickSigmoidalContrastImage

Posted: 2010-09-30T00:22:58-07:00
by Hilbert
Greetings all,

I'm still pretty new to IM, but I'm trying to use "MagickSigmoidalContrastImage" in the MagickWand API http://www.imagemagick.org/api/magick-i ... trastImage

I don't understand the arguments: alpha: "control the "shoulder" of the contast curve." and beta: "control the "toe" of the contast curve.". These seem to be different from the arguments in the command-line "sigmoidal-contrast" http://www.imagemagick.org/script/comma ... l-contrast, which asks for a contrast magnitude (0-20) and a midpoint (e.g. 50).

How do "alpha" and "beta" in the API relate to "contrast" and "midpoint" in the command-line?

thanks

Re: MagickSigmoidalContrastImage

Posted: 2010-09-30T16:15:15-07:00
by anthony
Use the source Luke... well I did anyway....

Hmmm
SigmoidalContrastImageChannel() is the function called from the Command Line API exactly as per the command docs.

MagickSigmoidalContrastImage() passes alpha and beta directly to SigmoidalContrastImageChannel(), the the same function!

As such I believe the Magick Docs are wrong (if they are as you describe).
alpha = strength of the contrast, the larger the number the more 'threshold-like' it becomes
beta = midpoint of the function as a color value 0 to QuantumRange

I have no idea where these 'shoulder' and 'toe' attributes come from.

Re: MagickSigmoidalContrastImage

Posted: 2010-10-01T00:24:15-07:00
by Hilbert
Thanks Anthony/Yoda -- I suspected that the inputs were really just amount and mid-level, but I had guessed the range of the second input wrong. I now think a value of 100 corresponds to 50% in the command line sigmoidal-contrast, which doesn't seem to correspond to a QuantumRange value for some reason.
cheers!

Re: MagickSigmoidalContrastImage

Posted: 2010-10-01T05:27:06-07:00
by anthony
The percentage calculation is done by the command line API, not the library. Magick API does not seem to handle the percentage aspect.

There is another function in the core library, SigmoidalContrastImage(), That is no 'Channel', which takes a string geometry argument. It does handle the percentage if present in the geometry argument. However neither CLI or Magick interfaces seem to make use of this function.

I do suggest that the function (and magick) documentation get fixed to replace the misleading 'shoulder' and 'toe' references.

Re: MagickSigmoidalContrastImage

Posted: 2010-10-03T11:13:18-07:00
by Wolfgang Woehl
Moving the center of a sigmoid function (also known as "s-curves") changes rates of both ends. Looking at an "S" makes "shoulder" and "toe" quite obvious.

Re: MagickSigmoidalContrastImage

Posted: 2010-10-03T17:41:18-07:00
by anthony
Except the parameters described as effecting 'shoulder' and 'toe' are really to do with 'slope gradient' and 'slope location'. That is the problem -- documentation.