我正在尝试使用Python 2.7.9中的灰度共生矩阵从图像中提取特征,我在下面的其他答案中找到了以下给出的代码。当我运行此代码时,我得到:
ImportError:未安装_imaging C模块。
然后,我安装了PIL模块,当我尝试导入其_imaging
软件包时,它又出现了另一个错误:
ImportError:DLL加载失败:%1不是有效的Win32应用程序。
我已经在互联网上进行了很多研究,但是没有给出真正可行的解决方案,例如卸载PIL和安装PILLOW并检查python版本和模块的兼容性。
import skimage.io
import skimage.feature
im = skimage.io.imread('python.jpg', as_grey=True)
im = skimage.img_as_ubyte(im)
im /= 32
g = skimage.feature.greycomatrix(im, [1], [0], levels=8, symmetric=False, normed=True)
print skimage.feature.greycoprops(g, 'contrast')[0][0]
print skimage.feature.greycoprops(g, 'energy')[0][0]
print skimage.feature.greycoprops(g, 'homogeneity')[0][0]
print skimage.feature.greycoprops(g, 'correlation')[0][0]
通过从此处安装64位PILLOW模块Pillow‑2.8.2‑cp34‑none‑win_amd64.whl解决了该问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句