except: continue if text != '': #If extracted text is not null print(text, end=" ") #print the license plate content = str(text) #convert text to string format ##########Email server configuration for email notifications########## sendTo = '*****@*****.**' #Receiver of email notifications emailSubject = "VEHICLE AUTHORISED!" #Email subject emailContent = "The vehicle with license number: " + content + " " + "has been granted access on:\n " + time.ctime( ) #Email Content if len( content ) >= 5: #if the length of number plate is greater than 5 letters if check_if_string_in_file( './Database/Database.txt', text): #Check if the license plate is in the Database print('Registered') #Printing on LCD display.lcd_display_string("WELCOME:", 1) display.lcd_display_string(text, 2) time.sleep(2) #If both parking lots are free if sensor1 == 1 and sensor2 == 1: availableSlots = 2 print("The Available Slots are :", availableSlots) display.lcd_display_string("AVAILABLE LOTS: ", 1) display.lcd_display_string(str(availableSlots), 2) time.sleep(3) display.lcd_display_string("AVAILABLE LOTS: ", 1) display.lcd_display_string("1:FREE - 2:FREE", 2)
import cv2 #import winsound frequency = 2500 duration = 1200 from PlateExtraction import extraction from OpticalCharacterRecognition import ocr from OpticalCharacterRecognition import check_if_string_in_file image = cv2.imread('./CarPictures/001.jpg') plate = extraction(image) cv2.imshow('frame',plate) text = ocr(plate) text = ''.join(e for e in text if e.isalnum()) print(text, end=" ") if check_if_string_in_file('./Database/Database.txt', text) and text != "": print('Registered') #winsound.Beep(frequency, duration) else: print("Not Registered")
import cv2 import winsound frequency = 2500 duration = 1000 from PlateExtraction import extraction from OpticalCharacterRecognition import ocr from OpticalCharacterRecognition import check_if_string_in_file image = cv2.imread( r'C:\Users\sonia\Desktop\AutomaticNumberPlateRecognition\CarPictures\010.jpg' ) plate = extraction(image) text = ocr(plate) text = ''.join(e for e in text if e.isalnum()) print(text, end=" ") if check_if_string_in_file( r'C:\Users\sonia\Desktop\AutomaticNumberPlateRecognition\Database\Database.txt', text) and text != "": print('Registered') winsound.Beep(frequency, duration) else: print("Not Registered")