pythonopencvautomatic-license-plate-recognition

How to get clean output from easyocr


This is from a opencv+easyocr number plate recognition script opencv crops the image to number plate and gives,clean great output to the easyocr. but what are these bunch of numbers its reading

result = reader.readtext(opencv(mypath))

Result: [([[0, 0], [163, 0], [163, 31], [0, 31]], 'SPHJ > 3764', 0.5565279612963627)]

I know I can get a clean output by this but the thing is it differs from a picture to picture. is there any way only to get the number plate

result = result[0][-2]

Result: SPHJ > 3764


Solution

  • As stated in the docs:

    The output will be in a list format, each item represents a bounding box, the text detected and confident level, respectively.

    It's the coordinates of the box where the text is located. And the last item is the confidence level.

    Just use result[0][1] to get the text. Note, result may have multiple text boxes detect, so you need to access by index or iterate over it.

    for item in result:
        print(item[1])