[Python] Use OCR to identify numbers of a water meter [closed]

Discussão em 'Python' iniciado por Stack, Novembro 22, 2024.

  1. Stack

    Stack Membro Participativo

    I have been trying to solve this problem for quite some time, I have photos of the numbers of a water meter and I would like to obtain the numbers as text using Python and OCR or OpenCV, I tried with easyocr and pytesseract but without luck, maybe I have not clean enough the image before using the OCR software.

    This is my image before modifying it:

    [​IMG]

    After "cleaning it":

    [​IMG]

    This is the code I'm using:

    import easyocr
    import os

    AnaliticDir = 'Path_To_File'

    reader = easyocr.Reader(['en'], gpu = True)

    DownloadedFiles = os.listdir(AnaliticDir)
    for i in range(len(DownloadedFiles)):
    print(DownloadedFiles)
    SRC_Image = AnaliticDir + "/" + DownloadedFiles
    result = reader.readtext(SRC_Image, allowlist='0123456789',paragraph= True,decoder= 'beamsearch',batch_size=4,text_threshold=0.9)
    for detection in result:
    print(detection[1])


    The resulting text after processing should be 0168390.

    How can I improve or change my code so the OCR works well? Maybe I can do OpenCV object recognition with every character or something like that?

    Continue reading...

Compartilhe esta Página