I do a vehicle plate recognition system. I already succeed the recognition of the number plate and the problem is, i would like to show the vehicle owner's details. Anyone can help me how to create a simple database?

7 views (last 30 days)
As you can see from the image, i already get the result of my plate number recognition. but how can to create a database, when this number same with the database it will show the details of this vehicle owner such as name, address and license ID? can u show me the simple coding to create the database? thank you
  7 Comments

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 8 Mar 2015
Let's say you have a spreadsheet with the license numbers in column 1 and the name, phone number, and some other ID number in columns 2-4. Just use xlsread() or readtable() to read in the "database", and then use ismember() to find out what row the license plate shows up in, then extract all the data about that person. Will that work? If so, attach your workbook and m-code.
  11 Comments
Rizwan Chughtai
Rizwan Chughtai on 6 Dec 2017
thank you @image Analsyt.
one more thing; can you give me the code of stroke width transform (SWT) Or any link from where i can get the code of SWT
(althogh i have some codes of SWT, downloaded from github but they are not working properly, so kindly suggest me OR send me the link of SWT code.)

Sign in to comment.

More Answers (2)

Ahmed
Ahmed on 24 Mar 2015
sorry i havent read your comment last week. I will send to you straight away. but i dnt think it will work. u need some alteration and the image of the number plate of course, only Malaysia license Plate is able to recognize by using this algorithm.
p/s : try use the picture above. but im not sure for the recognition. u need the OCR template. ok, good luck

Muhd Rosli
Muhd Rosli on 5 Dec 2016
Assalamualaikum.. I'm Muhammad Aqil Bin Mohamad Rosli, final year student at University Tun Hussein Onn Malaysia. Im doing vehicle number plate recognition system for my final project and im new to matlab. I already succeed using python language but it seem it cannot recognise the real alphabet. below is my coding using python language. The result of the picture is:
  1. Main.py
import cv2 import numpy as np import os
import DetectChars import DetectPlates import PossiblePlate
  1. module level variables ##########################################################################SCALAR_BLACK = (0.0, 0.0, 0.0)SCALAR_WHITE = (255.0, 255.0, 255.0)SCALAR_YELLOW = (0.0, 255.0, 255.0)SCALAR_GREEN = (0.0, 255.0, 0.0)SCALAR_RED = (0.0, 0.0, 255.0)
