License plate recognition using OPENCV's SVM and neural network (high-quality article ******)

Source: Internet
Author: User
Tags svm

This article was reproduced from: http://blog.csdn.net/ap1005834/article/details/51340831

First, preface

This article refers to the automatic license plate recognition project in the deep understanding of OPENCV practical Computer Vision Project analysis, and then carries on the practice after understanding the method. The difficulty of accurately identifying the sequence of the characters in the license plate area is to realize the exact location of the license plate area. So the final recognition effect is still to be further improved.

second, the procedure flow

The program flow is as follows:

The corresponding main function is as follows

[CPP]  View plain  copy  print? #include   "Carid_detection.h"          int main ()    {            mat img_input = imread ("testcarid.jpg");        //If read-in image fails        if (Img_input.empty ())        {           fprintf (stderr,  "Can  not load image %s\n ", " testcarid.jpg ");            return -1;       }           Mat hsvImg ;       cvtcolor (IMG_INPUT,HSVIMG,CV_BGR2HSV);        vector<Mat> planes;       split ( Hsvimg,planes);   &NBSP;&NBSP;&NBSP;&NBSP;MAT&NBSP;SIMG;&NBSP;&NBSp     simg = planes[1];  //get red component         Blur (Simg,simg,size (3,3))    //3*3 Gaussian filter        vector < rotatedrect>  rects_simg;       posdetect (SIMG&NBSP;,RECTS_SIMG);                       mat grayimg;       rgbconvtogray (img_input ,grayimg);        medianblur (grayimg,grayimg,3);    //3*3 median filter            vector <RotatedRect>  rects_grayImg;        posdetect (grayimg ,rects_grayimg);          vector < ROTATEDRECT&GT;&NBSP;&NBSP;RECTS_CLOSEIMG;&NBSP;&NBSP;//license plate area closer to        posdetect_ Closeimg (SIMG&NBSP;,RECTS_CLOSEIMG);          vector <RotatedRect>   rects_optimal;       optimposdetect (rects_simg,rects_grayimg,rects_closeimg , rects_optimal);          vector <Mat> output_area;        normalposarea (Img_input ,rects_optimal,output_area);   // Get 144*33 's candidate license plate area output_area          CvSVM  svmClassifier;                        svm_train (svmclassifier)   //use SVM to train positive and negative samples             vector<mat> plates_svm;   //need to use the candidate plate area Output_area each pixel in the image as a line feature vector, and then make predictions.        for (Int i=0;i< output_area.size ();  ++i)        {           Mat img = output_area[i];            mat p = img.reshape (;  )         p.convertto (P,CV_32FC1);            int response =  (int) svmclassifier.predict ( p );  

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.