CN116863458A - License plate recognition method, device, system and storage medium - Google Patents
License plate recognition method, device, system and storage medium Download PDFInfo
- Publication number
- CN116863458A CN116863458A CN202310875024.0A CN202310875024A CN116863458A CN 116863458 A CN116863458 A CN 116863458A CN 202310875024 A CN202310875024 A CN 202310875024A CN 116863458 A CN116863458 A CN 116863458A
- Authority
- CN
- China
- Prior art keywords
- license plate
- image
- character
- vehicle
- region
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000012545 processing Methods 0.000 claims abstract description 66
- 238000000605 extraction Methods 0.000 claims abstract description 20
- 238000012163 sequencing technique Methods 0.000 claims abstract description 10
- 238000004590 computer program Methods 0.000 claims description 8
- 238000010606 normalization Methods 0.000 claims description 7
- 238000012216 screening Methods 0.000 claims description 5
- 238000003709 image segmentation Methods 0.000 claims description 4
- 238000012935 Averaging Methods 0.000 claims description 3
- 230000000694 effects Effects 0.000 description 8
- 238000004458 analytical method Methods 0.000 description 6
- 238000010801 machine learning Methods 0.000 description 6
- 239000011159 matrix material Substances 0.000 description 5
- 238000005260 corrosion Methods 0.000 description 4
- 230000007797 corrosion Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 238000006243 chemical reaction Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000011218 segmentation Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000012937 correction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/60—Type of objects
- G06V20/62—Text, e.g. of license plates, overlay texts or captions on TV images
- G06V20/625—License plates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/40—Scenes; Scene-specific elements in video content
- G06V20/41—Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/14—Image acquisition
- G06V30/1444—Selective acquisition, locating or processing of specific regions, e.g. highlighted text, fiducial marks or predetermined fields
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/14—Image acquisition
- G06V30/148—Segmentation of character regions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/16—Image preprocessing
- G06V30/162—Quantising the image signal
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/19—Recognition using electronic means
- G06V30/19007—Matching; Proximity measures
- G06V30/19013—Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Traffic Control Systems (AREA)
Abstract
The application relates to a license plate recognition method, a device, a system and a storage medium, wherein the method is applied to a client and comprises the following steps: acquiring a front view image of a vehicle to be identified, and carrying out graying treatment on the front view image of the vehicle to be identified; carrying out region extraction on the vehicle front view image subjected to the graying treatment to obtain each vehicle image region and region characteristic parameters, and determining a license plate image region; performing binarization processing on the license plate image area, projecting the license plate image area subjected to the binarization processing, removing license plate frames, and dividing the license plate image area to obtain various license plate character images; normalizing each license plate character image to obtain each normalized license plate character image; template matching is carried out on each normalized license plate character image, and matching characters of each license plate character are output; and sequencing the matched characters of each license plate character according to the corresponding license plate characters to obtain the identified license plate number.
Description
Technical Field
The present application relates to the field of image recognition technologies, and in particular, to a license plate recognition method, device, system, and storage medium.
Background
With the increasing of motor vehicles and the increasing of traffic pressure, license plate recognition technology is one of the important ways of improving vehicle management efficiency, is widely applied to automatic supervision of parking lot charging, traffic flow control, vehicle positioning, expressway overspeed detection and the like, and is an important component of modern intelligent traffic.
In the prior art, a license plate region in a vehicle picture is generally identified based on a machine learning algorithm to obtain a license plate region image, the license plate region image is input into a pre-trained machine learning model, character recognition is performed on the license plate region, and character content of a license plate is obtained.
However, the characters of the license plate region image are recognized by a machine learning method, so that the recognition speed is low, the recognition is easily affected by other factors in a picture, and the recognition accuracy is reduced.
Disclosure of Invention
The application provides a license plate recognition method, device and system, a storage medium and a computer program product, which are used for solving the problems of low recognition speed and low recognition accuracy in the license plate recognition process in the prior art.
In a first aspect, the present application provides a license plate recognition method, including:
Acquiring a front view image of a vehicle to be identified, and carrying out graying treatment on the front view image of the vehicle to be identified to obtain a vehicle front view image after graying treatment;
carrying out region extraction on the vehicle front view image subjected to the graying treatment to obtain each vehicle image region and region characteristic parameters, and determining a license plate image region according to the region characteristic parameters of each vehicle region;
performing binarization processing on the license plate image area to obtain a license plate image area after the binarization processing;
projecting the binarized license plate image area, removing license plate frames, and dividing the license plate image area to obtain various license plate character images;
normalizing each license plate character image to obtain each normalized license plate character image;
template matching is carried out on each normalized license plate character image, and matching characters of each license plate character are output;
and sequencing the matched characters of each license plate character according to the corresponding license plate characters to obtain the identified license plate number.
Optionally, region extraction is performed on the vehicle front view image after the graying treatment to obtain each vehicle image region and region feature parameters, and the license plate image region is determined according to the region feature parameters of each vehicle region, including: performing open-close operation on the vehicle front view image subjected to the graying treatment to obtain a front view image of the vehicle subjected to the open-close operation treatment; extracting a closed area from the front view image of the vehicle after the opening and closing operation processing to obtain each vehicle image area; screening rectangular areas in each vehicle image area, and calculating area characteristic parameters of each rectangular area; and comparing the rectangular region with a preset value, and determining a rectangular region with the regional characteristic parameter within an error range as a license plate regional image.
Optionally, projecting the license plate image area after binarization processing, removing a license plate frame, and dividing the license plate image area to obtain each license plate character image, including: performing transverse projection on the binarized license plate image area, counting pixel values in the vertical direction, and removing the longitudinal frames according to the pixel values in the vertical direction to obtain a binarized license plate image area without the longitudinal frames; performing longitudinal projection on the license plate image area subjected to binarization processing without a longitudinal frame, counting pixel values in the horizontal direction, and removing the transverse frame according to the pixel values in the horizontal direction to obtain the license plate image area subjected to binarization processing without a frame; and carrying out transverse projection on the license plate image area subjected to the frame-free binarization processing, counting pixel values in the vertical direction, and carrying out image segmentation according to the pixel values in the vertical direction to obtain each license plate character image.
Optionally, normalizing each license plate character image to obtain each normalized license plate character image, including: dividing each license plate character image into a preset number of sub-areas; counting the total number of character points and the number of black character points in each sub-area, and determining the duty ratio of the black character points according to the total number of character points and the number of black character points; and aiming at each subarea, if the duty ratio of the black character point in the subarea exceeds a preset threshold, converting the subarea into a black pixel point, otherwise, converting the subarea into a white pixel point, and obtaining a normalized license plate character image with a fixed pixel size.
Optionally, performing template matching on each normalized license plate character image, and outputting matching characters of each license plate character, including: extracting the characteristic quantity of each normalized license plate character image and the characteristic quantity of each template character; calculating the cross-correlation quantity of the characteristic quantity of the normalized license plate character image and the characteristic quantity of each template character aiming at the characteristic quantity of each normalized license plate character image; and taking the template character corresponding to the maximum cross correlation as a character matching result of the normalized license plate character image, and outputting the matching character of the license plate character.
Optionally, performing binarization processing on the license plate image area to obtain a license plate image area after binarization processing, including: acquiring the gray value of each pixel point in the license plate image area, and averaging the gray values of all the pixel points to obtain the average gray average value of the license plate image area; and taking the average gray value as a binarization threshold of the license plate image area, and performing binarization processing on the license plate image area to obtain the license plate image area after the binarization processing.
Optionally, acquiring a front view image of the vehicle to be identified includes: acquiring a video stream of a vehicle to be identified, which is uploaded by a camera; acquiring a vehicle target in a video stream of a vehicle to be identified; and cutting out an image frame containing the front image according to the change of the vehicle target to obtain the front image of the vehicle to be identified.
In a second aspect, the present application provides a license plate recognition device comprising:
the acquisition module is used for extracting and acquiring a front view image of the vehicle to be identified, and carrying out grey-scale treatment on the front view image of the vehicle to be identified to obtain a front view image of the vehicle after the grey-scale treatment;
the extraction module is used for extracting the region of the vehicle front view image subjected to the grey treatment to obtain each vehicle image region and region characteristic parameters, and determining a license plate image region according to the region characteristic parameters of each vehicle region;
the binarization module is used for extracting and carrying out binarization processing on the license plate image area to obtain a license plate image area after the binarization processing;
the projection module is used for extracting and projecting the license plate image area after the binarization treatment, removing license plate frames, and dividing the license plate image area to obtain various license plate character images;
the normalization module is used for extracting and normalizing each license plate character image to obtain each normalized license plate character image;
the matching module is used for extracting and carrying out template matching on each normalized license plate character image and outputting matching characters of each license plate character;
the sequencing module is used for extracting and sequencing the matched characters of each license plate character according to the corresponding license plate characters to obtain the identified license plate number.
In a third aspect, the present application provides a license plate recognition system comprising: the system comprises a camera and a server;
the camera is used for collecting images of the vehicle to be identified;
the server is used for identifying the license plate of the vehicle to be identified, and comprises: at least one processor and memory;
the memory stores computer-executable instructions;
at least one processor executes computer-executable instructions stored in a memory, causing the at least one processor to perform the license plate recognition method as in any one of the first aspects.
In a fourth aspect, a computer storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the license plate recognition method of any one of the first aspects.
In a fifth aspect, the present application provides a computer program product comprising: a computer program; the computer program, when executed by a processor, implements the license plate recognition method of any one of the first aspects.
The application provides a license plate recognition method, which comprises the steps of carrying out region extraction and analysis of region characteristic parameters through a vehicle image to obtain a license plate region image, dividing characters in the license plate region image, removing frames of a vehicle to obtain single characters, and recognizing the single characters one by one through a template matching method to obtain all contents of a license plate. The method has the advantages that the vehicle frame is removed, the interference of the vehicle frame is reduced, the recognition accuracy is improved, the single license plate character is recognized through template matching, the recognition difficulty is reduced, the recognition speed is improved, meanwhile, the image of the license plate is rapidly extracted by adopting a mode of regional characteristic parameter analysis, and the license plate recognition speed is further improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions of the prior art, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it will be obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort to a person skilled in the art.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
FIG. 2 is a flowchart of a license plate recognition method according to an embodiment of the present application;
FIG. 3 is a flowchart of a license plate recognition method according to an embodiment of the present application;
FIG. 4 is a license plate gray scale image and a binarized image according to an embodiment of the present application;
FIG. 5 is a segmented image of a license plate binarized image according to an embodiment of the present application;
FIG. 6 is a normalized license plate character image according to one embodiment of the present application;
fig. 7 is a schematic structural diagram of a license plate recognition device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It will be apparent that the described embodiments are some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In addition, the term "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In this context, unless otherwise specified, the term "/" generally indicates that the associated object is an "or" relationship.
Embodiments of the application are described in further detail below with reference to the drawings.
In the prior art, firstly, a vehicle image is input into a trained machine learning model for recognizing a license plate region, a license plate region image is obtained through recognition, then, the license plate region image is input into a pre-trained machine learning model for recognizing license plate characters, character recognition is carried out on the license plate region, and character content of a license plate is obtained.
In order to solve the problems in the prior art, the application provides a license plate recognition method, which is used for extracting areas of a vehicle image, determining license plate image areas, dividing the license plate image areas to obtain license plate characters, and finally carrying out template matching on each character obtained by dividing to obtain a license plate recognition result.
Referring to fig. 1, fig. 1 is a schematic view of an application scenario provided by the present application. As shown in fig. 1, includes: the vehicle license plate recognition system comprises a camera 101 and a server 102, wherein the camera 101 is used for acquiring a video stream of a vehicle image, sending the video stream to the server 102 for license plate recognition, and the server 102 is used for obtaining the vehicle license plate through extraction and analysis of the video stream acquired by the camera 101. Reference may be made to the following examples for specific implementation.
Referring to fig. 2, fig. 2 is a schematic flow chart of a license plate recognition method according to an embodiment of the present application, and the execution subject of the embodiment may be the server in the embodiment shown in fig. 1, which is not particularly limited herein. As shown in fig. 2, the method includes:
s201: acquiring a front view image of a vehicle to be identified, and carrying out graying treatment on the front view image of the vehicle to be identified to obtain a vehicle front view image after graying treatment.
Wherein the front view image of the vehicle to be identified comprises a front view and a rear view; graying is an image processing technique that converts color images into gray scale images.
Specifically, a video stream of a vehicle to be identified, which is uploaded by a camera, is obtained; acquiring a vehicle target in a video stream of a vehicle to be identified; intercepting an image frame containing a front image according to the change of a vehicle target to obtain a front image of the vehicle to be identified; the values of the red, green and blue channels of each pixel in the front view image of the vehicle to be identified are synthesized according to a certain proportion, so that the front view image of the vehicle to be identified is changed into black and white or gray tone.
Further, acquiring a video stream of the vehicle to be identified, which is uploaded by the camera; comparing the changes of preset frame numbers of image frames in the video stream to obtain a maximum dynamic target in the video stream, and determining the maximum dynamic target as a vehicle to be identified; calculating the area of the largest dynamic target, determining the current frame as a front image frame of the vehicle to be identified when the area of the largest dynamic target reaches the minimum, and intercepting the image frame to obtain a front image of the vehicle to be identified; and for each pixel point, carrying out weighted average on the values of the red, green and blue channels of each pixel according to a preset proportion to obtain the gray value and the graying vehicle image of each pixel point.
S202: and carrying out region extraction on the vehicle front view image subjected to the graying treatment to obtain each vehicle image region and region characteristic parameters, and determining a license plate image region according to the region characteristic parameters of each vehicle region.
The vehicle image areas are a plurality of closed image areas obtained in the process of carrying out area extraction on the vehicle front view image after the graying treatment; the region characteristic parameters include a variety of characteristics such as area, perimeter, width, height, aspect ratio, etc. of the region.
Specifically, a preset function in preset software is adopted to conduct region extraction on the vehicle front view image after the gray processing to obtain a plurality of closed vehicle image regions, region characteristic parameters of the plurality of closed vehicle image regions are calculated and compared with preset numerical values, and a rectangular region with the region characteristic parameters within an error range is determined to be a license plate region image.
For example, a region extraction may be performed on the vehicle front view image after the graying process using a regionoprops function.
S203: and carrying out binarization processing on the license plate image area to obtain the license plate image area after the binarization processing.
The binarization process is a process of converting a gray value of each pixel of one image into two colors of black or white.
Specifically, the gray value of each pixel in the license plate image area is obtained, and the gray value of each pixel is converted into a black or white pixel point according to a preset binarization threshold value.
S204: and projecting the binarized license plate image area, removing the license plate frame, and dividing the license plate image area to obtain each license plate character image.
Wherein projection is the process of summing pixel values of an image in a certain direction so that a two-dimensional image is unidimensionally.
Specifically, pixel values of the binarized license plate image area in the horizontal direction and the vertical direction are counted respectively, and a transverse frame, a longitudinal license plate frame and a non-license plate character image area in the license plate image area are obtained according to a counting result.
S205: normalizing each license plate character image to obtain each normalized license plate character image.
The normalization is to uniformly adjust the license plate character image into an image with a fixed pixel size.
Specifically, each license plate character image is segmented to obtain a fixed number of sub-areas, and all character points in the sub-areas are converted into black pixel points and white pixel points according to the proportion of black character points in each sub-area and a preset threshold value, so that a normalized license plate character image is obtained.
S206: and carrying out template matching on each normalized license plate character image, and outputting matching characters of each license plate character.
Among them, template matching is a pixel-level based image processing algorithm that is typically used to find known patterns or features in an input image.
Specifically, for each normalized license plate character image, comparing all template characters in a preset template with each pixel of the normalized license plate character image, and calculating the similarity between the template characters and the license plate character image, wherein the template character corresponding to the maximum similarity is the matching character of the license plate character.
S207: and sequencing the matched characters of each license plate character according to the corresponding license plate characters to obtain the identified license plate number.
Specifically, the matching characters of the license plate characters are ordered according to the front and rear positions of the corresponding license plate characters, and the identified license plate numbers are obtained.
The scheme of the application can realize the following technical effects: the method comprises the steps of carrying out region extraction and analysis on region characteristic parameters through a vehicle image to obtain a license plate region image, dividing characters in the license plate region image, removing frames of the vehicle to obtain single characters, and identifying the single characters one by one through a template matching method to obtain all contents of a license plate. The method has the advantages that the vehicle frame is removed, the interference of the vehicle frame is reduced, the recognition accuracy is improved, the single license plate character is recognized through template matching, the recognition difficulty is reduced, the recognition speed is improved, meanwhile, the image of the license plate is rapidly extracted by adopting a mode of regional characteristic parameter analysis, and the license plate recognition speed is further improved.
In some embodiments, an opening and closing operation is performed on the front view image of the vehicle after the graying treatment, so as to obtain a front view image of the vehicle after the opening and closing operation treatment; extracting a closed area from the front view image of the vehicle after the opening and closing operation processing to obtain each vehicle image area; screening rectangular areas in each vehicle image area, and calculating area characteristic parameters of each rectangular area; and comparing the rectangular region with a preset value, and determining a rectangular region with the regional characteristic parameter within an error range as a license plate regional image.
The corrosion and expansion treatment of the image is the basis of open-close operation, wherein the corrosion is carried out firstly, then the expansion is carried out, and the expansion is carried out firstly, then the expansion is carried out, and the operation is carried out; the preset value is a preset regional characteristic parameter.
Specifically, corrosion and expansion processing are carried out on the front view image of the vehicle after the graying processing, noise of the front view image of the vehicle after the graying processing is reduced, a preset function in preset software is adopted to extract a closed area in the front view image of the vehicle after the corrosion and expansion processing, and each extracted vehicle image area is marked; and screening the rectangular areas in each vehicle image area, calculating the width and the height of each rectangular area, obtaining the aspect ratio, comparing with the preset aspect ratio, and obtaining the rectangular area within the error range of the preset aspect ratio as the license plate area image.
The scheme of the application can realize the following technical effects: the vehicle front view image after the graying treatment is corroded and expanded to obtain a clearer vehicle image, the accuracy of identifying license plate image areas is increased, the accuracy of license plate identification is further enhanced, the license plate area image is determined through analysis of area characteristic parameters in each vehicle image area, feature extraction is not needed by a machine learning algorithm, and the identification speed of the license plate area image is greatly improved.
In some embodiments, the binarized license plate image area can be subjected to transverse projection, the pixel values in the vertical direction are counted, and the longitudinal frames are removed according to the pixel values in the vertical direction, so that the binarized license plate image area without the longitudinal frames is obtained; performing longitudinal projection on the license plate image area subjected to binarization processing without a longitudinal frame, counting pixel values in the horizontal direction, and removing the transverse frame according to the pixel values in the horizontal direction to obtain the license plate image area subjected to binarization processing without a frame; and carrying out transverse projection on the license plate image area subjected to the frame-free binarization processing, counting pixel values in the vertical direction, and carrying out image segmentation according to the pixel values in the vertical direction to obtain each license plate character image.
The transverse projection is to scan the image from top to bottom, count the pixel value in the vertical direction, and obtain the change of the pixel value in the horizontal direction; the vertical projection is to scan the image from left to right, count the pixel value in the horizontal direction, and obtain the change of the pixel value in the vertical direction, wherein the pixel value is the number of white pixel points.
Specifically, performing transverse projection on the license plate image area subjected to binarization processing, counting to obtain the number of white pixel points in the vertical direction, obtaining the position with the maximum number of white pixel points in the horizontal direction, performing longitudinal division by comparing the same position in the horizontal direction in the license plate image area subjected to binarization processing to obtain the area of a longitudinal frame of the license plate, and removing the longitudinal frame area to obtain the license plate image area subjected to binarization processing without the longitudinal frame; performing longitudinal projection on the license plate image area subjected to binarization processing without a longitudinal frame, counting to obtain the number of white pixel points in the horizontal direction, obtaining the position with the maximum number of white pixel points in the vertical direction, and performing transverse division by comparing the same position in the vertical direction in the license plate image area subjected to binarization processing without the longitudinal frame to obtain a transverse frame area of the license plate, and removing the transverse frame area to obtain the license plate image area subjected to binarization processing without the frame; and carrying out transverse projection on the license plate image area subjected to the frame-free binarization processing again, counting to obtain the number of white pixel points in the vertical direction, obtaining the position where the number of the white pixel points in the horizontal direction is 0 or lower than a preset threshold value, and carrying out longitudinal division on the same position in the horizontal direction in the frame-free license plate image area in comparison to obtain a non-license plate character area, and removing the non-license plate character area to obtain each license plate character image.
The scheme of the application can realize the following technical effects: through the projection and statistics of the pixel values in the horizontal direction and the vertical direction, license plate frames and non-license plate character areas in the license plate image area after binarization processing can be found out rapidly, the license plate image area after binarization processing is divided, the license plate character areas are obtained accurately, and then the speed and accuracy of license plate recognition are improved.
In some embodiments, each license plate character image may be divided into a preset number of sub-regions; counting the total number of character points and the number of black character points in each sub-area, and determining the duty ratio of the black character points according to the total number of character points and the number of black character points; and aiming at each subarea, if the duty ratio of the black character point in the subarea exceeds a preset threshold, converting the subarea into a black pixel point, otherwise, converting the subarea into a white pixel point, and obtaining a normalized license plate character image with a fixed pixel size.
The character point is the minimum measurement unit of the license plate character image size.
Specifically, when the number of character points in the license plate character image is less than the number of subareas, if the number of character points is 2×2=4, the upper left and lower right character points are black, the number of pixel points in the subareas is 4*4 =16, and the pixel points corresponding to the upper left and lower right character points in the license plate character image in the subareas are black.
The scheme of the application can realize the following technical effects: and the license plate character image is normalized to obtain a character image with the same pixels as the template character, so that the license plate character image can be conveniently matched with the template character later.
In some embodiments, feature quantities of each normalized license plate character image and feature quantities of each template character may be extracted; calculating the cross-correlation quantity of the characteristic quantity of the normalized license plate character image and the characteristic quantity of each template character aiming at the characteristic quantity of each normalized license plate character image; and taking the template character corresponding to the maximum cross correlation as a character matching result of the normalized license plate character image, and outputting the matching character of the license plate character.
Wherein the feature quantity is a pixel of the character image; the template characters are preset binarized character images; the cross-correlation is the amount by which two characters are related.
Specifically, extracting pixel values of each normalized license plate character image and each template character, and converting the pixel values into a two-dimensional square matrix according to a preset sequence; aiming at the two-dimensional square matrix of the pixel value of each normalized license plate character image, calculating the covariance between the pixel value of each normalized license plate character image and the two-dimensional square matrix of the pixel value of each template character to obtain the cross-correlation quantity of the pixels of the normalized license plate character image and each preset template character; and taking the template character corresponding to the maximum cross correlation as a character matching result of the normalized license plate character image, and outputting the matching character of the license plate character.
The scheme of the application can realize the following technical effects: the normalized license plate character images are identified one by one through template matching, so that the identification difficulty of the license plate character images is reduced, and the identification speed is improved.
In some embodiments, the gray value of each pixel point in the license plate image area can be obtained, and the average gray value of the license plate image area is obtained by averaging the gray values of all the pixel points; and taking the average gray value as a binarization threshold of the license plate image area, and performing binarization processing on the license plate image area to obtain the license plate image area after the binarization processing.
Specifically, the gray value of each pixel of the license plate image area may be read using an image processing library and stored in a gray image having the same size as the license plate image area. In the gray level image, the gray level values of all the pixel points are added up and divided by the total number of pixels to obtain the average gray level average value of the license plate image area. The average gray average value of the license plate image area is set as a binary threshold, the pixel point smaller than or equal to the value is set as 0 (black), and the pixel point larger than the value is set as 255 (white). And converting the gray value of each pixel in the license plate image area into two colors of black or white according to the selected threshold value to obtain the binarized license plate image area.
The scheme of the application can realize the following technical effects: the average gray average value of the license plate image area is used as a binarization threshold value to carry out binarization processing on the license plate image area, so that a more accurate binarization image is obtained, and the accuracy of license plate recognition is further enhanced.
In some embodiments, a front view or a rear view (front view) of a vehicle is acquired through a camera, a vehicle license plate is positioned and extracted in a captured vehicle picture, characters in the license plate are segmented according to license plate features, features of Chinese characters and other characters are extracted and identified in the segmented license plate, and a whole license plate identification flow chart is shown in fig. 3.
The steps are as follows:
1) An image (a front view image of a vehicle to be recognized) is acquired by an image pickup apparatus, and an input image is preprocessed, mainly subjected to graying, gradation correction, image denoising, and the like. Wherein the graying adopts a weighted average method f (x, y) =0.30r (i, j) +0.59g (i, j) +0.11b (i, j) to perform weighted average on the three components of RGB.
2) The license plate only occupies a small part of the image, so that the license plate region needs to be identified, firstly, the image subjected to the opening and closing operation is subjected to region extraction, region characteristic parameters are calculated, the region characteristic parameters are compared according to priori knowledge (preset numerical value) of the license plate, a license plate region (license plate image region) is extracted, and the license plate is initially positioned by using the wide and high range of the license plate and the proportional relation.
And extracting the regions of the license plate, marking each region of the image by utilizing a regionoprops function, calculating the image characteristic parameters of each region, and finally calculating the minimum rectangular width and height of the contained region. And finally, the approximate position of the license plate can be obtained.
3) After the license plate image is obtained by positioning, license plate character segmentation can be performed, and binarization processing can be performed on the license plate so as to highlight license plate characters. The gray average value of the whole license plate area is used as a binarization threshold value, interference of license plate frames on character extraction is removed, the frames are removed through transverse and longitudinal projection, and finally character area identification and segmentation are achieved by adopting a license plate area longitudinal gray projection mode. The gray level image and binary image of license plate are shown in FIG. 4, and after division, they are shown in FIG. 5
4) Since the license plates are different in size, normalization of the divided character images is required. The split character is specified as dot matrix information of a fixed pixel size. The fixed dot matrix size is set to 10×20 pixels. The conversion algorithm is as follows:
(1) and uniformly transmitting the segmented characters into 10 multiplied by 20 subareas, and calculating the number S of pixel points in each area.
(2) The number Ai of black dots (character dots), i=1, 2, is counted for each region. mi=ai/S, i=1, 2..n, pi=1 if Mi > T, otherwise pi=0, the threshold T being set to 0.5.
(3) If pi=1, the corresponding conversion result area pixel is black, otherwise, white. The results are shown in FIG. 6
5) And carrying out character recognition on the normalized characters by adopting a template matching algorithm, extracting a plurality of characteristic quantities from the image to be recognized or the image region f (i, j) and comparing the characteristic quantities corresponding to the template T (i, j) one by one, calculating the cross-correlation quantity between the characteristic quantities, wherein the largest cross-correlation quantity represents the highest similarity, classifying the image into the corresponding class, and finally outputting the corresponding result.
Fig. 7 is a schematic structural diagram of a license plate recognition device according to an embodiment of the present application, as shown in fig. 7, a license plate recognition device 700 of the present embodiment includes: an acquisition module 701, an extraction module 702, a binarization module 703, a projection module 704, a normalization module 705, a matching module 706, and a ranking module 707.
An acquiring module 701, configured to extract and acquire a front view image of a vehicle to be identified, and perform graying processing on the front view image of the vehicle to be identified, so as to obtain a front view image of the vehicle after graying processing;
the extraction module 702 is configured to extract a region of the vehicle front view image after the graying process, obtain each vehicle image region and a region feature parameter, and determine a license plate image region according to the region feature parameter of each vehicle region;
The binarization module 703 is used for extracting and performing binarization processing on the license plate image area to obtain a license plate image area after the binarization processing;
the projection module 704 is configured to extract and project the binarized license plate image area, remove the license plate frame, and divide the license plate image area to obtain each license plate character image;
the normalization module 705 is configured to extract and normalize each license plate character image to obtain each normalized license plate character image;
the matching module 706 is configured to extract and match templates of each normalized license plate character image, and output matching characters of each license plate character;
and the sequencing module 707 is used for extracting and sequencing the matched characters of each license plate character according to the corresponding license plate characters to obtain the identified license plate number.
In a possible implementation manner, the extraction module 702 is specifically configured to perform an opening and closing operation on the front view image of the vehicle after the graying processing, so as to obtain a front view image of the vehicle after the opening and closing operation processing; extracting a closed area from the front view image of the vehicle after the opening and closing operation processing to obtain each vehicle image area; screening rectangular areas in each vehicle image area, and calculating area characteristic parameters of each rectangular area; and comparing the rectangular region with a preset value, and determining a rectangular region with the regional characteristic parameter within an error range as a license plate regional image.
In one possible implementation manner, the projection module 704 is specifically configured to transversely project the binarized license plate image area, count pixel values in a vertical direction, and remove the longitudinal frame according to the pixel values in the vertical direction to obtain a binarized license plate image area without the longitudinal frame; performing longitudinal projection on the license plate image area subjected to binarization processing without a longitudinal frame, counting pixel values in the horizontal direction, and removing the transverse frame according to the pixel values in the horizontal direction to obtain the license plate image area subjected to binarization processing without a frame; and carrying out transverse projection on the license plate image area subjected to the frame-free binarization processing, counting pixel values in the vertical direction, and carrying out image segmentation according to the pixel values in the vertical direction to obtain each license plate character image.
In one possible implementation manner, the normalization module 705 is specifically configured to divide each license plate character image into a preset number of sub-areas; counting the total number of character points and the number of black character points in each sub-area, and determining the duty ratio of the black character points according to the total number of character points and the number of black character points; and aiming at each subarea, if the duty ratio of the black character point in the subarea exceeds a preset threshold, converting the subarea into a black pixel point, otherwise, converting the subarea into a white pixel point, and obtaining a normalized license plate character image with a fixed pixel size.
In one possible implementation, the matching module 706 is specifically configured to extract a feature quantity of each normalized license plate character image and a feature quantity of each template character; calculating the cross-correlation quantity of the characteristic quantity of the normalized license plate character image and the characteristic quantity of each template character aiming at the characteristic quantity of each normalized license plate character image; and taking the template character corresponding to the maximum cross correlation as a character matching result of the normalized license plate character image, and outputting the matching character of the license plate character.
In one possible implementation manner, the binarization module 703 is specifically configured to obtain a gray value of each pixel in the license plate image area, and average the gray values of all the pixels to obtain an average gray average value of the license plate image area; and taking the average gray value as a binarization threshold of the license plate image area, and performing binarization processing on the license plate image area to obtain the license plate image area after the binarization processing.
In one possible implementation manner, the obtaining module 701 is specifically configured to obtain a video stream of the vehicle to be identified uploaded by the camera; acquiring a vehicle target in a video stream of a vehicle to be identified; and cutting out an image frame containing the front image according to the change of the vehicle target to obtain the front image of the vehicle to be identified.
The apparatus of this embodiment may be used to perform the method of any of the foregoing embodiments, and its implementation principle and technical effects are similar, and will not be described herein again.
The license plate recognition system comprises a camera 101 and a server 102;
the camera 101 is used for acquiring an image of a vehicle to be identified;
the server 102 is configured to identify a license plate of a vehicle to be identified, and fig. 8 is a schematic structural diagram of a server according to an embodiment of the present application, as shown in fig. 8, the server 800 of the present embodiment may include: a memory 801 and a processor 802.
The memory 801 has stored thereon a computer program that can be loaded by the processor 802 and that performs the methods of the above embodiments.
The processor 802 is coupled to the memory 801, such as via a bus.
Optionally, the server 800 may also include a transceiver. It should be noted that, in practical applications, the transceiver is not limited to one, and the structure of the server 800 is not limited to the embodiment of the present application.
The processor 802 may be a CPU (Central Processing Unit ), general purpose processor, DSP (Digital Signal Processor, data signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. The processor 802 may also be a combination that implements computing functionality, e.g., comprising one or more microprocessor combinations, a combination of DSP and microprocessor, etc.
A bus may include a path that communicates information between the components. The bus may be a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or an EISA (Extended Industry Standard Architecture ) bus, or the like. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The Memory 801 may be, but is not limited to, ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, RAM (Random Access Memory ) or other type of dynamic storage device that can store information and instructions, EEPROM (Electrically Erasable Programmable Read Only Memory ), CD-ROM (Compact Disc Read Only Memory, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
The memory 801 is used for storing application program codes for executing the inventive arrangements and is controlled to be executed by the processor 802. The processor 802 is configured to execute application code stored in the memory 801 to implement what is shown in the foregoing method embodiments.
Wherein the server includes, but is not limited to: mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), car terminals (e.g., car navigation terminals), and the like, and servers of stationary terminals such as digital TVs, desktop computers, and the like. The server illustrated in fig. 8 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present application.
The system of the present embodiment may be used to perform the method of any of the foregoing embodiments, and its implementation principle and technical effects are similar, and will not be described herein.
The present application also provides a computer-readable storage medium storing a computer program capable of being loaded by a processor and executing the method in the above embodiments.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Claims (10)
1. A license plate recognition method, comprising:
acquiring a front view image of a vehicle to be identified, and carrying out graying treatment on the front view image of the vehicle to be identified to obtain a vehicle front view image after graying treatment;
performing region extraction on the vehicle front view image subjected to the graying treatment to obtain each vehicle image region and region characteristic parameters, and determining a license plate image region according to the region characteristic parameters of each vehicle region;
performing binarization processing on the license plate image area to obtain a license plate image area after binarization processing;
projecting the binarized license plate image area, removing license plate frames, and dividing the license plate image area to obtain various license plate character images;
normalizing the license plate character images to obtain normalized license plate character images;
template matching is carried out on each normalized license plate character image, and matching characters of each license plate character are output;
and sequencing the matched characters of each license plate character according to the corresponding license plate characters to obtain the identified license plate number.
2. The method according to claim 1, wherein the performing region extraction on the vehicle front view image after the graying processing to obtain each vehicle image region and region feature parameters, and determining the license plate image region according to the region feature parameters of each vehicle region comprises:
Performing open-close operation on the vehicle front view image subjected to the graying treatment to obtain a front view image of the vehicle subjected to the open-close operation treatment;
extracting a closed area from the front view image of the vehicle after the opening and closing operation processing to obtain each vehicle image area;
screening rectangular areas in each vehicle image area, and calculating area characteristic parameters of each rectangular area;
and comparing the rectangular region with a preset value, and determining a rectangular region with the regional characteristic parameter within an error range as a license plate regional image.
3. The method according to claim 1, wherein the projecting the binarized license plate image area, removing license plate frames, and dividing the license plate image area to obtain each license plate character image includes:
performing transverse projection on the binarized license plate image area, counting pixel values in the vertical direction, and removing the longitudinal frames according to the pixel values in the vertical direction to obtain a binarized license plate image area without the longitudinal frames;
performing longitudinal projection on the license plate image area subjected to binarization processing without a longitudinal frame, counting pixel values in the horizontal direction, and removing the transverse frame according to the pixel values in the horizontal direction to obtain the license plate image area subjected to binarization processing without a frame;
And carrying out transverse projection on the license plate image area subjected to the frame-free binarization processing, counting pixel values in the vertical direction, and carrying out image segmentation according to the pixel values in the vertical direction to obtain each license plate character image.
4. The method of claim 1, wherein normalizing the license plate character images to obtain normalized license plate character images comprises:
dividing each license plate character image into a preset number of sub-areas;
counting the total number of character points and the number of black character points in each subarea, and determining the duty ratio of the black character points according to the total number of character points and the number of black character points;
and for each sub-area, if the duty ratio of the black character point in the sub-area exceeds a preset threshold, converting the sub-area into a black pixel point, otherwise, converting the sub-area into a white pixel point, and obtaining a normalized license plate character image with a fixed pixel size.
5. The method of claim 1, wherein the performing template matching on each normalized license plate character image, and outputting the matching character of each license plate character, comprises:
Extracting the characteristic quantity of each normalized license plate character image and the characteristic quantity of each template character;
calculating the cross-correlation quantity of the characteristic quantity of each normalized license plate character image and the characteristic quantity of each template character aiming at the characteristic quantity of each normalized license plate character image;
and taking the template character corresponding to the maximum cross correlation as a character matching result of the normalized license plate character image, and outputting the matching character of the license plate character.
6. The method according to claim 1, wherein the binarizing the license plate image area to obtain a binarized license plate image area includes:
acquiring the gray value of each pixel point in the license plate image area, and averaging the gray values of all the pixel points to obtain the average gray average value of the license plate image area;
and taking the average gray value as a binarization threshold of the license plate image area, and performing binarization processing on the license plate image area to obtain the license plate image area after the binarization processing.
7. The method of claim 1, wherein the acquiring a front view image of the vehicle to be identified comprises:
acquiring a video stream of a vehicle to be identified, which is uploaded by a camera;
Acquiring a vehicle target in a video stream of the vehicle to be identified;
and cutting out an image frame containing the front image according to the change of the vehicle target to obtain the front image of the vehicle to be identified.
8. A license plate recognition device, comprising:
the acquisition module is used for extracting and acquiring a front view image of the vehicle to be identified, and carrying out grey-scale treatment on the front view image of the vehicle to be identified to obtain a front view image of the vehicle after the grey-scale treatment;
the extraction module is used for extracting the region of the vehicle front view image subjected to the graying treatment to obtain each vehicle image region and region characteristic parameters, and determining a license plate image region according to the region characteristic parameters of each vehicle region;
the binarization module is used for extracting and carrying out binarization processing on the license plate image area to obtain a license plate image area after the binarization processing;
the projection module is used for extracting and projecting the binarized license plate image area, removing license plate frames, and dividing the license plate image area to obtain various license plate character images;
the normalization module is used for extracting and normalizing each license plate character image to obtain each normalized license plate character image;
The matching module is used for extracting and carrying out template matching on each normalized license plate character image and outputting matching characters of each license plate character;
the sequencing module is used for extracting and sequencing the matched characters of each license plate character according to the corresponding license plate characters to obtain the identified license plate number.
9. A license plate recognition system, comprising: the system comprises a camera and a server;
the camera is used for collecting images of the vehicle to be identified;
the server is used for identifying license plates of vehicles to be identified and comprises at least one memory and a processor;
the memory is used for storing program instructions;
the processor being adapted to invoke and execute program instructions in the memory to perform the method of any of claims 1 to 7.
10. A computer-readable storage medium, wherein the computer-readable storage medium has a computer program stored therein; the computer program, when executed by a processor, implements the method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310875024.0A CN116863458A (en) | 2023-07-17 | 2023-07-17 | License plate recognition method, device, system and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310875024.0A CN116863458A (en) | 2023-07-17 | 2023-07-17 | License plate recognition method, device, system and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116863458A true CN116863458A (en) | 2023-10-10 |
Family
ID=88235660
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310875024.0A Pending CN116863458A (en) | 2023-07-17 | 2023-07-17 | License plate recognition method, device, system and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116863458A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118097650A (en) * | 2024-04-22 | 2024-05-28 | 民航成都电子技术有限责任公司 | Airport crossing license plate recognition method, device, medium and electronic equipment |
-
2023
- 2023-07-17 CN CN202310875024.0A patent/CN116863458A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118097650A (en) * | 2024-04-22 | 2024-05-28 | 民航成都电子技术有限责任公司 | Airport crossing license plate recognition method, device, medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109993056B (en) | Method, server and storage medium for identifying vehicle illegal behaviors | |
CN111382704B (en) | Vehicle line pressing violation judging method and device based on deep learning and storage medium | |
CN107545239B (en) | Fake plate detection method based on license plate recognition and vehicle characteristic matching | |
Yousif et al. | Toward an optimized neutrosophic K-means with genetic algorithm for automatic vehicle license plate recognition (ONKM-AVLPR) | |
Al-Ghaili et al. | Vertical-edge-based car-license-plate detection method | |
Liu et al. | Hybrid cascade structure for license plate detection in large visual surveillance scenes | |
CN108108734B (en) | License plate recognition method and device | |
Khalifa et al. | Malaysian Vehicle License Plate Recognition. | |
CN109919002B (en) | Yellow stop line identification method and device, computer equipment and storage medium | |
CN105184291B (en) | A kind of polymorphic type detection method of license plate and system | |
CN114387591A (en) | License plate recognition method, system, equipment and storage medium | |
Azad et al. | New method for optimization of license plate recognition system with use of edge detection and connected component | |
CN111783524A (en) | Scene change detection method and device, storage medium and terminal equipment | |
CN111369570A (en) | Multi-target detection tracking method for video image | |
CN111178359A (en) | License plate number recognition method, device and equipment and computer storage medium | |
CN116863458A (en) | License plate recognition method, device, system and storage medium | |
CN112101139B (en) | Human shape detection method, device, equipment and storage medium | |
CN111242051B (en) | Vehicle identification optimization method, device and storage medium | |
CN107506777A (en) | A kind of real-time more licence plate recognition methods and device based on Wavelet transformation and SVMs | |
CN112785550B (en) | Image quality value determining method and device, storage medium and electronic device | |
CN110765940A (en) | Target object statistical method and device | |
CN113537253B (en) | Infrared image target detection method, device, computing equipment and storage medium | |
Ghosh et al. | A vehicle number plate recognition system using region-of-interest based filtering method | |
KR20190143525A (en) | A Method of Detecting Character Data through a Adaboost Learning Method | |
CN111027560B (en) | Text detection method and related device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |