我有一个4d数组,例如,一个[0]看起来像这样:
array([[[135, 105, 95],
[109, 78, 60],
[101, 78, 54],
...,
[ 32, 21, 22],
[ 32, 21, 23],
[ 35, 28, 31]],
[[144, 119, 107],
[117, 87, 68],
[115, 94, 74],
...,
[ 32, 21, 22],
[ 33, 22, 24],
[ 33, 22, 26]],
[[145, 127, 113],
[140, 116, 102],
[128, 104, 87],
...,
[ 29, 22, 20],
[ 28, 21, 19],
[ 33, 23, 20]],
...,
[[105, 70, 62],
[109, 81, 75],
[142, 123, 117],
...,
[ 52, 41, 39],
[ 62, 49, 47],
[ 52, 38, 33]],
[[ 90, 55, 50],
[ 96, 67, 65],
[133, 111, 108],
...,
[ 45, 37, 34],
[ 48, 36, 32],
[ 48, 37, 30]],
[[129, 111, 106],
[124, 103, 101],
[116, 94, 90],
...,
[ 50, 40, 35],
[ 53, 39, 35],
[ 48, 37, 32]]], dtype=uint8)
阵列的4d阵列中的每个阵列表示一个图像(像素(。我想通过使用循环来计算4d阵列中每个阵列的峰度。那么,有人能帮我吗?提前感谢的帮助
如果没有示例,您可以尝试类似的东西:
from scipy.stats import kurtosis
k = []
for elem in a:
k.append(kurtosis(elem))
这将输出一个数组。如果要输出单个数字,则在调用kurtosis()
时应设置axis=None
。