opencv TypeError: Can‘t parse ‘center‘. Sequence item with index 0 has a wrong type

python 计算矩阵时报错,根据报错线索查看

def getRotationMatrix2D(
    center: Point2f,
    angle: float,
    scale: float)

需要Point2f类型,但是python创建不了这个类型,所以用numpy类型代替

源代码:

修改后

import cv2
import numpy as np

# 创建一个 numpy 数组来表示 Point2f 对象
point = np.array([10.5, 20.5], dtype=np.float32)
print(point)

完美运行

猜你喜欢

转载自blog.csdn.net/agoodtimeo/article/details/143280230