Home > Back-end >  How to get clean output from easyocr
How to get clean output from easyocr

Time:10-18

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

CodePudding user response:

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.

  • [[0, 0], [163, 0], [163, 31], [0, 31]] -> the coordinates of the 4 corners
  • 'SPHJ > 3764' -> the text
  • 0.5565279612963627 -> 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])
  • Related