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)Imagick::sigmoidalContrastImage
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Imagick::sigmoidalContrastImage
Референца за `imagick.sigmoidalcontrastimage.php` со подобрена типографија и навигација.
Imagick::sigmoidalContrastImage
(PECL imagick 2, PECL imagick 3)
Imagick::sigmoidalContrastImage — Ја прилагодува контрастот на сликата
= NULL
bool
$sharpen,float
$alpha,float
$beta,int
$channel од Imagick 3.4.4. Силно се обесхрабрува потпирањето на оваа функција.): bool
Ја прилагодува контрастот на сликата со нелинеарен сигмоиден алгоритам за контраст. Зголемете го контрастот на сликата користејќи сигмоидна функција за пренос без заситување на светлите делови или сенките. Контрастот покажува колку да се зголеми контрастот (0 е ништо; 3 е типично; 20 е претерување); средната точка покажува каде паѓаат средните тонови во резултирачката слика (0 е бело; 50 е средно сиво; 100 е црно). Поставете заострување на
true за да го зголемите контрастот на сликата, инаку контрастот се намалува.
Види исто така » Примери на ImageMagick v6 - Трансформации на слики — Сигмоидна нелинеарност Контраст
Параметри
sharpen-
Ако е точно, зголемете го контрастот, ако е неточно, намалете го контрастот.
alpha-
Количината на контраст што треба да се примени. 1 е многу малку, 5 е значителна количина, 20 е екстремно.
beta-
Каде ќе биде средната точка на градиентот. Оваа вредност треба да биде во опсег од 0 до 1 - помножена со квантната вредност за ImageMagick.
channel-
На кои канали во боја ќе се примени контрастот.
Вратени вредности
Патеката до PHP скриптата што треба да се провери. true на успешен исход.
Errors/Exceptions
Фрла ImagickException при грешка.
Примери
Пример #1 Создадете градиентна слика користејќи Imagick\Imagick::sampleImage suitable for blending two images together smoothly, with the blending defined by $contrast and $the midpoint
<?php
function generateBlendImage($width, $height, $contrast = 10, $midpoint = 0.5) {
$imagick = new Imagick();
$imagick->newPseudoImage($width, $height, 'gradient:black-white');
$quanta = $imagick->getQuantumRange();
$imagick->sigmoidalContrastImage(true, $contrast, $midpoint * $quanta["quantumRangeLong"]);
return $imagick;
}
?>Белешки од корисници 2 забелешки
The formula for sigmoidal contrast given by Thyssen is missing a term. It should be:
( 1/(1+exp(β*(α-u))) - 1/(1+exp(β*α)) ) / ( 1/(1+exp(β*(α-1))) - 1/(1+exp(β*α)) )
where there was an α missing from the second term.
Note that a sigmoidal contrast with α = 6 and β = 0.46 is approximately equivalent to combining a "screen" overlay of the image on itself, followed by a "multiply" overlay.