简体   繁体   English

计算灰度图像的偏度和峰度

[英]Calculate skewness and Kurtosis of a grayscale image

Is it possible to calculate the skewness and kurtosis of a grayscale image just using the functions是否可以仅使用函数来计算灰度图像的偏度和峰度

scipy.stats.kurtosis 
scipy.stats.skew

When I applied it showed an array and not a single value.当我应用它时,它显示了一个数组而不是单个值。 Is that correct?那是对的吗?

For grayscale image use this code:对于灰度图像,请使用以下代码:

from skimage import color
from skimage import io

im = color.rgb2gray(io.imread('Grayscale_image.png'))

from scipy.stats import skew, kurtosis

skew(im.reshape(-1))
kurtosis(im.reshape(-1))

if I understood you, this code is for calculate skewness and kurtosis for one of the colors:如果我理解你,这段代码用于计算其中一种颜色的偏度和峰度:

import scipy
import cv2

im = cv2.imread("image.jpg")

from scipy.stats import skew, kurtosis

colon_number = 0

print(skew(im.reshape(-1,3)[:,colon_number]))
print(kurtosis(im.reshape(-1,3)[:,colon_number]))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM