FindContours support only 8uC1 and 32sC1 images

后端 未结 4 1123
独厮守ぢ
独厮守ぢ 2021-02-14 05:42

i hava problem in fire detection my code is :

ret, frame = cap.read()
lab_image = cv2.cvtColor(frame, cv2.COLOR_BGR2LAB)
L , a , b = cv2.split(lab_image)
ret,t         


        
4条回答
  •  你的背包
    2021-02-14 06:02

    In my solution I had to convert the dtype into uint8.

    Yes, my image was binary image(single channel), however in my code somehow the thresh_image was changed into float32 data type. But cv2.findContours() cannot handle float32.

    So I had to explicitly convert float32 --> uint8.

    thresh_image = thresh_image.astype(np.uint8)
    

提交回复
热议问题