showSteps = False
################################################################################################### def main():
blnKNNTrainingSuccessful = DetectChars.loadKNNDataAndTrainKNN() # attempt KNN training
if blnKNNTrainingSuccessful == False: # if KNN training was not successful
print "\nerror: KNN traning was not successful\n" # show error message
return # and exit program
# end if
imgOriginalScene = cv2.imread("19.jpg") # open image
if imgOriginalScene is None: # if image was not read successfully
print "\nerror: image not read from file \n\n" # print error message to std out
os.system("pause") # pause so user can see error message
return # and exit program
# end if
listOfPossiblePlates = DetectPlates.detectPlatesInScene(imgOriginalScene) # detect plates
listOfPossiblePlates = DetectChars.detectCharsInPlates(listOfPossiblePlates) # detect chars in plates
cv2.imshow("imgOriginalScene", imgOriginalScene) # show scene image
if len(listOfPossiblePlates) == 0: # if no plates were found
print "\nno license plates were detected\n" # inform user no plates were found
else: # else
# if we get in here list of possible plates has at least one plate
# sort the list of possible plates in DESCENDING order (most number of chars to least number of chars)
listOfPossiblePlates.sort(key = lambda possiblePlate: len(possiblePlate.strChars), reverse = True)
# suppose the plate with the most recognized chars (the first plate in sorted by string length descending order) is the actual plate
licPlate = listOfPossiblePlates[0]
cv2.imshow("imgPlate", licPlate.imgPlate) # show crop of plate and threshold of plate
cv2.imshow("imgThresh", licPlate.imgThresh)
if len(licPlate.strChars) == 0: # if no chars were found in the plate
print "\nno characters were detected\n\n" # show message
return # and exit program
# end if
drawRedRectangleAroundPlate(imgOriginalScene, licPlate) # draw red rectangle around plate
print "\nlicense plate read from image = " + licPlate.strChars + "\n" # write license plate text to std out
print "----------------------------------------"
writeLicensePlateCharsOnImage(imgOriginalScene, licPlate) # write license plate text on the image
cv2.imshow("imgOriginalScene", imgOriginalScene) # re-show scene image
cv2.imwrite("imgOriginalScene.png", imgOriginalScene) # write image out to file
# end if else
cv2.waitKey(0) # hold windows open until user presses a key
return
# end main
################################################################################################### def drawRedRectangleAroundPlate(imgOriginalScene, licPlate):
p2fRectPoints = cv2.boxPoints(licPlate.rrLocationOfPlateInScene) # get 4 vertices of rotated rect
cv2.line(imgOriginalScene, tuple(p2fRectPoints[0]), tuple(p2fRectPoints[1]), SCALAR_RED, 2) # draw 4 red lines
cv2.line(imgOriginalScene, tuple(p2fRectPoints[1]), tuple(p2fRectPoints[2]), SCALAR_RED, 2)
cv2.line(imgOriginalScene, tuple(p2fRectPoints[2]), tuple(p2fRectPoints[3]), SCALAR_RED, 2)
cv2.line(imgOriginalScene, tuple(p2fRectPoints[3]), tuple(p2fRectPoints[0]), SCALAR_RED, 2)
# end function
################################################################################################### def writeLicensePlateCharsOnImage(imgOriginalScene, licPlate): ptCenterOfTextAreaX = 0 # this will be the center of the area the text will be written to ptCenterOfTextAreaY = 0
ptLowerLeftTextOriginX = 0 # this will be the bottom left of the area that the text will be written to
ptLowerLeftTextOriginY = 0
sceneHeight, sceneWidth, sceneNumChannels = imgOriginalScene.shape
plateHeight, plateWidth, plateNumChannels = licPlate.imgPlate.shape
intFontFace = cv2.FONT_HERSHEY_SIMPLEX # choose a plain jane font
fltFontScale = float(plateHeight) / 30.0 # base font scale on height of plate area
intFontThickness = int(round(fltFontScale * 1.5)) # base font thickness on font scale
textSize, baseline = cv2.getTextSize(licPlate.strChars, intFontFace, fltFontScale, intFontThickness) # call getTextSize
# unpack roatated rect into center point, width and height, and angle
( (intPlateCenterX, intPlateCenterY), (intPlateWidth, intPlateHeight), fltCorrectionAngleInDeg ) = licPlate.rrLocationOfPlateInScene
intPlateCenterX = int(intPlateCenterX) # make sure center is an integer
intPlateCenterY = int(intPlateCenterY)
ptCenterOfTextAreaX = int(intPlateCenterX) # the horizontal location of the text area is the same as the plate
if intPlateCenterY < (sceneHeight * 0.75): # if the license plate is in the upper 3/4 of the image
ptCenterOfTextAreaY = int(round(intPlateCenterY)) + int(round(plateHeight * 1.6)) # write the chars in below the plate
else: # else if the license plate is in the lower 1/4 of the image
ptCenterOfTextAreaY = int(round(intPlateCenterY)) - int(round(plateHeight * 1.6)) # write the chars in above the plate
# end if
textSizeWidth, textSizeHeight = textSize # unpack text size width and height
ptLowerLeftTextOriginX = int(ptCenterOfTextAreaX - (textSizeWidth / 2)) # calculate the lower left origin of the text area
ptLowerLeftTextOriginY = int(ptCenterOfTextAreaY + (textSizeHeight / 2)) # based on the text area center, width, and height
# write the text on the image
cv2.putText(imgOriginalScene, licPlate.strChars, (ptLowerLeftTextOriginX, ptLowerLeftTextOriginY), intFontFace, fltFontScale, SCALAR_YELLOW, intFontThickness)
# end function
################################################################################################### if _name_ == "__main__": main()
</matlabcentral/answers/uploaded_files/64769/python.png> as we can see in the image, the until the threshold, the alphabet recognition is correct but the final answer is in correct. Only united State number plate it can recognise. I am understand this is using python and i dont try yet using matlab. Please teach me how to do it.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!