具有像素 randomness/irregularities 的 RGB 图像的图像参数(标准差、均值和熵)

Image Parameters (Standard Deviation, Mean and Entropy) of an RGB Image with pixel randomness/irregularities

我偶然发现了一些关于如何使用 matlab 获取 RGB 图像的熵的很好的解释。 Matlab 提供了一个内置函数,允许使用 -sum(p.*log2(p)) 获取灰度图像的熵。一个答案提供了一种如何获取此 link --->

中给出的 rgb 图像的熵的方法

Matlab 如何解释函数:

E = entropy(I) returns E, a scalar value representing the entropy of grayscale image I. Entropy is a statistical measure of randomness that can be used to characterize the texture of the input image.

Entropy is defined as -sum(p.*log2(p))

where p contains the histogram counts returned from imhist. By default, entropy uses two bins for logical arrays and 256 bins for uint8, uint16, or double arrays.

I can be a multidimensional image. If I has more than two dimensions, the entropy function treats it as a multidimensional grayscale image and not as an RGB image.

问题:

熵是否考虑或检测图像不规则性?例如,如果变量 A 包含 IMAGE AA 的熵,而变量 B 包含 Alter(IMAGE AA) 的熵。其中 Alter 是交换图像内随机像素的函数。变量A和变量B是否包含熵值?鉴于两个图像包含相同的像素,但仅在图像中的位置不同。我需要澄清一下,因为我是这个话题的新手,

熵是否需要考虑图像的不规则性,为什么? 我需要什么熵实现来覆盖图像不规则性? 它是否可以作为 python 或其他图像处理程序中的内置函数使用?

不确定 "irregularity" 是什么意思,但我可以证明当您使用 ImageMagick 旋转图像、水平或垂直翻转图像时,熵不会发生变化,因此,交换像素并不重要:

# Check entropy of image
convert image.png -print '%[entropy]' null:
0.89247

# Rotate 90 degrees and check - still same
convert image.png -rotate 90 -print '%[entropy]' null:
0.89247

# Rotate 270 degrees and check - still same
convert image.png -rotate 270 -print '%[entropy]' null:
0.89247

# Flip image and check - still same
convert image.png -flip -print '%[entropy]' null:
0.89247

# Flop image and check - still same
convert image.png -flop -print '%[entropy]' null:
0.89247

您可以一次性检查标准差、均值和熵:

 convert image.png -rotate 90 -verbose +identify null: | grep -Ei "entropy|deviation|mean" | tail -3
  image.png=> PNG 70x46=>46x70 46x70+0+0 8-bit sRGB 0.000u 0:00.000
  mean: 105.147 (0.412341)
  standard deviation: 59.4199 (0.233019)
  entropy: 0.89247

matlab 中有默认函数用于计算熵。

试试

I=imread('image name');
entropy(I)