Tag:-O cal use simple col ade margin pen span
Principle of license plate location: 78705662
Well-trained classifier: Https://github.com/zeusees/HyperLPR/tree/master/model
The open source project also has a full license plate recognition code.
Here is simply based on the project training a good classifier to achieve the license plate positioning, the core code is also reference to this project.
Code:
ImportCv2#using a classifier that HYPERLPR has trained.Watch_cascade = Cv2. Cascadeclassifier ('./cascade.xml')#read the picture firstImage = Cv2.imread ("1.jpg") Resize_h= 1000Height=Image.shape[0]scale= image.shape[1]/float (image.shape[0]) image= Cv2.resize (image, (int (scale*resize_h), Resize_h) Image_gray=Cv2.cvtcolor (image, Cv2. Color_rgb2gray) Watches= Watch_cascade.detectmultiscale (Image_gray, 1.1, 2, minsize= (9), maxsize= (36*40, 9*40))Print("the number of license plates detected", Len (watches)) for(x, Y, W, h)inchWatches:cv2.rectangle (image, (x, y), (x+ W, y + h), (0, 0, 255), 1) Cv2.imshow ("Image", image) Cv2.waitkey (0) cv2.destroyallwindows ()
Results:
PYTHON-OPENCV for a simple license plate location