CN114821078B - License plate recognition method and device, electronic equipment and storage medium - Google Patents

License plate recognition method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114821078B
CN114821078B CN202210483814.XA CN202210483814A CN114821078B CN 114821078 B CN114821078 B CN 114821078B CN 202210483814 A CN202210483814 A CN 202210483814A CN 114821078 B CN114821078 B CN 114821078B
Authority
CN
China
Prior art keywords
image
license plate
value
pixel point
pixel
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.)
Active
Application number
CN202210483814.XA
Other languages
Chinese (zh)
Other versions
CN114821078A (en
Inventor
葛钰峣
申华亿
商芸萱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
North China University of Technology
Original Assignee
North China University of Technology
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by North China University of Technology filed Critical North China University of Technology
Priority to CN202210483814.XA priority Critical patent/CN114821078B/en
Publication of CN114821078A publication Critical patent/CN114821078A/en
Application granted granted Critical
Publication of CN114821078B publication Critical patent/CN114821078B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Character Input (AREA)

Abstract

The invention discloses a license plate recognition method, a device, electronic equipment and a storage medium, wherein an RGB image is converted into an HIS image, the influence of illumination conditions on license plate recognition is reduced, meanwhile, a constructed morphological structural element is used for carrying out morphological processing on a binary image so as to enlarge a license plate target in the image, reduce and fill up a hole in the image in the morphological processing process, and license plate characters form a communicated region, so that the coarse positioning of the license plate is realized, and finally, the fine positioning of the license plate is completed in the region extracted by coarse positioning by using the aspect ratio and the confidence coefficient of the license plate characteristics, so that a license plate positioning image is obtained; therefore, the license plate recognition method provided by the invention has strong environment adaptability, and can realize accurate positioning of the license plate in a complex environment, thereby improving the precision of license plate recognition.

Description

License plate recognition method and device, electronic equipment and storage medium
Technical Field
The invention belongs to the technical field of license plate recognition, and particularly relates to a license plate recognition method and device, electronic equipment and a storage medium.
Background
With the development of computer vision, digital image processing technology and intelligent transportation technology, the application of license plate recognition technology in the field of intelligent transportation is more and more extensive, which is an important component of an intelligent transportation system, is an important means of traffic management automation and an important link of a vehicle detection system, and plays an important role in traffic monitoring and control.
At present, license plate recognition mainly aims at the occasions of automatic vehicle registration, charging, parking lot management and the like, although the license plate recognition is applied to a certain extent in real life, the background of a shooting area corresponding to the license plate recognition is often complex and usually comprises some interferents, such as road signs, vehicle heads, advertising boards, trees, pedestrians and the like, and the interferents can interfere with license plate detection, and meanwhile, the accuracy of the license plate recognition is further reduced under the influence of illumination and shooting angles.
Disclosure of Invention
The invention aims to provide a license plate recognition method, a license plate recognition device, electronic equipment and a storage medium, and aims to solve the problems that the existing license plate recognition algorithm is poor in environmental adaptability and difficult in license plate positioning under a complex background, so that the license plate recognition precision is not high.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a license plate recognition method, including:
acquiring an image to be recognized, wherein the image to be recognized comprises at least one license plate;
performing image conversion on the image to be identified to obtain an HIS image;
converting the HIS image into a gray level image, and carrying out binarization on the gray level image to obtain a binary image;
constructing a morphological structure element based on the image to be recognized, and performing morphological processing on the binary image by using the morphological structure element to obtain at least one license plate area;
calculating the aspect ratio of each license plate region in the at least one license plate region, and taking the license plate region with the aspect ratio meeting a preset threshold value as a preselected region;
calculating the confidence coefficient of the license plate feature of each preselected region in the preselected regions so as to determine a license plate positioning image from the preselected regions based on the confidence coefficient of the license plate feature;
intercepting a license plate image from the image to be recognized based on the license plate positioning image;
and carrying out image recognition on the license plate image to obtain a license plate recognition result of the image to be recognized.
Based on the disclosure, in view of the characteristic that the license plate image has a fixed color, the invention converts an image to be recognized (essentially an RGB image) into an HIS image, so that the license plate image is described by using a hue value, a color saturation value and a brightness value, thereby avoiding the problem that the RGB image is easily influenced by illumination conditions, and meanwhile, the invention converts the HIS image into a binary image, constructs a morphological structure element based on the image to be recognized, so that the morphological structure element is used for performing morphological processing on the binary image, thereby realizing the coarse positioning of the license plate in the binary image and obtaining at least one license plate area; then, the aspect ratio and the license plate characteristic confidence coefficient of each license plate region are calculated, fine positioning of the license plates is achieved by utilizing the two parameters, so that the regions only containing the license plates are positioned from the license plate regions to serve as license plate positioning images, the license plate images can be intercepted from the images to be recognized by utilizing the license plate positioning images, and finally, the image recognition is carried out on the license plate images, and the recognition results of the license plates can be obtained.
Through the design, the RGB image is converted into the HIS image, the influence of the illumination condition on license plate recognition is reduced, meanwhile, the constructed morphological structural element is used for morphologically processing the binary image, so that the license plate target in the image is enlarged, the size of the license plate target in the image is reduced, the hole in the image is filled up in the morphological processing process, the license plate characters form a communicated region, the coarse positioning of the license plate is realized, and finally, the aspect ratio and the license plate characteristic confidence coefficient are used for finishing the fine positioning of the license plate in the region extracted by the coarse positioning, and the license plate positioning image is obtained; therefore, the license plate recognition method provided by the invention has strong environment adaptability, and can realize accurate positioning of the license plate in a complex environment, thereby improving the precision of license plate recognition.
In one possible design, performing image transformation on the image to be recognized to obtain an HIS image, including:
acquiring an RGB value of each pixel point in the image to be recognized, wherein the RGB value comprises a red channel value, a green channel value and a blue channel value;
obtaining a pixel angle of each pixel point based on the RGB value of each pixel point;
and obtaining a hue value of each pixel point based on the pixel angle of each pixel point, and obtaining a color saturation value and a brightness value of each pixel point based on the RGB value of each pixel point so as to superpose the hue value, the color saturation value and the brightness value of each pixel point to obtain the HIS image.
Based on the disclosure, the invention discloses a conversion process of an HIS image, namely converting RGB components of each pixel point in an image to be identified into HIS components, obtaining the HIS image after the conversion is finished, specifically, calculating a pixel angle of any pixel point by using the RGB value of any pixel point for any pixel point, then obtaining a hue value by using the calculated pixel angle, obtaining a color saturation value and a brightness value of any pixel point by using the RGB value of any pixel point, and finally, superposing the hue value, the color saturation value and the brightness value of all pixel points to obtain the HIS image.
In one possible design, converting the HIS image to a grayscale image includes:
determining an HIS value of each pixel point in the HIS image based on the HIS image, wherein the HIS value comprises a hue value, a color saturation value and a brightness value;
determining the gray value of each pixel point based on the HIS value of each pixel point in the HIS image;
performing gray scale division on each pixel point based on the gray scale value of each pixel point to obtain the gray scale image after the gray scale division is completed;
correspondingly, the binarization is carried out on the gray level image to obtain a binary image, and the binarization comprises the following steps:
based on the gray value of each pixel point in the HIS image, screening out the pixel points with the same gray value and the largest number from the HIS image as target pixel points;
and setting the pixel value of the target pixel point to be 1, and setting the pixel values of all pixel points except the target pixel point in the HIS image to be 0 to obtain the binary image.
Based on the disclosure, the invention discloses a specific process of HIS image graying and binaryzation, for graying, different gray values are matched by using HIS values of all pixel points (the gray values corresponding to different HIS values can be preset), after the gray value of each pixel point is obtained, gray division can be carried out according to the gray value, and after the division is finished, a gray image can be obtained; and for binarization, determining the background color of the license plate based on the number of the pixel points, namely the gray value is the same, and the pixel points with the largest number represent the pixel points with the background color, and finally, setting the pixel value of the pixel point with the largest number to be 1 and setting the pixel values of the other pixel points to be 0 to obtain a binary image.
In one possible design, the morphological structure element includes: the image recognition method comprises the following steps of constructing a width structural element and a height structural element, wherein the shape structural element is constructed based on the image to be recognized, and the method comprises the following steps:
obtaining the width of the image to be recognized based on the image to be recognized;
acquiring the license plate width of a standard license plate, and the maximum distance and the maximum height of characters in the standard license plate;
constructing and obtaining the width structural element based on the width of the image to be recognized, the width of the license plate and the maximum distance, and constructing and obtaining the height structural element based on the width of the image to be recognized, the width of the license plate and the maximum height;
correspondingly, the morphological processing is performed on the binary image based on the morphological structure element to obtain at least one license plate region, and the method comprises the following steps:
performing form closure operation on the binary image by using the width structural element to obtain a first form image;
and performing a morphological operation on the first morphological image by using the height structural element to obtain a second morphological image so as to take each connected region in the second morphological image as a license plate region.
Based on the disclosure, the invention discloses a specific construction process of a morphological structure element, namely, the structure element is constructed respectively from the width direction and the height direction, specifically, the width structure element is constructed by utilizing the width of an image to be identified, the width of a standard license plate and the maximum distance of characters in the standard license plate, and the height structure element is constructed by utilizing the width, the width and the maximum height of the image to be identified; therefore, during morphological processing, the two structural elements are utilized to perform morphological processing on the binary image from the horizontal direction and the vertical direction, so that the coarse positioning of the license plate is realized in the binary image; therefore, the license plate can be positioned in the width direction and the height direction, and the license plate positioning precision can be improved.
In one possible design, calculating a license plate feature confidence for each of the preselected regions includes:
for each preselected region, counting the number of pixel points with the pixel value of 1 in each preselected region to be used as a license plate pixel characteristic value, and calculating a character horizontal projection characteristic value and a character vertical projection characteristic value in each preselected region;
acquiring pixel weight, horizontal projection weight and vertical projection weight;
calculating the product of the license plate pixel characteristic value and the pixel weight, the product of the character horizontal projection characteristic value and the horizontal projection weight and the product of the character vertical projection characteristic value and the vertical projection weight, and summing all the products to obtain the license plate characteristic confidence coefficient of each preselected region;
correspondingly, determining a license plate positioning image from the preselected region based on the license plate feature confidence coefficient, comprising:
and taking the preselected region with the maximum confidence coefficient of the license plate features as the license plate positioning image.
Based on the disclosure, the invention discloses a license plate fine positioning process, firstly, the aspect ratio is utilized to carry out coarse screening, namely the aspect ratio of the license plate is a fixed value, but the influence of conditions such as shooting angle, illumination and the like is considered, the range of the aspect ratio can be enlarged, so that the license plate area with the aspect ratio belonging to a preset threshold range is taken as a preselected area, and then the confidence coefficient of the license plate in each preselected area is calculated, so that the fine positioning of the license plate is completed by utilizing the confidence coefficient of the license plate; specifically, the confidence of the license plate comprises three parts, namely: the number of pixel points with pixel values of 1 in the region (1 represents white, namely the area of the license plate, the more the pixel points with pixel values of 1, the greater the probability of indicating that the region is the license plate), and secondly: character horizontal projection characteristic values, three are: the character vertical projection characteristic value and the latter two parameters are used for representing the light and shade change of the license plate characters, so that the confidence coefficient obtained by summing the products of the three and respective weights is solved, the probability that one region is the license plate can be represented, namely the region with the maximum confidence coefficient is used as a license plate positioning image, and the fine positioning of the license plate can be realized by utilizing the confidence coefficient.
In one possible design, the calculation of the character vertical projection feature value in each preselected region includes:
performing vertical projection operation on each preselected area to obtain a vertical projection image;
determining a maximum peak in the vertically projected image based on the vertically projected image to derive a segmentation threshold based on the maximum peak;
determining a segmentation trough in the vertical projection image based on the segmentation threshold;
according to the segmentation valleys, segmenting the vertical projection image of each preselected region to obtain a vertical projection cutting chart of each preselected region;
for the vertical projection cut map of each preselected region, acquiring the vertical distances between adjacent peaks and valleys in the vertical projection cut map, and summing the vertical distances between all adjacent peaks and valleys to serve as the vertical characteristic value of each preselected region;
the width of each preselected region is obtained to derive a character vertical projection feature value for each preselected region based on the width of each preselected region and the vertical feature value for each preselected region.
In one possible design, the image recognition of the license plate image is performed to obtain a license plate recognition result of the image to be recognized, and the method comprises the following steps:
carrying out gray level enhancement processing on the license plate image to obtain a license plate image with enhanced gray level;
carrying out binarization processing on the license plate image after the gray level enhancement to obtain a binarized license plate image;
performing inclination correction on the binary license plate image to obtain a pre-identified license plate image;
and inputting the pre-recognition license plate image into a license plate recognition model to obtain the license plate recognition result.
Based on the above disclosure, after obtaining a license plate image, firstly performing gray level enhancement to reduce the problem of low image contrast caused by too dark light or too bright light, then performing binarization on the license plate image after gray level enhancement to reduce the amount of computation, then performing tilt correction on the binarized license plate image to reduce the influence of a shooting angle on license plate recognition, and finally inputting the corrected image into a license plate recognition model for image recognition to obtain a license plate recognition result; through the design, the accuracy of license plate recognition can be further improved.
In a second aspect, the present invention provides a license plate recognition apparatus, including:
the device comprises an acquisition unit, a recognition unit and a processing unit, wherein the acquisition unit is used for acquiring an image to be recognized, and the image to be recognized comprises at least one license plate;
the image conversion unit is used for carrying out image conversion on the image to be identified to obtain an HIS image;
a binarization unit, configured to convert the HIS image into a grayscale image, and binarize the grayscale image to obtain a binary image;
the license plate region segmentation unit is used for constructing morphological structure elements based on the image to be recognized and performing morphological processing on the binary image by using the morphological structure elements to obtain at least one license plate region;
the license plate positioning unit is used for calculating the aspect ratio of each license plate area in the at least one license plate area and taking the license plate area with the aspect ratio meeting a preset threshold value as a preselected area;
the license plate positioning unit is further used for calculating the confidence coefficient of the license plate feature of each preselected region in the preselected regions so as to determine a license plate positioning image from the preselected regions based on the confidence coefficient of the license plate feature;
the intercepting unit is used for intercepting a license plate image from the image to be recognized based on the license plate positioning image;
and the license plate recognition unit is used for carrying out image recognition on the license plate image to obtain a license plate recognition result of the image to be recognized.
In a third aspect, the present invention provides another license plate recognition apparatus, taking an apparatus as an electronic device as an example, including a memory, a processor, and a transceiver, which are sequentially connected in a communication manner, where the memory is used to store a computer program, the transceiver is used to transmit and receive messages, and the processor is used to read the computer program and execute the license plate recognition method as described in the first aspect or any one of the possible designs of the first aspect.
In a fourth aspect, the present invention provides a storage medium, on which instructions are stored, and when the instructions are executed on a computer, the license plate recognition method according to the first aspect or any one of the possible designs of the first aspect is executed.
In a fifth aspect, the present invention provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the license plate recognition method according to the first aspect or any one of the possible designs of the first aspect.
Drawings
FIG. 1 is a schematic flow chart illustrating steps of a license plate recognition method according to the present invention;
FIG. 2 is a schematic diagram of an image to be recognized according to the present invention;
FIG. 3 is a binary image after morphological processing according to the present invention;
FIG. 4 is a schematic structural diagram of a license plate recognition device according to the present invention;
fig. 5 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
The invention is further described with reference to the following figures and specific embodiments. It should be noted that the description of the embodiments is provided to help understanding of the present invention, but the present invention is not limited thereto. Specific structural and functional details disclosed herein are merely illustrative of example embodiments of the invention. This invention may, however, be embodied in many alternate forms and should not be construed as limited to the embodiments set forth herein.
It will be understood that, although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element could be termed a second element, and, similarly, a second element could be termed a first element, without departing from the scope of example embodiments of the present invention.
It should be understood that, for the term "and/or" as may appear herein, it is merely an associative relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, B exists alone, and A and B exist at the same time; for the term "/and" as may appear herein, which describes another associative object relationship, it means that two relationships may exist, e.g., a/and B, may mean: a exists independently, and A and B exist independently; in addition, for the character "/" that may appear herein, it generally means that the former and latter associated objects are in an "or" relationship.
Examples
Referring to fig. 1, the license plate recognition method provided in the first aspect of this embodiment improves the precision of the license plate by improving the accuracy of positioning the license plate in a complex environment, and thus is suitable for precision recognition of license plates in various complex environments, where the recognition method may be but is not limited to be executed on a recognition terminal side, and the recognition terminal may be but is not limited to a Personal Computer (PC), a tablet computer, a smart phone, and/or a Personal Digital Assistant (PDA), and it is understood that the execution subject does not constitute a limitation to the embodiments of this application, and accordingly, the execution steps of the method are as shown in steps S1 to S8 below.
S1, obtaining an image to be recognized, wherein the image to be recognized comprises at least one license plate; in specific application, the image to be recognized may be, but not limited to, a license plate photo taken when a parking lot enters or exits a gate, of course, any image including a license plate in a section of video where a vehicle enters or exits the gate or enters or exits the station may be used as the image to be recognized (i.e., the video is processed frame by frame to obtain a plurality of images), and the image including the license plate may also be directly uploaded by a user, i.e., the image to be recognized may select different acquisition modes according to specific application scenarios, which is not specifically limited herein.
The method comprises the steps that after an image to be recognized is obtained by a recognition terminal, license plate recognition can be carried out, wherein the license plate recognition of the embodiment is mainly divided into two parts, namely, the license plate in the image to be recognized is positioned, and an image only containing the license plate (namely, a license plate image) is captured; secondly, image recognition is carried out on the intercepted license plate image, and a specific license plate number is recognized; the license plate positioning process is described below, and is shown in the following steps S2 to S7.
In specific application, the image to be recognized is an image directly captured by a video camera or a camera, and therefore, the image to be recognized is an RGB image (an image with three channels of red, green, and blue), but since the colors of the three channels in the RGB image are affected by the illumination condition, that is, the colors change according to the difference of the illumination intensity, in view of the characteristic that the license plate itself has a fixed color, and in order to reduce the influence of the illumination intensity during capturing, the embodiment converts the image to be recognized into an HIS image, so that the image to be recognized is described by using hue, saturation, and brightness, as shown in step S2 below.
S2, performing image conversion on the image to be identified to obtain an HIS image; when the HIS image is used specifically, the Hue (Hue), the saturation (saturation) and the brightness (intensity) are used for describing the colors in the image, wherein the Hue and the saturation can represent all color information in the image to be recognized, and the brightness is used for representing white and black information in the image to be recognized; alternatively, the image conversion process may be, but is not limited to, as shown in steps S21 to S23 described below.
S21, obtaining an RGB value of each pixel point in the image to be recognized, wherein the RGB value comprises a red channel value, a green channel value and a blue channel value; in specific application, the color attribute of the image to be recognized is obtained based on the image to be recognized.
After the RGB value of each pixel point is obtained, the RGB component of each pixel point may be converted into an HIS component, and after the conversion is completed, an HIS image may be obtained, as shown in steps S22 and S23 below.
S22, obtaining a pixel angle of each pixel point based on the RGB value of each pixel point; in particular applications, the pixel angle may be calculated, but not limited to, using the following equation (1):
Figure BDA0003628548220000071
in the above formula, [ theta ] i The method includes the steps that the pixel angle of the ith pixel point is represented, i =1,2, and N represents the total number of pixel points in an image to be identified, R i Red channel value, G, representing the ith pixel i Green channel value, B, representing the ith pixel i And the blue channel value of the ith pixel point is represented.
After the pixel angle of each pixel point is obtained, the HIS component of each pixel point can be calculated, as shown in step S23 below.
S23, obtaining a hue value of each pixel point based on the pixel angle of each pixel point, and obtaining a color saturation value and a brightness value of each pixel point based on the RGB value of each pixel point so as to stack the hue value, the color saturation value and the brightness value of each pixel point to obtain the HIS image.
In specific application, the following formula (2) can be used for calculating the hue value of each pixel point, the following formula (3) is used for calculating the color saturation value of each pixel point, and the following formula (4) is used for calculating the brightness value of each pixel point:
Figure BDA0003628548220000072
in the above formula (2), H i Indicating the tone value of the ith pixel.
Figure BDA0003628548220000073
In the above formula (3), S i Represents the color saturation value of the ith pixel point, and min (R) i ,G i ,B i ) Is represented by the formula R i 、G i And B i The smallest value in the above.
Figure BDA0003628548220000081
In the above formula (4), I i And expressing the brightness value of the ith pixel point.
And (3) calculating the HSI component of each pixel point based on the formulas (1), (2), (3) and (4), and then superposing the hue value, the color saturation value and the brightness value of each pixel point to obtain the HIS image.
Specifically, the HIS image is converted into a gray image, the gray image is binarized to obtain a binary image, the binary image is coarsely positioned by using the constructed morphological structure element to obtain at least one license plate region, and finally, the license plate is finely positioned by using the aspect ratio and the license plate characteristic confidence coefficient, so that the region which finally represents the license plate is determined in the at least one license plate region, and optionally, the positioning process is as shown in the following steps S3 to S6.
S3, converting the HIS image into a gray image, and binarizing the gray image to obtain a binary image; in a specific application, the grayscale image conversion process is as shown in steps S31 to S33 below.
S31, determining an HIS value of each pixel point in the HIS image based on the HIS image, wherein the HIS value comprises a hue value, a color saturation value and a brightness value; since the RGB image is converted into the HSI image in the foregoing step S2, the hue value, the saturation value, and the brightness value corresponding to each pixel point in the image can be known based on the HIS image, so as to perform the subsequent gray scale division based on the hue value, the saturation value, and the brightness value, as shown in the following steps S32 and S33.
S32, determining a gray value of each pixel point based on the HIS value of each pixel point in the HIS image; in specific application, the gray value of a pixel point with the hue value in the range of [0.56,0.65] and the color saturation value in the range of [0.25,1] is determined to be 255; determining the gray value of the pixel point with the hue value in the range of [0.06,0.18] and the color saturation value in the range of [0.35,1] as 200; determining the gray value of a pixel point with the brightness value in the range of [0.7,1] as 155; determining the gray value of a pixel point with the brightness value in the range of [0,0.2] as 150; finally, dividing the gray values of all pixel points except the pixel point with the determined gray value in the HIS image into 0; thereby, the gray scale value of each pixel point can be obtained for gray scale division, as shown in the following step S33.
S33, carrying out gray scale division on each pixel point based on the gray scale value of each pixel point to obtain a gray scale image after the gray scale division is finished; since the gray scale value of each pixel point in the HIS image has 5 levels, namely 255, 200, 155, 150 and 0, the pixel points can be classified into different gray scales according to the gray scale value, wherein the pixel point corresponding to the gray scale value 255 is a first gray scale (representing blue), the pixel point corresponding to the gray scale value 200 is a second gray scale (representing yellow), the pixel point corresponding to the gray scale value 155 is a third gray scale (representing white), the pixel point corresponding to the gray scale value 150 is a fourth gray scale (representing black), and the pixel point corresponding to the gray scale value 0 is classified into a fifth gray scale.
Accordingly, after the grayscale image is obtained, a binarization process may be performed to obtain a binary image for subsequent license plate location, where a specific process of the binarization process may be, but is not limited to, as shown in steps S34 and S35 below.
S34, based on the gray value of each pixel point in the HIS image, screening out pixel points with the same gray value and the largest number from the HIS image as target pixel points; in specific application, the number of pixels corresponding to different gray values, that is, the total number of pixels corresponding to a gray value of 255, the total number of pixels corresponding to a gray value of 200, the total number of pixels corresponding to a gray value of 155, the total number of pixels corresponding to a gray value of 150, and the total number of pixels corresponding to a gray value of 0, is screened out, and the pixel with the largest total number is taken as a target pixel among the counted pixels; of course, in order to avoid that the pixel with the gray value of 0 affects the binarization process, in this embodiment, only the total number of the pixels with the gray value greater than 0 may be counted, that is, the largest number of the pixels with the gray values of 255, 200, 155, and 150 may be selected as the target pixels.
After the target pixel point is obtained, a binarization process can be implemented, as shown in step S35 below.
S35, setting the pixel value of the target pixel point to be 1, and setting the pixel values of all pixel points except the target pixel point in the HIS image to be 0 to obtain the binary image; in specific application, the target pixel point represents the license plate ground color, so that the pixel value of the target pixel point is set to be 1, the image is white, the pixel values of the other pixel points are set to be 0, and the image is black, and therefore, after the step S35, the binary image can be obtained.
After obtaining the binary image, morphological processing may be performed to achieve coarse positioning of the license plate, in this embodiment, the structural elements used in the morphological processing are constructed according to the image to be recognized, specifically, two structural elements of width and height are constructed, so as to perform morphological processing from two directions, i.e., horizontal and vertical directions, where the morphological processing is as shown in the following step S4.
S4, constructing a morphological structure element based on the image to be recognized, and performing morphological processing on the binary image by using the morphological structure element to obtain at least one license plate area; in a specific application, the example morphological structural elements include a width structural element and a height structural element, wherein the construction process may include, but is not limited to, the following steps S41 to S43.
S41, obtaining the width of the image to be recognized based on the image to be recognized; in a specific application, the unit of width may be, but is not limited to, a pixel.
S42, acquiring the width of a license plate of a standard license plate, and the maximum distance and the maximum height of characters in the standard license plate; in specific application, the license plate width, the maximum distance between characters and the maximum width can be preset in the recognition terminal, specifically, the maximum distance between characters is the maximum value of the distances between adjacent characters on a standard license plate, and the maximum height is the maximum height value of each character; after the width, license plate width, maximum pitch, and maximum height are obtained, the structural elements may be constructed, as shown in step S43 below.
S43, constructing and obtaining the width structural element based on the width of the image to be recognized, the license plate width and the maximum distance, and constructing and obtaining the height structural element based on the width of the image to be recognized, the license plate width and the maximum height; in specific application, the width structural element is a horizontal structural element, the length of the width structural element is constructed, and the process is as follows: the first step is as follows: calculating the ratio of the width of the license plate to the width of the image to be recognized, and recording the ratio as L1; the second step is that: calculating the ratio of the maximum distance to the width of the license plate, and recording the ratio as L2; the third step: calculating the product of the L1 and the L2 and the width of the image to be identified to obtain the length of the horizontal structural element, and constructing the horizontal structural element by using the length as the width structural element; similarly, the height structure element is a vertical structure element, the height is constructed, and the process is as follows: a. calculating the ratio of the maximum height to the width of the license plate, and recording as H1; b. and calculating the product of a preset threshold (which may be but is not limited to 1/3), H1 and the width of the graph to be recognized to obtain a vertical height, namely, constructing a vertical structure element by using the vertical height to serve as the height structure element.
In this embodiment, the height of the horizontal structural element needs to be smaller than the height of the binary image, and can be within the height range of the binary image; similarly, the width of the vertical structural element needs to be smaller than the width of the binary image, that is, the width of the vertical structural element can be within the range of the width of the binary image.
After the width structural elements and the height structural elements are constructed, morphological processing can be performed in the horizontal and vertical directions by using the two structural elements to realize coarse positioning of the license plate, wherein the processing procedure is as shown in the following steps S44 and S45.
S44, performing form closing operation on the binary image by using the width structural element to obtain a first form image; in specific application, the form closing operation is to perform expansion operation first and then perform corrosion operation, and the corrosion operation can fill fine holes in the binary image to connect adjacent objects and smooth boundaries, so that a license plate connected region is obtained after the form closing operation, but the form closing operation can fuse the region near the license plate into a connected range, so that the license plate region needs to be further positioned by performing opening operation again after the form closing operation to divide the license plate region, and the purpose of extracting an effective license plate region is achieved, wherein the processing process of the form opening operation is shown as the following step S45.
S45, performing form opening operation on the first form image by using the height structural element to obtain a second form image so as to take each connected region in the second form image as a license plate region; when the method is applied specifically, the form opening operation is to perform corrosion operation firstly and then perform expansion operation, so that fine objects in the image can be eliminated, and the function of separating the object from the object boundary in the image is achieved, therefore, the division of the license plate region can be realized through the form opening operation, a plurality of connected regions are obtained, and the plurality of connected regions are used as the license plate region; however, in practical applications, due to the influence of the vehicle body and the environment, the connected regions obtained by morphological processing may include regions such as a license plate and a vehicle lamp, as shown in fig. 2 and 3, fig. 2 is an image to be recognized, and fig. 3 is an image after morphological processing, as is apparent from fig. 3, the connected regions respectively correspond to the license plate, the left headlight and the right headlight, and the two fog lights at the lower left and the lower right in fig. 2, and thus the license plate region is the aforementioned 5 regions; therefore, morphological processing can only locate the region possibly containing the license plate, so that coarse location is adopted, and the license plate needs to be finely located so as to determine the region really containing the license plate in the connected region obtained by morphological processing.
In a specific application, the fine positioning process of the license plate is shown in the following steps S5 and S6.
S5, calculating the aspect ratio of each license plate area in the at least one license plate area, and taking the license plate area with the aspect ratio meeting a preset threshold value as a pre-selection area; when the method is applied specifically, if the number of the license plate regions is only 1, judging whether the aspect ratio of the license plate regions meets a preset threshold value, and if so, determining the license plate regions as license plate positioning images; otherwise, the positioning is not accurate, and the steps S2 to S4 need to be executed again to obtain the license plate area again.
In this embodiment, considering factors such as a shooting angle and a license plate inclination, a preset threshold may be set to [1.4,2.5], but not limited thereto, that is, as long as the aspect ratio of any license plate region is within the range of the preset threshold, the license plate region may be regarded as a preselected region, and otherwise, the license plate region may be directly discarded; after the license plate regions are pre-screened by using the width-to-height ratio, the confidence coefficient of the license plate feature of each pre-selected region can be calculated, as shown in the following step S6.
S6, calculating the license plate feature confidence of each preselected region in the preselected regions so as to determine a license plate positioning image from the preselected regions based on the license plate feature confidence; when the method is applied specifically, the confidence coefficient of the license plate features comprises three parts, namely: the number of pixel points with pixel values of 1 in the region (1 represents white, namely the area of the license plate, the more the pixel points with pixel values of 1, the greater the probability of indicating that the region is the license plate), and secondly: character horizontal projection eigenvalue, three is: the character vertical projection characteristic value and the latter two parameters are used for representing the light and shade change of the license plate characters, so that the confidence coefficient obtained by combining the character vertical projection characteristic value and the later two parameters can represent the probability that one region is the license plate, namely the preselected region with the maximum license plate characteristic confidence coefficient is used as a license plate positioning image; the calculation process of the confidence of the license plate features is shown in the following steps S61-S63.
S61, for each preselected area, counting the number of pixel points with the pixel value of 1 in each preselected area to serve as a license plate pixel characteristic value, and calculating a character horizontal projection characteristic value and a character vertical projection characteristic value in each preselected area; in specific application, the license plate pixel characteristic value can be directly obtained based on the pixel value in the preselected area, and the character vertical projection characteristic value needs to perform vertical projection operation on the preselected area, and then is obtained based on a vertical projection image, as shown in the following steps S61 a to S61 f.
S61 a, performing vertical projection operation on each preselected area to obtain a vertical projection image; in specific application, the vertical projection operation is to perform vertical projection on the preselected region, which is substantially to perform row summation on the preselected region, and the obtained vertical projection image is equivalent to a vertical projection histogram, wherein the vertical projection is a common technology in image processing, and details are not repeated herein.
After the vertical projection image is obtained, projection division may be performed as shown in steps S61 b to S61d described below.
S61 b, determining the maximum peak value in the vertical projection image based on the vertical projection image so as to obtain a segmentation threshold value based on the maximum peak value; in a specific application, the maximum peak is the height of the maximum peak in the vertically projected image, and the segmentation threshold is half of the maximum peak, so as to segment the vertically projected image by using the segmentation threshold, wherein the segmentation process is shown in the following steps S61c and S61d.
S61c, determining a segmentation trough in the vertical projection image based on the segmentation threshold; in specific application, in all wave crests of the vertical projection image, screening out a first wave crest with the height larger than a segmentation threshold value and a last wave crest with the height larger than the segmentation threshold value as boundary wave crests (the first wave crest is taken as a starting point boundary wave crest, and the last playing is taken as a termination boundary wave crest), then taking a first wave trough on the left side of the starting point boundary wave crest as a starting point segmentation wave trough, and taking a first wave trough on the right side of the termination boundary wave crest as a termination segmentation wave trough so as to form the segmentation wave trough based on the starting point segmentation wave trough and the termination segmentation wave trough; after the segmentation valleys are obtained, image segmentation can be performed as shown in the following step S61d.
S61d, according to the segmentation trough, segmenting the vertical projection image of each preselected region to obtain a vertical projection cutting chart of each preselected region; in specific application, in the vertical projection image, an image between the starting point segmentation trough and the ending segmentation trough is captured and used as a vertical projection cutting map.
After obtaining the vertical projection cutting chart of each preselected region, the vertical distances between adjacent peaks and valleys can be obtained, then all the vertical distances are summed to obtain the vertical characteristic value of each preselected region, and finally, the character vertical projection characteristic value of each preselected region can be calculated by using the width of each preselected region and the vertical characteristic value, as shown in the following steps S61e and S61.
S61e, for the vertical projection cutting map of each preselected region, acquiring the vertical distance between adjacent wave crests and wave troughs in the vertical projection cutting map, and summing up the vertical distances between all adjacent wave crests and wave troughs to serve as the vertical characteristic value of each preselected region; in specific application, it is assumed that peaks and troughs which sequentially exist from the starting point to the ending point are: peak 1, trough 1, peak 2, trough 3, and terminating the segmentation trough, then the vertical distance is: the starting point divides the vertical distance between the wave trough and the wave crest 1, the vertical distance between the wave crest 1 and the wave trough 1, and the vertical distance between the wave trough 1 and the wave crest 2, and of course, there are vertical distances of preselected regions of other wave crests and wave troughs in different sequences, and the calculation principle is the same as the foregoing example, and is not described herein again.
S61 f, acquiring the width of each preselected region so as to obtain a character vertical projection characteristic value of each preselected region based on the width of each preselected region and the vertical characteristic value of each preselected region; when the method is applied specifically, the character vertical projection characteristic value of each preselected area is obtained by calculation by using the following formula (5):
Figure BDA0003628548220000121
in the above formula (5), Y j The character vertical projection feature value representing the jth preselected region, V represents a calculation coefficient, which may be but is not limited to 1000 j Vertical characteristic value, e, representing the jth preselected area j Denotes the width of the jth preselected area, j =1,2.
For the character horizontal projection characteristic value of the preselected area, the calculation principle is the same as the character vertical horizontal projection characteristic value, namely, the horizontal projection operation is firstly carried out, namely, the column summation is carried out on the preselected area to obtain a horizontal projection image; then, acquiring a maximum peak value in the horizontal projection image, taking the maximum peak value of 0.6 times as a segmentation threshold value, screening out a first peak value with the height larger than the segmentation threshold value and a last peak value with the height larger than the segmentation threshold value, sequentially taking the first peak value as a starting boundary peak and a stopping boundary peak, then taking a first trough on the left played on the starting boundary as a starting point segmentation trough, taking a first trough on the right of the stopping boundary peak as a stopping segmentation trough, and finally taking an image of the horizontal projection image between the starting point segmentation trough and the stopping segmentation trough as a horizontal projection segmentation image; after the horizontal projection segmentation graph is obtained, the calculation of the character horizontal projection characteristic value is the same as the calculation process of the character vertical projection characteristic value, and the description is omitted here.
After obtaining the license plate pixel characteristic value, the character horizontal projection characteristic value and the character vertical projection characteristic value of each preselected region, the calculation of the confidence coefficient of the license plate characteristic can be performed, meanwhile, in order to ensure the reasonability of the calculation of the three characteristics, weights can be distributed to the three characteristics, and then the confidence coefficient of the license plate characteristic is calculated based on the weights, as shown in the following steps S62 and S63.
S62, acquiring a pixel weight, a horizontal projection weight and a vertical projection weight; in specific application, the three weight preset values identify the terminal.
S63, calculating the product of the license plate pixel characteristic value and the pixel weight, the product of the character horizontal projection characteristic value and the horizontal projection weight and the product of the character vertical projection characteristic value and the vertical projection weight, and summing all the products to obtain the license plate characteristic confidence of each preselected area; in specific application, each feature value is multiplied by the corresponding weight, and then the sum is obtained, so as to obtain the license plate feature confidence of each preselected region, wherein in the embodiment, the region with the maximum license plate feature confidence is used as the license plate positioning image.
After the license plate positioning image is obtained, the image only containing the license plate is intercepted from the image to be recognized based on the license plate positioning image, so that the subsequent image recognition can be carried out, wherein the intercepting process is shown as the following step S7.
S7, intercepting a license plate image from the image to be recognized based on the license plate positioning image; in specific application, after a license plate positioning image is obtained, pixel coordinates of four endpoints of the license plate positioning image, namely coordinates of four endpoints of a left upper part, a left lower part, a right upper part and a right lower part, are determined in the binary image based on the binary image, and the size of the binary image and the image of the image to be recognized is not changed, so that after the coordinates of the four endpoints are obtained, an area between the coordinates of the four endpoints can be intercepted from the image to be recognized based on the coordinates of the four endpoints, and the image can be used as the license plate image.
After the license plate image is obtained, image recognition can be performed on the license plate image to obtain a license plate recognition result, as shown in the following step S8.
S8, carrying out image recognition on the license plate image to obtain a license plate recognition result of the image to be recognized; in a specific application, the image recognition process is as shown in steps S81 to S84 described below.
S81, carrying out gray level enhancement processing on the license plate image to obtain a license plate image with enhanced gray level; during specific application, light is too dark or light all can cause the image contrast to hang down excessively, consequently, need carry out grey level enhancement, improves the contrast of license plate image, and wherein, grey level enhancement process is: the first step is as follows: determining a gray change inflection point, wherein the gray curve of a license plate image can be drawn, but not limited to the gray curve, the abscissa is a pixel point, the ordinate is the gray corresponding to the pixel point, and then two points with the maximum change (namely the maximum slope) are found out based on the gray curve and serve as the gray change inflection point; the second step is that: and (4) enhancing the gray value of each pixel point in the license plate image according to the following formula (6).
Figure BDA0003628548220000131
In the above formula (6), g p (x, y) represents the gray value of the p-th pixel point in the license plate image after gray increasing processing, f p (x, y) represents the gray value of the p-th pixel point in the license plate image, x, y respectively represent the pixel abscissa and the pixel ordinate, f 1 The gray value corresponding to the inflection point F of the gray variation 2 The gray scale value is the gray scale value corresponding to the gray scale change inflection point D, the abscissa of F is smaller than the abscissa of D, and A, B, C, B and C are constants. p =1,2,.. M, M is the total number of pixel points in the license plate image.
Let the coordinate of the inflection point F of the gray scale change be (x) F ,y F ) Change of gray scaleThe coordinate of inflection point D is (x) D ,y D ) Wherein:
Figure BDA0003628548220000141
and g is F =Z(r F ) Z represents a gray scale transformation function which may include, but is not limited to, linear functions, logarithmic functions (logarithmic and inverse-logarithmic) or power-law functions, r F Is the gray level corresponding to the gray value of the gray change inflection point F, therefore, the gray level corresponding to the gray value of the gray change inflection point F is substituted into the gray conversion function to obtain g F And finally, calculating g F And f 1 The ratio of the two can obtain the value of A.
Figure BDA0003628548220000142
b=g F -Bf 1 In the same way, g D =Z(r D ) And r is D A gray level of a gray value of the gray variation inflection point D.
Figure BDA0003628548220000143
c=g D -Cf 2 In the formula (I), wherein,
Figure BDA0003628548220000144
is the gray level f corresponding to the gray value of the p-th pixel point in the license plate image p The gray value of the p-th pixel point in the license plate image is obtained.
Therefore, the gray value of each pixel point in the license plate image after gray enhancement can be calculated through the formula (6), and the license plate image after gray enhancement can be obtained after all the pixel points are calculated.
S82, performing binarization processing on the license plate image subjected to gray level enhancement to obtain a binarized license plate image; in specific application, the binarization is a common technique in the field of image processing, and is not described herein.
After the license plate image with enhanced gray scale is binarized, to improve the recognition accuracy, tilt correction is performed, as shown in step S83 below.
S83, performing inclination correction on the binary license plate image to obtain a pre-recognition license plate image; during specific application, hough transformation can be used for inclination correction, namely, the Hough transformation is used for extracting the boundary straight line of the license plate image, then an inclination angle is obtained, and finally correction is carried out based on the inclination angle; certainly, the hough transform tilt correction is a common technique for image correction, and is not described herein.
After the inclination correction is completed, the pre-recognized license plate image is input to the license plate recognition model for license plate recognition to obtain a recognition result, as shown in the following step S84.
S84, inputting the pre-recognition license plate image into a license plate recognition model to obtain a license plate recognition result; in a specific application, the LPRnet (License Plate registration view Deep Neural Networks) License Plate Recognition Network may be used for License Plate Recognition or CNN (feedforward Neural Networks) License Plate Recognition, and of course, other Neural Networks may be used, which is not limited herein.
In this embodiment, the neural network needs to be trained, that is, a training data set (including a plurality of license plate training images) is obtained, then the neural network is trained by using the training data set as input and the license plate number of each license plate training image as output, and after training is completed, the license plate recognition model can be obtained.
According to the license plate recognition method described in detail in the steps S1-S8, the RGB image is converted into the HIS image, the influence of the illumination condition on the license plate recognition is reduced, meanwhile, the constructed morphological structural elements are used for performing morphological processing on the binary image, so that the license plate target in the image is enlarged, the size of the license plate target is reduced, and the holes in the image are filled in the morphological processing process, so that license plate characters form a communicated region, and the coarse positioning of the license plate is realized; therefore, the license plate recognition method provided by the invention has strong environment adaptability, and can realize accurate positioning of the license plate in a complex environment, thereby improving the precision of license plate recognition.
As shown in fig. 4, a second aspect of the present embodiment provides a hardware device for implementing the license plate recognition method in the first aspect of the embodiment, including:
the device comprises an acquisition unit, a recognition unit and a display unit, wherein the acquisition unit is used for acquiring an image to be recognized, and the image to be recognized comprises at least one license plate.
And the image conversion unit is used for carrying out image conversion on the image to be identified to obtain an HIS image.
And the binarization unit is used for converting the HIS image into a gray level image and binarizing the gray level image to obtain a binary image.
And the license plate region segmentation unit is used for constructing morphological structure elements based on the image to be recognized and performing morphological processing on the binary image by using the morphological structure elements to obtain at least one license plate region.
And the license plate positioning unit is used for calculating the aspect ratio of each license plate region in the at least one license plate region and taking the license plate region with the aspect ratio meeting a preset threshold value as a preselected region.
And the license plate positioning unit is also used for calculating the confidence coefficient of the license plate feature of each preselected region in the preselected regions so as to determine a license plate positioning image from the preselected regions based on the confidence coefficient of the license plate feature.
And the intercepting unit is used for intercepting the license plate image from the image to be identified based on the license plate positioning image.
And the license plate recognition unit is used for carrying out image recognition on the license plate image to obtain a license plate recognition result of the image to be recognized.
For the working process, the working details, and the technical effects of the hardware apparatus provided in this embodiment, reference may be made to the first aspect of the embodiment, which is not described herein again.
As shown in fig. 5, a third aspect of the present embodiment provides another license plate recognition apparatus, taking the apparatus as an electronic device as an example, including: the license plate recognition system comprises a memory, a processor and a transceiver which are sequentially connected in a communication manner, wherein the memory is used for storing computer programs, the transceiver is used for transceiving messages, and the processor is used for reading the computer programs and executing the license plate recognition method according to the first aspect of the embodiment.
For example, the Memory may include, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a flash Memory (F l ash Memory), a first-in first-Out Memory (Fi rst I nput Fi rst Output, fi FO), and/or a first-in Last-Out Memory (Fi rst I n Last Out, fi LO), and the like; in particular, the processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor may be implemented in at least one hardware form of a DSP (digital signal processing), an FPGA (field programmable Gate Array), and a PLA (programmable Logic Array), and may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state and is also called a CPU (central processing unit, un it); a coprocessor is a low power processor for processing data in a standby state.
In some embodiments, the processor may be integrated with a GPU (graphics processing Un it) which is responsible for rendering and drawing contents required to be displayed on the display screen, for example, the processor may not be limited to a processor adopting a model STM32F105 series microprocessor, a Reduced Instruction Set Computer (RISC) microprocessor, an X86 or the like architecture processor or a processor integrated with an embedded neural Network Processor (NPU); the transceiver may be, but is not limited to, a wireless fidelity (WI-FI) wireless transceiver, a bluetooth wireless transceiver, a General Packet Radio Service (GPRS) wireless transceiver, a ZigBee wireless transceiver (low power local area network protocol based on I EEE802.15.4 standard), a 3G transceiver, a 4G transceiver, and/or a 5G transceiver, etc. In addition, the device may also include, but is not limited to, a power module, a display screen, and other necessary components.
For the working process, the working details, and the technical effects of the electronic device provided in this embodiment, reference may be made to the first aspect of the embodiment, which is not described herein again.
A fourth aspect of the present embodiment provides a storage medium storing instructions including the license plate recognition method according to the first aspect of the present embodiment, that is, the storage medium stores instructions that, when executed on a computer, perform the license plate recognition method according to the first aspect.
The storage medium refers to a carrier for storing data, and may include, but is not limited to, a floppy disk, an optical disk, a hard disk, a flash Memory, a flash disk and/or a Memory stick (Memory stick), etc., and the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
For the working process, the working details, and the technical effects of the storage medium provided in this embodiment, reference may be made to the first aspect of the embodiment, which is not described herein again.
A fifth aspect of the present embodiment provides a computer program product comprising instructions for causing a computer to perform the license plate recognition method according to the first aspect of the present embodiment when the instructions are run on the computer, wherein the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
Finally, it should be noted that: the above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (7)

