Add a blank prototype which invalidates the odo if matched

pull/361/head
Mike Lang 1 year ago
parent 19f169e750
commit 907d1ba6f9

@ -164,6 +164,10 @@ def recognize_odometer(prototypes, frame):
odo = extract_odo(frame)
digits = extract_digits(odo, include_last=False)
digits = [recognize_digit(prototypes, digit) for digit in digits]
# If any digit is None, report whole thing as None. Otherwise, calculate the number.
if any(digit is None for digit, _, _ in digits):
value = None
else:
value = sum(digit * 10.**i for i, (digit, _, _) in enumerate(digits[::-1]))
# Use average score of digits as frame score
score = sum(score for _, score, _ in digits) / len(digits)

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 B

Loading…
Cancel
Save