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")
#Listening to the IR sensors for input sensor1 = GPIO.input(IR1) sensor2 = GPIO.input(IR2) exitSensor = GPIO.input(exitIR) display = drivers.Lcd() # Importing LCD Drivers #pwm = GPIO.PWM(servoPin, 50) #PWM initialised at 50Hz frequency availableSlots = 0 #initialising the number of empty slots to 0 #beginning of OpenCv for License Plate recognition cap = cv2.VideoCapture(0) #Starting Video Capture #Entering The endless loop for repetitive function while (True): ret, frame = cap.read() #Read Frames plate = extraction(frame) #take a picture try: text = ocr(plate) #Do Optical Character Recognition text = ''.join(e for e in text if e.isalnum()) #Remove spaces from extracted text 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