cv2。ml.KNearest_创建()给出AttributeError:“module”对象没有属性“ml”

2024-04-24 16:44:33 发布

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

我在Raspberry Pi中运行一个Python程序,我把它放在了.bashrc中,但是在启动时,OpenCV代码片段包含的文件没有加载,但是正常的Python程序正在运行,我在这个算法上使用KNN(K最近邻),我得到了以下错误。在

Traceback (most recent call last):
File "Desktop/carPlate/main.py", line 15, in <module>
import DetectChars
File "/home/pi/Desktop/carPlate/DetectChars.py", line 11, in <module>
kNearest = cv2.ml.KNearest_create()
AttributeError: 'module' object has no attribute 'ml'

Tags: 代码inpy程序linepiopencvml