Imagick::getImageChannelKurtosis

(PECL imagick 2 >= 2.3.0, PECL imagick 3)

Imagick::getImageChannelKurtosis β€” Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ эксцСсс ΠΈ Π°ΡΠΈΠΌΠΌΠ΅Ρ‚Ρ€ΠΈΡŽ ΠΎΠΏΡ€Π΅Π΄Π΅Π»Ρ‘Π½Π½ΠΎΠ³ΠΎ ΠΊΠ°Π½Π°Π»Π°

ОписаниС

public function Imagick::getImageChannelKurtosis(int $channel = Imagick::CHANNEL_DEFAULT): array

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ эксцСсс ΠΈ Π°ΡΠΈΠΌΠΌΠ΅Ρ‚Ρ€ΠΈΡŽ ΠΎΠΏΡ€Π΅Π΄Π΅Π»Ρ‘Π½Π½ΠΎΠ³ΠΎ ΠΊΠ°Π½Π°Π»Π°. ΠœΠ΅Ρ‚ΠΎΠ΄ доступСн, Ссли ΠΌΠΎΠ΄ΡƒΠ»ΡŒ Imagick скомпилировали с вСрсиСй ImageMagick 6.4.9 ΠΈΠ»ΠΈ ΡΡ‚Π°Ρ€ΡˆΠ΅.

Бписок ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€ΠΎΠ²

channel

ΠŸΠ΅Ρ€Π΅Π΄Π°ΠΉΡ‚Π΅ Π»ΡŽΠ±ΡƒΡŽ ΠΊΠΎΡ€Ρ€Π΅ΠΊΡ‚Π½ΡƒΡŽ для вашСго Ρ€Π΅ΠΆΠΈΠΌΠ° ΠΊΠ°Π½Π°Π»Π° константу. Для примСнСния ΠΊ Π±ΠΎΠ»Π΅Π΅ Ρ‡Π΅ΠΌ ΠΎΠ΄Π½ΠΎΠΌΡƒ ΠΊΠ°Π½Π°Π»Ρƒ, ΠΊΠΎΠΌΠ±ΠΈΠ½ΠΈΡ€ΡƒΠΉΡ‚Π΅ константы ΠΊΠ°Π½Π°Π»ΠΎΠ² с ΠΏΠΎΠΌΠΎΡ‰ΡŒΡŽ ΠΏΠΎΠ±ΠΈΡ‚ΠΎΠ²Ρ‹Ρ… ΠΎΠΏΠ΅Ρ€Π°Ρ‚ΠΎΡ€ΠΎΠ². По ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ Ρ€Π°Π²Π½ΠΎ Imagick::CHANNEL_DEFAULT. ΠžΠ±Ρ€Π°Ρ‚ΠΈΡ‚Π΅ΡΡŒ ΠΊ списку констант ΠΊΠ°Π½Π°Π»ΠΎΠ²

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅ΠΌΡ‹Π΅ значСния

Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ массив с элСмСнтами kurtosis ΠΈ skewness.

Ошибки

Ѐункция выбрасываСт ΠΈΡΠΊΠ»ΡŽΡ‡Π΅Π½ΠΈΠ΅ ImagickException, Ссли Π²ΠΎΠ·Π½ΠΈΠΊΠ»Π° ошибка.

οΌ‹Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ

ΠŸΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΡ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Π΅ΠΉ 1 note

up
0
holdoffhunger at gmail dot com ΒΆ
14 years ago
The getImageChannelKurtosis function accepts as a parameter any of the ImageMagick channel constants and returns an array containing elements with the two element values of 'kurtosis' and 'skewness.'

For the inputted color values, you have the ImageMagick channel constant values that look like imagick::CHANNEL_UNDEFINED, with "_VALUE" values of: undefined, red, gray, cyan, green, magenta, blue, yellow, alpha, opacity, matte, black, index, all, and default.  This is for measuring the particular channel for these colors of their own associated colorspaces.

According to Wikipedia, the Kurtosis is "any measure of the 'peakedness' of the probability distribution of a real-valued random variable" and Skewness (its opposite) is "a measure of the asymmetry of the probability distribution of a real-valued random variable."  The more colors vary from the inputted channel constant, you'll be more likely to get a skewness close to zero, and you'll get the opposite behavior from checking the kurtosis value, which makes sense, since skewness and kurtosis are considered mathematical antonyms.

Some sample code :

<?php

            // Author: holdoffhunger@gmail.com
    
        // Imagick Type
        // ---------------------------------------------

    $imagick_type = new Imagick();
    
        // Open File
        // ---------------------------------------------
        
    $file_to_grab = "image_workshop_directory/test.bmp";
    
    $file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
    
        // Grab File
        // ---------------------------------------------

    $imagick_type->readImageFile($file_handle_for_viewing_image_file);
    
        // Get Quantum Range
        // ---------------------------------------------
        
    $imagick_type_channel_kurtosis_red = $imagick_type->getImageChannelKurtosis(imagick::CHANNEL_RED);
    
        // Print Results
        // ---------------------------------------------

    print("<pre>");
    print_r($imagick_type_channel_kurtosis_red);
    print("</pre>");

?>

The results for performing this function upon a photo of the ocean...

ImageMagick - Channel Kurtosis
  Channel - Undefined :

Kurtosis : 0
Skewness : 0

  Channel - Red :

Kurtosis : 0.920611158888
Skewness : 1.52701528976

  Channel - Gray :

Kurtosis : 0.920611158888
Skewness : 1.52701528976

  Channel - Cyan :

Kurtosis : 0.920611158888
Skewness : 1.52701528976

  Channel - Green :

Kurtosis : -0.286520845928
Skewness : 1.05203603783

  Channel - Magenta :

Kurtosis : -0.286520845928
Skewness : 1.05203603783

  Channel - Blue :

Kurtosis : -0.849997917796
Skewness : 0.807852655795

  Channel - Yellow :

Kurtosis : -0.849997917796
Skewness : 0.807852655795

  Channel - Alpha :

Kurtosis : 0
Skewness : 0

  Channel - Opacity :

Kurtosis : 0
Skewness : 0

  Channel - Matte :

Kurtosis : 0
Skewness : 0

  Channel - Black :

Kurtosis : 0
Skewness : 0

  Channel - Index :

Kurtosis : 0
Skewness : 0

  Channel - All :

Kurtosis : 0.509521246195
Skewness : 1.33491479552

  Channel - Default :

Kurtosis : -0.349955122843
Skewness : 1.00561407035