Tag:

使用Ruby和imagemagick获取或计算图像的熵

如何在Ruby中找到带有imagemagick的“entropy”,最好是mini_magic? 我需要这个作为一个更大的项目的一部分, 在图像中找到“有趣”,以便裁剪它 。 我在Python / Django中找到了一个很好的例子 ,它提供了以下伪代码: image = Image.open(‘example.png’) histogram = image.histogram() # Fetch a list of pixel counts, one for each pixel value in the source image #Normalize, or average the result. for each histogram as pixel histogram_recalc << pixel / histogram.size endfor #Place the pixels on a logarithmic scale, to enhance […]