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?

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

I mean the programming code how to create the database for example using array and function if else. by the way, thanks for your comment. but that is not I want.
Can we assume that you have your own little "test" database that you can use to look up? If so, what form does that take? Can you read it into a cell array in your program? Is it more complicated, like something you'd need the Database Toolbox for?
i think i might don't need to use the database toolbox because i just need a very simple database. for example, from the output of the number plate is CDA3946, then >>
if ('CDA3946')
{ show("driver's name"\n"phone number"\n"license ID"); } else if(other plate number)
p/s: however, the problem is i dont know how to write the code so that it can read the output text.file and put it in my if else function.. err :(
salam Ahmed. if you dont mind me asking, can you help me doing this project?
hello sir..can i please get the file for this project..thanks,,,am doing a similar project

Sign in to comment.

 Accepted Answer

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

@image Analyst ; i want to extract the the text/number from the image that i have uploaded '6.jpg'.
i try to implement stroke width transform (SWT) or OCR but i failed, can you help me by sending the m file of applying SWT to 6.jpg
OR apply any technique you want just extract the text/number from the image '6.jpg'
You should work on getting better images to start with. Can you use a profilometer to get height information directly? Or else use glancing illumination to make the shadows more contrasty. If you're stuck with those lousy photos, then try stdfilt().
ok i'll check that..... then i will talk to you fir more help later....
Thank you @image analyst
@image analyst, sir is there any command for exposure correction of an image, just like we use for contrast correction we use histeq() command.....
so which command automatically correct exposure of an image (or any related command)?
Depends on what you mean by exposure correction. You can always multiply the image by a factor, either the whole image or another image that specifies the factor for each and every pixel.
No, i have a single image not multiple image.
so, for single image how we can correct its exposure, like i have an image '6.jpg' how we can multiply the factor. kindly give me one example.
correctedImage = someFactor * yourImage;
If someFactor > 1, it will make the image brighter (more exposure). If someFactor < 1 it will make it dimmer (less exposure).
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)

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
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.

Categories

Community Treasure Hunt

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

Start Hunting!