PHP | Imagick getImageChannelMean() Function
Last Updated :
03 Feb, 2023
The Imagick::getImageChannelMean() function is an inbuilt function in PHP which is used to get the mean and standard deviation of one or more image channels. It returns an associative array containing the keys as “mean” and value as “standardDeviation”. Syntax:
array Imagick::getImageChannelMean(int $channel)
Parameters: This function accepts a single parameter $channel which holds the channel constant that is valid for your channel mode. Use bitwise operator to combine more than one channeltype constants. Exceptions: This function throws ImagickException on error. Return Value: This function returns TRUE on success. Below programs illustrate the Imagick::getImageChannelMean() function in PHP: Program 1:
php
<?php
$imagick = new Imagick(
$mean = $imagick ->getImageChannelMean(1);
print_r( $mean );
?>
|
Output:
Array( [mean] => 56510.812968516 [standardDeviation] => 20404.259764873 )
Program 2:
php
<?php
$imagick = new Imagick(
$mean = $imagick ->getImageChannelMean(5);
print_r( $mean );
?>
|
Output:
Array ( [mean] => 57217.085522456 [standardDeviation] => 18896.296535248 )
Reference: https://www.php.net/manual/en/imagick.getimagechannelmean.php
Share your thoughts in the comments
Please Login to comment...