1. A license plate recognition method is characterized by comprising the following steps:
acquiring an image to be recognized, wherein the image to be recognized comprises at least one license plate;
performing image conversion on the image to be identified to obtain an HIS image;
converting the HIS image into a gray level image, and carrying out binarization on the gray level image to obtain a binary image;
constructing a morphological structure element based on the image to be recognized, and performing morphological processing on the binary image by using the morphological structure element to obtain at least one license plate area;
calculating the aspect ratio of each license plate region in the at least one license plate region, and taking the license plate region with the aspect ratio meeting a preset threshold value as a preselected region;
calculating the confidence coefficient of the license plate feature of each preselected region in the preselected regions so as to determine a license plate positioning image from the preselected regions based on the confidence coefficient of the license plate feature;
intercepting a license plate image from the image to be recognized based on the license plate positioning image;
carrying out image recognition on the license plate image to obtain a license plate recognition result of the image to be recognized;
performing image conversion on the image to be identified to obtain an HIS image, wherein the image conversion comprises the following steps:
acquiring an RGB value of each pixel point in the image to be identified, wherein the RGB value comprises a red channel value, a green channel value and a blue channel value;
obtaining a pixel angle of each pixel point based on the RGB value of each pixel point;
obtaining a hue value of each pixel point based on the pixel angle of each pixel point, and obtaining a color saturation value and a brightness value of each pixel point based on the RGB value of each pixel point so as to superpose the hue value, the color saturation value and the brightness value of each pixel point to obtain the HIS image;
the pixel angle of each pixel point is calculated by using the following formula (1):
Figure QLYQS_1
in the above formula (1), θ i The pixel angle of the ith pixel point is represented, i =1,2, and N represent the pixels in the image to be identifiedTotal number of dots, R i Red channel value, G, representing the ith pixel i Green channel value, B, representing the ith pixel i Expressing the blue channel value of the ith pixel point;
calculating the hue value of each pixel point by using the following formula (2), calculating the color saturation value of each pixel point by using the following formula (3), and calculating the brightness value of each pixel point by using the following formula (4):
Figure QLYQS_2
in the above formula (2), H i Expressing the tone value of the ith pixel point;
Figure QLYQS_3
in the above formula (3), S i Represents the color saturation value of the ith pixel point, and min (R) i ,G i ,B i ) Is shown by taking R i 、G i And B i The smallest value of (d);
Figure QLYQS_4
in the above formula (4), I i Expressing the brightness value of the ith pixel point;
calculating a license plate feature confidence for each preselected region of the preselected regions, comprising:
for each preselected region, counting the number of pixel points with the pixel value of 1 in each preselected region to serve as a license plate pixel characteristic value, and calculating a character horizontal projection characteristic value and a character vertical projection characteristic value in each preselected region;
acquiring pixel weight, horizontal projection weight and vertical projection weight;
calculating the product of the license plate pixel characteristic value and the pixel weight, the product of the character horizontal projection characteristic value and the horizontal projection weight and the product of the character vertical projection characteristic value and the vertical projection weight, and summing all the products to obtain the license plate characteristic confidence of each preselected region;
correspondingly, determining a license plate positioning image from the preselected region based on the license plate feature confidence coefficient, comprising:
taking the preselected region with the maximum confidence coefficient of the license plate features as the license plate positioning image;
calculating character vertical projection characteristic values in each preselected region, including:
performing vertical projection operation on each preselected area to obtain a vertical projection image;
determining a maximum peak in the vertical projection image based on the vertical projection image so as to derive a segmentation threshold based on the maximum peak;
determining a segmentation trough in the vertical projection image based on the segmentation threshold;
according to the segmentation valleys, segmenting the vertical projection image of each preselected region to obtain a vertical projection cutting chart of each preselected region;
for the vertical projection cut map of each preselected region, acquiring the vertical distances between adjacent peaks and valleys in the vertical projection cut map, and summing the vertical distances between all adjacent peaks and valleys to serve as the vertical characteristic value of each preselected region;
the width of each preselected region is obtained to derive a character vertical projection feature value for each preselected region based on the width of each preselected region and the vertical feature value for each preselected region.
2. The method of claim 1, wherein converting the HIS image to a grayscale image comprises:
determining an HIS value of each pixel point in the HIS image based on the HIS image, wherein the HIS value comprises a hue value, a color saturation value and a brightness value;
determining the gray value of each pixel point based on the HIS value of each pixel point in the HIS image;
performing gray scale division on each pixel point based on the gray scale value of each pixel point to obtain the gray scale image after the gray scale division is completed;
correspondingly, the binarization is carried out on the gray level image to obtain a binary image, and the binarization comprises the following steps:
based on the gray value of each pixel point in the HIS image, screening out the pixel points with the same gray value and the largest number from the HIS image as target pixel points;
and setting the pixel value of the target pixel point to be 1, and setting the pixel values of all pixel points except the target pixel point in the HIS image to be 0 to obtain the binary image.
3. The method of claim 1, wherein the morphological structural element comprises: the image recognition method comprises the following steps of constructing a width structural element and a height structural element, wherein the shape structural element is constructed based on the image to be recognized, and the method comprises the following steps:
obtaining the width of the image to be recognized based on the image to be recognized;
acquiring the license plate width of a standard license plate, and the maximum distance and the maximum height of characters in the standard license plate;
constructing and obtaining the width structural element based on the width of the image to be recognized, the width of the license plate and the maximum distance, and constructing and obtaining the height structural element based on the width of the image to be recognized, the width of the license plate and the maximum height;
correspondingly, the morphological processing is performed on the binary image based on the morphological structure element to obtain at least one license plate region, and the method comprises the following steps:
performing form closure operation on the binary image by using the width structural element to obtain a first form image;
and performing a morphological operation on the first morphological image by using the height structural element to obtain a second morphological image so as to take each connected region in the second morphological image as a license plate region.
4. The method of claim 1, wherein the image recognition of the license plate image to obtain a license plate recognition result of the image to be recognized comprises:
carrying out gray level enhancement processing on the license plate image to obtain a license plate image with enhanced gray level;
carrying out binarization processing on the license plate image after the gray level enhancement to obtain a binarized license plate image;
performing tilt correction on the binary license plate image to obtain a pre-recognized license plate image;
and inputting the pre-recognition license plate image into a license plate recognition model to obtain the license plate recognition result.
5. A license plate recognition device, comprising:
the device comprises an acquisition unit, a recognition unit and a processing unit, wherein the acquisition unit is used for acquiring an image to be recognized, and the image to be recognized comprises at least one license plate;
the image conversion unit is used for carrying out image conversion on the image to be identified to obtain an HIS image;
a binarization unit, configured to convert the HIS image into a grayscale image, and binarize the grayscale image to obtain a binary image;
the license plate region segmentation unit is used for constructing morphological structure elements based on the image to be recognized and performing morphological processing on the binary image by using the morphological structure elements to obtain at least one license plate region;
the license plate positioning unit is used for calculating the aspect ratio of each license plate area in the at least one license plate area and taking the license plate area with the aspect ratio meeting a preset threshold value as a preselected area;
the license plate positioning unit is further used for calculating the confidence coefficient of the license plate feature of each preselected region in the preselected regions so as to determine a license plate positioning image from the preselected regions based on the confidence coefficient of the license plate feature;
the intercepting unit is used for intercepting a license plate image from the image to be recognized based on the license plate positioning image;
the license plate recognition unit is used for carrying out image recognition on the license plate image to obtain a license plate recognition result of the image to be recognized;
performing image conversion on the image to be identified to obtain an HIS image, wherein the image conversion comprises the following steps:
acquiring an RGB value of each pixel point in the image to be identified, wherein the RGB value comprises a red channel value, a green channel value and a blue channel value;
obtaining a pixel angle of each pixel point based on the RGB value of each pixel point;
obtaining a hue value of each pixel point based on the pixel angle of each pixel point, and obtaining a color saturation value and a brightness value of each pixel point based on the RGB value of each pixel point so as to superpose the hue value, the color saturation value and the brightness value of each pixel point to obtain the HIS image;
the pixel angle of each pixel point is calculated by using the following formula (1):
Figure QLYQS_5
in the above formula (1), θ i The method includes the steps that the pixel angle of the ith pixel point is represented, i =1,2, and N represents the total number of pixel points in an image to be identified, R i Red channel value, G, representing the ith pixel i Green channel value, B, representing the ith pixel i Expressing the blue channel value of the ith pixel point;
calculating the hue value of each pixel point by using the following formula (2), calculating the color saturation value of each pixel point by using the following formula (3), and calculating the brightness value of each pixel point by using the following formula (4):
Figure QLYQS_6
in the above formula (2), H i Expressing the tone value of the ith pixel point;
Figure QLYQS_7
in the above formula (3), S i Represents the color saturation value of the ith pixel point, and min (R) i ,G i ,B i ) Is represented by the formula R i 、G i And B i The smallest value of;
Figure QLYQS_8
in the above formula (4), I i Expressing the brightness value of the ith pixel point;
calculating a license plate feature confidence for each preselected region of the preselected regions, comprising:
for each preselected region, counting the number of pixel points with the pixel value of 1 in each preselected region to serve as a license plate pixel characteristic value, and calculating a character horizontal projection characteristic value and a character vertical projection characteristic value in each preselected region;
acquiring pixel weight, horizontal projection weight and vertical projection weight;
calculating the product of the license plate pixel characteristic value and the pixel weight, the product of the character horizontal projection characteristic value and the horizontal projection weight and the product of the character vertical projection characteristic value and the vertical projection weight, and summing all the products to obtain the license plate characteristic confidence of each preselected region;
correspondingly, determining a license plate positioning image from the preselected region based on the license plate feature confidence coefficient, comprising:
taking the preselected region with the maximum confidence coefficient of the license plate features as the license plate positioning image;
calculating character vertical projection characteristic values in each preselected region, including:
performing vertical projection operation on each preselected area to obtain a vertical projection image;
determining a maximum peak in the vertical projection image based on the vertical projection image so as to derive a segmentation threshold based on the maximum peak;
determining a segmentation trough in the vertical projection image based on the segmentation threshold;
according to the segmentation valleys, segmenting the vertical projection image of each preselected region to obtain a vertical projection cutting chart of each preselected region;
for the vertical projection cut map of each preselected region, acquiring the vertical distances between adjacent peaks and valleys in the vertical projection cut map, and summing the vertical distances between all adjacent peaks and valleys to serve as the vertical characteristic value of each preselected region;
the width of each preselected region is obtained to derive a character vertical projection feature value for each preselected region based on the width of each preselected region and the vertical feature value for each preselected region.
6. An electronic device, comprising: a memory, a processor and a transceiver, which are connected in sequence in a communication manner, wherein the memory is used for storing a computer program, the transceiver is used for transmitting and receiving messages, and the processor is used for reading the computer program and executing the license plate recognition method of any one of claims 1 to 4.
7. A storage medium having stored thereon instructions for performing the license plate recognition method of any one of claims 1-4 when the instructions are run on a computer.
CN202210483814.XA 2022-05-05 2022-05-05 License plate recognition method and device, electronic equipment and storage medium Active CN114821078B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210483814.XA CN114821078B (en) 2022-05-05 2022-05-05 License plate recognition method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210483814.XA CN114821078B (en) 2022-05-05 2022-05-05 License plate recognition method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114821078A CN114821078A (en) 2022-07-29
CN114821078B true CN114821078B (en) 2023-03-14

