【发布时间】:2016-09-23 10:26:48
【问题描述】:
我正在使用 python 2.7 和 opencv。
我正在尝试使用:
cv2.resize(src, dst, Size(), 0.5, 0.5, interpolation=cv2.INTER_LINEAR);
取自here。但是当我运行这段代码时,我得到NameError: global name 'Size' is not defined.
你能帮帮我吗?
【问题讨论】:
-
您需要向
Size:cv2.resize(src, dst, Size(100,100), 0.5, 0.5, interpolation=cv2.INTER_LINEAR);提供目标大小参数 -
@EdChum 但在文档中它说
// specify fx and fy and let the function compute the destination image size. -
是的,我刚刚意识到你应该使用 python 签名:
cv2.resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) → dst请参阅下面 Zdar 的答案
标签: python python-2.7 opencv