Result analysis

When we run our code using the best candidate code block, we get the following result:

if len(plate_candidates) > 0:     plate_candidates.sort(key = lambda plate_candidate:                           len(plate_candidate.chars), reverse = True)    best_plate = plate_candidates[0]    print("License plate read: " + best_plate.chars + "\n")License plate read: LTLDBENZ

Once we get our output, we can display our result using the following code:

figure()imshow(best_plate.thesholded)

The displayed image will be as follows:

Although there is an extra character, we can see that our displayed image is very close to the plate characters. We can, check it with our other ...

Get Computer Vision Projects with OpenCV and Python 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.