Family

ID=82512258

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210483814.XA Active CN114821078B (en) 2022-05-05 2022-05-05 License plate recognition method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114821078B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101398894A (en) * 2008-06-17 2009-04-01 浙江师范大学 Automobile license plate automatic recognition method and implementing device thereof
CN102043945A (en) * 2010-11-23 2011-05-04 聊城大学 License plate character recognition method based on real-time vehicle tracking and binary index classification
CN103065138A (en) * 2012-12-06 2013-04-24 新疆公众信息产业股份有限公司 Recognition method of license plate number of motor vehicle
CN104715252A (en) * 2015-03-12 2015-06-17 电子科技大学 License plate character segmentation method with combination of dynamic template and pixel points
CN105825212A (en) * 2016-02-18 2016-08-03 江西洪都航空工业集团有限责任公司 Distributed license plate recognition method based on Hadoop
CN106529592A (en) * 2016-11-07 2017-03-22 湖南源信光电科技有限公司 License plate recognition method based on mixed feature and gray projection
CN107832762A (en) * 2017-11-06 2018-03-23 广西科技大学 A kind of License Plate based on multi-feature fusion and recognition methods
CN108364010A (en) * 2018-03-08 2018-08-03 广东工业大学 A kind of licence plate recognition method, device, equipment and computer readable storage medium
CN108830274A (en) * 2018-05-03 2018-11-16 南京邮电大学 Characters on license plate detects positioning and recognition methods automatically under a kind of complex background environment
CN111401364A (en) * 2020-03-18 2020-07-10 深圳市市政设计研究院有限公司 License plate positioning algorithm based on combination of color features and template matching
CN112070081A (en) * 2020-08-20 2020-12-11 广州杰赛科技股份有限公司 Intelligent license plate recognition method based on high-definition video

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI431559B (en) * 2010-10-29 2014-03-21 Univ Nat Chiao Tung A vehicle registration-plate detecting method and system thereof
CN104156704A (en) * 2014-08-04 2014-11-19 胡艳艳 Novel license plate identification method and system
WO2020133464A1 (en) * 2018-12-29 2020-07-02 Zhejiang Dahua Technology Co., Ltd. Systems and methods for license plate recognition
CN109712162B (en) * 2019-01-18 2023-03-21 珠海博明视觉科技有限公司 Cable character defect detection method and device based on projection histogram difference
CN110543883A (en) * 2019-08-27 2019-12-06 河海大学 license plate recognition method based on deep learning
CN112261402B (en) * 2020-09-22 2022-08-16 北京紫光展锐通信技术有限公司 Image detection method and system and camera shielding monitoring method and system

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101398894A (en) * 2008-06-17 2009-04-01 浙江师范大学 Automobile license plate automatic recognition method and implementing device thereof
CN102043945A (en) * 2010-11-23 2011-05-04 聊城大学 License plate character recognition method based on real-time vehicle tracking and binary index classification
CN103065138A (en) * 2012-12-06 2013-04-24 新疆公众信息产业股份有限公司 Recognition method of license plate number of motor vehicle
CN104715252A (en) * 2015-03-12 2015-06-17 电子科技大学 License plate character segmentation method with combination of dynamic template and pixel points
CN105825212A (en) * 2016-02-18 2016-08-03 江西洪都航空工业集团有限责任公司 Distributed license plate recognition method based on Hadoop
CN106529592A (en) * 2016-11-07 2017-03-22 湖南源信光电科技有限公司 License plate recognition method based on mixed feature and gray projection
CN107832762A (en) * 2017-11-06 2018-03-23 广西科技大学 A kind of License Plate based on multi-feature fusion and recognition methods
CN108364010A (en) * 2018-03-08 2018-08-03 广东工业大学 A kind of licence plate recognition method, device, equipment and computer readable storage medium
CN108830274A (en) * 2018-05-03 2018-11-16 南京邮电大学 Characters on license plate detects positioning and recognition methods automatically under a kind of complex background environment
CN111401364A (en) * 2020-03-18 2020-07-10 深圳市市政设计研究院有限公司 License plate positioning algorithm based on combination of color features and template matching
CN112070081A (en) * 2020-08-20 2020-12-11 广州杰赛科技股份有限公司 Intelligent license plate recognition method based on high-definition video

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
A Robust License Plate Detection and Character Recognition Algorithm Based on a Combined Feature Extraction Model and BPNN;Fei Xie等;《Journal of Advanced Transportation》;20180926;第1-15页 *
Automatic Number Plate Recognition:A Detailed Survey of Relevant Algorithms;Lubna等;《sensors》;20210426;第21卷(第9期);第1-35页 *
基于区域综合特征的车牌定位方法研究及应用;唐海周;《中国优秀硕士学位论文全文数据库 信息科技辑》;20120315(第(2012)03期);I138-1893第3.1.2、3.3.2-3.3.3节 *
基于特征显著性的多特征融合车牌定位算法;陈振学等;《控制与决策》;20101231;第25卷(第12期);第1909-1912页 *
基于边缘检测及数学形态学的快速汽车车牌定位;陈虹等;《智能交通》;20081231;第78-80页 *
基于金字塔变换和形态学的车牌定位算法研究;刘金阳等;《合肥工业大学学报(自然科学版)》;20150831;第38卷(第8期);第1060-1064、1080页第2.1节 *

