import Adafruit_CharLCD as LCD
import [Link] as GPIO
import time
from openalpr import Alpr
import sys
import cv2
from datetime import datetime
import os
button = 2
[Link](button,[Link])
# Raspberry Pi pin configuration:
lcd_rs = 21 # Note this might need to be changed to 21 for older revision
Pi's.
lcd_en = 20
lcd_d4 = 16
lcd_d5 = 12
lcd_d6 = 7
lcd_d7 = 8
# Define LCD column and row size for 16x2 LCD.
lcd_columns = 16
lcd_rows = 2
lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,
lcd_columns, lcd_rows)
plate_detected = False
alpr = Alpr("eu", "/home/pi/openalpr/src/build/config/[Link]",
"/home/pi/openalpr/runtime_data")
alpr.set_top_n(20)
alpr.set_default_region("md")
reset = True
while reset == True:
lcd.set_backlight(0)
[Link]()
print "Automatic Number Plate Detection"
[Link](' Raspberry pi\n Based ')
[Link](2)
[Link]()
[Link]('Automatic Number\nPlate Detection')
[Link](3)
[Link]()
[Link]('Searching for\nCamera')
print "Searching for Camera"
[Link](2)
camera=[Link](0)
if not [Link]():
main = False
print "can't open the camera"
[Link]()
[Link]('Error:Camera not\nFound')
[Link](2)
[Link]()
[Link]('Connect Camera &\npress reset')
while [Link](button) == True:
None
else:
main = True
print "camera found"
[Link]()
[Link]('Found Camera')
[Link](2)
while True:
ret, frame = [Link]()
results = alpr.recognize_file(frame)
i = 0
for plate in results['results']:
i += 1
for candidate in plate['candidates']:
prefix = "-"
if candidate['matches_template']:
prefix = "*"
plate_detected = True
break
if plate_detected:
[Link]()
[Link]('license plate \nno. is '+ candidate['plate'] )
plate_detected = False
else:
[Link]()
[Link]('Plate not detected..')
if [Link](button) == False:
[Link]()
break