note 113920 added to imagick.sigmoidalcontrastimage

From: Date: Tue, 17 Dec 2013 19:48:27 +0000
Subject: note 113920 added to imagick.sigmoidalcontrastimage
Groups: php.notes 
Request: Send a blank email to php-notes+get-197962@lists.php.net to get a copy of this message
The documentation for this function really isn't useful or helpful at all. "Sharpen", "Contrast" and "Midpoint" aren't the names of the params, which are referred to as "alpha" and "beta". The Imagemagick manual entry: For those interested, the corrected formula for the 'sigmoidal non-linearity contrast control' is... ( 1/(1+exp(β*(α-u))) - 1/(1+exp(β)) ) / ( 1/(1+exp(β*(α-1))) - 1/(1+exp(β*α)) ) Where α is the threshold level, and β the contrast factor to be applied. The formula is actually very simple exponential curve, with the bulk of the above formula is designed to ensure that 0 remains zero and 1 remains one. That is, the graph always goes though the points 0,0 and 1,1. And the highest gradient of change is at the given threshold. Src: http://www.imagemagick.org/Usage/color_mods/#sigmoidal In the Imagick extension source, the function call is: status = MagickSigmoidalContrastImageChannel(intern->magick_wand, channel, sharpen, alpha, beta); Src: https://github.com/mkoppanen/imagick/ Referring back to the binary API call gives: foreign import ccall "MagickSigmoidalContrastImageChannel" magickSigmoidalContrastImageChannel :: Ptr MagickWand -> ChannelType -- ^ identify which channel to level: redChannel, greenChannel -> MagickBooleanType -- ^ increase or decrease image contrast -> CDouble -- ^ strength of the contrast, the larger the number the more 'threshold-like' it becomes -> CDouble -- ^ midpoint of the function as a color value 0 to quantumRange -> IO MagickBooleanType Src: http://hackage.haskell.org/package/imagemagick-0.0.2/docs/src/Graphics-ImageMagick-MagickWand-FFI-WandImage.html So the parameters should apparently be interpreted: Sharpen: 0/1 (increase/decrease contrast) Alpha: Strength of the contrast (typically 3-20) Beta: Midpoint of the contrast (typically 50) ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/imagick.sigmoidalcontrastimage.php Edit -- https://master.php.net/note/edit/113920 Del: integrated -- https://master.php.net/note/delete/113920/integrated Del: useless -- https://master.php.net/note/delete/113920/useless Del: bad code -- https://master.php.net/note/delete/113920/bad+code Del: spam -- https://master.php.net/note/delete/113920/spam Del: non-english -- https://master.php.net/note/delete/113920/non-english Del: in docs -- https://master.php.net/note/delete/113920/in+docs Del: other reasons-- https://master.php.net/note/delete/113920 Reject -- https://master.php.net/note/reject/113920 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197962) next »