| | |
| | | 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 "@" |
| | |
| | | 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) |
| | |
| | | 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() |