是否可以从PythonMagick中访问直方图(作为一个我在思考的元组?)?
#!/usr/bin/env python
import PythonMagick
img = PythonMagick.Image("c:\\temp\\temp\\sample_image.jpg")
h = img.convert().histogram() # pseudo code for the following command line:
# convert sample_image.jpg -define histogram:unique-colors=true -format %c histogram:info:
这与this问题非常相似,只是我想在Python中使用结果。我也不想依赖于将直方图写成文本文件并将其重新导入到Python中,如果不是多余的话,它似乎有点慢。