gpt4 book ai didi

python - OpenCV - python 中的 cv2.floodFill() 错误

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

我在使用 cv2.floodfill() 时遇到了这个错误:

enter image description here

我的代码:

    ormap = np.bitwise_or(label,detmap)
mask = np.zeros((image_size+2,imagesize+2),np.uint8)
for y in range(image_size):
for x in range(image_size):
if label[y,x]>0:
cv2.floodFill(ormap,mask,(y,x),0)

我试过了

  1. ormap.copy() 到一个新数组,但它不起作用
  2. 使用了 cv2.cv.fromarray() 但它显示“不支持数组类型”。

我正在使用 OpenCV 2.4.11 和 numpy 1.11.0
还有其他建议吗?

最佳答案

通过执行以下更改解决:

ormap = np.bitwise_or(label,detmap).astype(uint8)

关于python - OpenCV - python 中的 cv2.floodFill() 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37016157/

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