FindContours unterstützt nur 8uC1- und 32sC1-Bilder

ch habe ein Problem mit der Branderkennung. Mein Code lautet:

ret, frame = cap.read()
lab_image = cv2.cvtColor(frame, cv2.COLOR_BGR2LAB)
L , a , b = cv2.split(lab_image)
ret,thresh_L = cv2.threshold(L,70,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
ret,thresh_a = cv2.threshold(a,70,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
ret,thresh_b = cv2.threshold(b,70,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
thresh_image = cv2.merge((thresh_L, thresh_a, thresh_b))
dilation = cv2.dilate(thresh_image, None, iterations=2)
gray = cv2.cvtColor(thresh_image,cv2.COLOR_
(cnts, _) = cv2.findContours(dilation.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
for c in cnts:
    if cv2.contourArea(c) < args["min_area"]:
        continue
    (x,y,w,h) = cv2.boundingRecy(c)
    cv2.rectangle(frame,(x,y),(x+w, y+h), (0,255,0), 2)

cv2.imshow('frame1',frame)

und wenn ich dieses Programm starte, sehe ich diesen Fehler

FindContours support only 8uC1 and 32sC1 images in function cvStartFindContours

Bitte hilf mir . tnx

Antworten auf die Frage(6)

Ihre Antwort auf die Frage