PHP.mk документација

Imagick::sigmoidalContrastImage

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

imagick.sigmoidalcontrastimage.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека imagick.sigmoidalcontrastimage.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
Imagick::sigmoidalContrastImage

Референца за `imagick.sigmoidalcontrastimage.php` со подобрена типографија и навигација.

imagick.sigmoidalcontrastimage.php

Imagick::sigmoidalContrastImage

(PECL imagick 2, PECL imagick 3)

Imagick::sigmoidalContrastImageЈа прилагодува контрастот на сликата

= NULL

public function Imagick::sigmoidalContrastImage(
         bool $sharpen,
         float $alpha,
         float $beta,
         int $channel од Imagick 3.4.4. Силно се обесхрабрува потпирањето на оваа функција.
): bool

Adjusts the contrast of an image with a non-linear sigmoidal contrast algorithm. Increase the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows. alpha indicates how much to increase the contrast: 0.00 is none; 3.00 is typical; 20.00 is pushing it. beta indicates where midtones fall in the resultant image, as a fraction of the quantum range: 0.0 is white, 0.5 is middle-gray, 1.0 is black (multiply by getQuantumRange()['quantumRangeLong'] to get the value to pass).

Види исто така » ImageMagick Examples -- Color Modifications — Sigmoidal Non-linearity Contrast.

Параметри

sharpen

Враќа true increase the contrast, if false decrease the contrast.

alpha

The amount of contrast to apply. 1.00 is very little, 5.00 is a significant amount, 20.00 is extreme.

beta

Where the midpoint of the gradient will be. This value should be in the range 0.00 to 1.00 - multiplied by the quantum value for ImageMagick.

channel

На кои канали во боја ќе се примени контрастот.

Вратени вредности

Патеката до PHP скриптата што треба да се провери. true на успешен исход.

Errors/Exceptions

Фрла ImagickException при грешка.

Примери

Пример #1 Создадете градиентна слика користејќи Imagick\Imagick::sampleImage suitable for blending two images together smoothly, with the blending defined by alpha and beta

<?php

function generateBlendImage($width, $height, $alpha = 10, $beta = 0.5)
{
    $imagick = new Imagick();
    $imagick->newPseudoImage($width, $height, 'gradient:black-white');
    $quanta = $imagick->getQuantumRange();
    $imagick->sigmoidalContrastImage(true, $alpha, $beta * $quanta["quantumRangeLong"]);

    return $imagick;
}

Белешки од корисници 2 забелешки

acameron na theatomgroup tocka com
12 години пред
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)
SkepticaLee
пред 10 години
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.
Навигација

Прелистувај сродни теми и функции.

На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.