导致此错误的原因:没有足够的值可解压缩

时间:2019-05-21 06:26:11

标签: python

im2, contours, hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

    contour_sizes = [(cv2.contourArea(contour), contour) for contour in contours]
    biggest_contour = max(contour_sizes, key=lambda x: x[0])[1]

    #cv2.drawContours(frame, biggest_contour, -1, (0,255,0), 3)

    x,y,w,h = cv2.boundingRect(biggest_contour)
    cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2)

    #cv2.drawContours(frame, contours, -1, (0,255,0), 3)

    #cv2.drawContours(frame, contours, 3, (0,255,0), 3)

    #cnt = contours[1]
    #cv2.drawContours(frame, [cnt], 0, (0,255,0), 3)

    # Show final output image
    cv2.imshow('colorTest', frame)

    k = cv2.waitKey(5) & 0xFF
    if k == 27:
        break
    print('fps - ', 1/(time.time() - timeCheck))

cv2.destroyAllWindows()
vidCapture.release()

0 个答案:

没有答案