python - 来自Image的Python OpenCV cvCreateStructuring

有人知道如何使用图像创建cvCreateStructuringElementEx吗?
我正在尝试使用opencv.cv.cvCreateStructuringElementEx()
我的结构是bmp 160x120,黑色,白色的椭圆形。

im = Image.open("struture.jpeg", "r")
im = im.convert("1")
val = numpy.uint(im.getdata())
gim = opencv.cv.cvCreateStructuringElementEx(im.size[0], im.size[1], im.size[0]/2, im.size[1]/2, opencv.cv.CV_SHAPE_CUSTOM, val)

因此返回错误:
TypeError: in method 'cvCreateStructuringElementEx', argument 6 of type 'int *'

最佳答案

这可能解决了您的问题:

int val[9]={0,1,0,1,1,1,0,1,0};

关于python - 来自Image的Python OpenCV cvCreateStructuringElementEx,形状为CV_SHAPE_CUSTOM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6990740/

相关文章:

docker - 与 WORKDIR 相关的映射卷

opencv - 段错误 OpenCV/Facedetect.c/CentOS 6 64Bit

vb.net - 如何从VB.net轻松调用IronPython函数?

opencv - 检测器->检测(img,关键点);错误

image-processing - 以下用于图像调整大小的 c++ 双三次插值代码有什么问题

python - 无法在 OpenCV2.1 上导入 cv

docker - chown : changing ownership of '/var/lib/m

exception - openNI干扰cvCreateCameraCapture()

opencv - OpenCV-CirclesGridFinder的文档

visual-studio-2010 - 如何在VS2010 Windows 7中安装tbb_ded