mercredi 27 novembre 2019

I need to display the output of a python function that recognizes plate number characters which runs automatically with flask framework on a web page

I need to display the output of a python function that recognizes plate number characters which runs automatically with flask framework on a web page Please, I need a solution ASAP This is the relevant part of the python function. Thanks Read the number plate

text = pytesseract.image_to_string(img, config='--psm 11')
print(text)
pattern = re.compile('\W')
text = re.sub(pattern, '', text)
print(text)
first_part = text[:3]
last_part = text[-2:]
middle_part = text[3:len(text)-2]
print(first_part)
print(middle_part)
print(last_part)
middle_part = middle_part.replace('L', '1')
middle_part = middle_part.replace('G', '6')
first_part = first_part.replace('O', 'D')
last_part = last_part.replace('4', 'A')
text = first_part + middle_part + last_part
print(text)
print("Detected Number is:",text)
conn = sqlite3.connect('cars_data.db')
cursor = conn.cursor()
query_pass = """select * from CarsInfo WHERE PlateNumber = ?"""

cursor.execute(query_pass, (text,))
record = cursor.fetchall()
cursor.close()

if record:
    print('found')
    gpio.output(32,True)
    gpio.output(36,False)
    return record
else:
    print('not found')
    gpio.output(32,False)
    gpio.output(36,True)
    return



Aucun commentaire:

Enregistrer un commentaire