gpt4 book ai didi

python - 自适应阈值断言错误 OpenCV Python

转载 作者:太空宇宙 更新时间:2023-11-03 22:19:12 24 4
gpt4 key购买 nike

<分区>

在 python opencv 中使用自适应阈值时出现以下错误。我已成功将 RGB 图像转换为灰度图像,但自适应阈值仍然不起作用

代码:

gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
thresh = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 3, 1)

错误:

cv2.error: OpenCV(3.4.2) D:\Build\OpenCV\opencv-3.4.2\modules\imgproc\src\thresh.cpp:1524: error: (-215:Assertion failed) src.type() == (((0) & ((1 << 3) - 1)) + (((1)-1) << 3)) in function 'cv::adaptiveThreshold'

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com