首页 > 解决方案 > Python错误:SystemError:新样式getargs格式但参数不是元组

问题描述

我正在尝试运行这段代码(我没有这样做),但它抛出了这个错误,我不知道,有什么建议吗?

inFloor = np.array([cv.pointPolygonTest(floorPoly_m, pt, False) for pt in self.xyz[:,:2]]) >= 0

错误:SystemError:新样式 getargs 格式但参数不是元组

显然错误出现在 pointPolygonTest 函数的第一个参数中,但该参数是这个数组,

[[7.177778 1.4777777]

[6.711111 1.7333333]

[6.388889 1.2333333]

[6.8444443 0.62222224]]

我试图将它转换为元组,但这个函数只接受数组..这对我来说很困惑

完整的错误输出在这里:

 File "/home/rsc/Desktop/GUI1_b/install/livox_detection/lib/python3.8/site-packages/livox_detection/pointCloudLib.py", line 419, in topView_measure
    inFloor = np.array([cv.pointPolygonTest(floorPoly_m, pt, False) for pt in self.xyz[:,:2]]) >= 0
  File "/home/rsc/Desktop/GUI1_b/install/livox_detection/lib/python3.8/site-packages/livox_detection/pointCloudLib.py", line 419, in <listcomp>
    inFloor = np.array([cv.pointPolygonTest(floorPoly_m, pt, False) for pt in self.xyz[:,:2]]) >= 0
SystemError: new style getargs format but argument is not a tuple

标签: pythonnumpyopencv

解决方案


通过更新opencv库解决:

pip3 install opencv-python --upgrade

推荐阅读