Also Published As

Publication number Publication date
CN114821078A (en) 2022-07-29

Similar Documents

Publication Publication Date Title
CN108108761B (en) Rapid traffic signal lamp detection method based on deep feature learning
CN106599792B (en) Method for detecting hand driving violation behavior
CN105354530B (en) A kind of body color recognition methods and device
CN111798467B (en) Image segmentation method, device, equipment and storage medium
CN101739827B (en) Vehicle detecting and tracking method and device
CN111428556B (en) Traffic sign recognition method based on capsule neural network
CN103488987A (en) Video-based method and device for detecting traffic lights
CN107705254B (en) City environment assessment method based on street view
CN108256467B (en) Traffic sign detection method based on visual attention mechanism and geometric features
CN112287912A (en) Deep learning-based lane line detection method and device
CN102306276A (en) Method for identifying color of vehicle body in video vehicle image based on block clustering
CN111723805B (en) Method and related device for identifying foreground region of signal lamp
CN107301421A (en) The recognition methods of vehicle color and device
CN113808004B (en) Image conversion device, image conversion method, and computer program for image conversion
CN113989771A (en) Traffic signal lamp identification method based on digital image processing
CN114821078B (en) License plate recognition method and device, electronic equipment and storage medium
CN112434176A (en) Image storage method and device based on image processing
CN111260603B (en) Method and device for identifying blade tips of wind generating set
CN116543325A (en) Unmanned aerial vehicle image-based crop artificial intelligent automatic identification method and system
CN109330833B (en) Intelligent sensing system and method for assisting visually impaired patients to safely go out
CN110633705A (en) Low-illumination imaging license plate recognition method and device
CN116189136A (en) Deep learning-based traffic signal lamp detection method in rainy and snowy weather
CN111985482B (en) Multi-mode multi-scene automatic license plate recognition method based on deep learning
CN113158934A (en) High-resolution remote sensing image-based urban land use classification method, device and equipment
CN111382718A (en) Night pedestrian detection system and pedestrian detection method based on system

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
GR01 Patent grant
GR01 Patent grant