cv2.1仿射边界值规范

2024-09-28 23:30:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用带有边界值的warpAffine函数

cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR, borderMode=cv2.BORDER_CONSTANT, borderValue=(129,172,138))
他工作得很好

但这是:

color = (129,172,138)
cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR, borderMode=cv2.BORDER_CONSTANT, borderValue=color)

不起作用了。。。我得到:

{error}OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function 'warpAffine'
> Overload resolution failed:
>  - Scalar value for argument 'borderValue' is not numeric
>  - Scalar value for argument 'borderValue' is not numeric

我真的不明白。。。你能帮我吗


Tags: imageargumentcv2colorflagslinearintershape