PYTHON-OPENCV for a simple license plate location

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.