使用python opencv库自适应阈值误差

问题描述

我处于 cv2.THRESH_TRUNC 非常适合我的情况,我想应用为自适应阈值,但我面临未知错误。这是我的基本代码:

from PIL import Image
import pytesseract
import cv2

image = cv2.imread("/home/anees/Desktop/passport.png",0)
thresh =cv2.adaptiveThreshold(image,170,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_TRUNC,3,5)

我得到的错误如下:

openCV(4.5.2) /tmp/pip-req-build-yw7uvgqm/opencv/modules/imgproc/src/thresh.cpp:1723: error: (-206:Bad flag (parameter or structure field)) Unknown/unsupported threshold type in function 'adaptiveThreshold'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)