PHP |想象一下 getImageChannelStatistics()函数
Imagick::getImageChannelStatistics()函数是PHP中的一个内置函数,用于获取图像中每个通道的统计信息。
句法:
array Imagick::getImageChannelStatistics( void )
参数:此函数不接受任何参数。
异常:此函数在出错时抛出 ImagickException。
返回值:该函数返回一个以统计数据为数组成员的数组。
下面的程序说明了PHP中的Imagick::getImageChannelStatistics()函数:
方案一:
getImageChannelStatistics();
print("".print_r($statistics, true)."
");
?>
输出:
Array
(
[0] => Array
(
[mean] => 0
[minima] => 1.7976931348623E+308
[maxima] => -1.7976931348623E+308
[standardDeviation] => 0
[depth] => 1
)
[1] => Array
(
[mean] => 56510.812968516
[minima] => 0
[maxima] => 65535
[standardDeviation] => 20404.259764873
[depth] => 8
)
[2] => Array
(
[mean] => 61143.413450883
[minima] => 5654
[maxima] => 65535
[standardDeviation] => 10656.363052485
[depth] => 8
)
[4] => Array
(
[mean] => 57923.358076397
[minima] => 1799
[maxima] => 65535
[standardDeviation] => 17257.063161026
[depth] => 8
)
[8] => Array
(
[mean] => 0
[minima] => 0
[maxima] => 0
[standardDeviation] => 0
[depth] => 1
)
[32] => Array
(
[mean] => 0
[minima] => 1.7976931348623E+308
[maxima] => -1.7976931348623E+308
[standardDeviation] => 0
[depth] => 1
)
)
方案二:
getImageChannelStatistics();
print("".print_r($statistics, true)."
");
?>
输出:
Array
(
[0] => Array
(
[mean] => 0
[minima] => 1.7976931348623E+308
[maxima] => -1.7976931348623E+308
[standardDeviation] => 0
[depth] => 1
)
[1] => Array
(
[mean] => 56510.812968516
[minima] => 0
[maxima] => 65535
[standardDeviation] => 20404.259764873
[depth] => 8
)
[2] => Array
(
[mean] => 61143.413450883
[minima] => 5654
[maxima] => 65535
[standardDeviation] => 10656.363052485
[depth] => 8
)
[4] => Array
(
[mean] => 65535
[minima] => 65535
[maxima] => 65535
[standardDeviation] => 0
[depth] => 1
)
[8] => Array
(
[mean] => 0
[minima] => 0
[maxima] => 0
[standardDeviation] => 0
[depth] => 1
)
[32] => Array
(
[mean] => 0
[minima] => 1.7976931348623E+308
[maxima] => -1.7976931348623E+308
[standardDeviation] => 0
[depth] => 1
)
)
参考: https://www. PHP.net/manual/en/imagick.getimagechannelstatistics。 PHP