python - SystemError:新样式的getargs格式,但参数不是OpenCV中的元组

标签 python opencv

我有这行使用OpenCV:

xsize = random.uniform(params['reshape_x_limits'][0],params['reshape_x_limits'][1])
ysize = random.uniform(params['reshape_x_limits'][0],params['reshape_x_limits'][1])
cv2.resize(fg,0,fg,xsize,ysize)

这给出了错误
SystemError: new style getargs format but argument is not a tuple

但是根据文档:
https://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#resize

所有参数都不应该是元组。是什么导致此错误?我正在使用Python 2.7和OpenCV 3.3.0.10。

最佳答案

从您发布的文档中,您可以在那里看到一个示例:

resize(src, dst, Size(), 0.5, 0.5, interpolation);

参数Size()是一个元组(width, length)
另一个示例,您可以find in this tutorial about geometric transformations,例如:
res = cv2.resize(img,(2*width, 2*height), interpolation = cv2.INTER_CUBIC)

关于python - SystemError:新样式的getargs格式,但参数不是OpenCV中的元组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46775284/

相关文章:

python - 在python中从返回的JSON转换unicode字符

c++ - Opencv:如何计算矩形 vector 的镜像

opencv - 半全局 block 匹配

python - 使用 Web(Html css) 和 Python 进行人脸检测

python - 在 html body 标签内添加内容

python - 如何反序列化 python 打印的字典?

python 鸡蛋缓存

ios - OpenCV 加载级联分类器 EXC_BAD_ACCESS 崩溃

opencv - 用于跟踪除 Windows Kinect 人体手势之外的其他对象的 API 可用性

python - 当子元素具有特定属性值时使用Python中的elementree xpath选择父元素