wangzhibo
2022-03-23 69b8cbd754284a2071d06149f0c92d9fe50a744e
debug/2_check_video_digits.py
@@ -56,8 +56,8 @@
        res = cv2.matchTemplate(target_img, digitROI[0], cv2.TM_CCOEFF_NORMED)
        max_val = cv2.minMaxLoc(res)[1]
        source.append(max_val)
    # print(max(source))
    if max(source) > 0.5:
    print(max(source))
    if max(source) > 0.3:
        return digits[source.index(max(source))][1]
    else:
        return "@"
@@ -77,7 +77,7 @@
    return_numbers = []
    for c in contours:
        x, y, w, h = cv2.boundingRect(c)
        if hierarchy[0][contours_count][3] ==0 :
        if hierarchy[0][contours_count][3] ==0 and h > image_h * 0.3:
        #if image_h*0.98 > h > image_h * 0.3:
            #print((x, y, w, h))
            #cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)
@@ -127,7 +127,7 @@
        cv2.waitKey(0)
cap = cv2.VideoCapture("7122.mp4")  # for testing
cap = cv2.VideoCapture("new.mp4")  # for testing
total_frame = 0 
while(cap.isOpened()):
    ret, frame = cap.read()