gpt4 book ai didi

python - 来自Image的Python OpenCV cvCreateStructuringElementEx,形状为CV_SHAPE_CUSTOM

转载 作者:行者123 更新时间:2023-12-02 17:55:11 25 4
gpt4 key购买 nike

有人知道如何使用图像创建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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com