License plate image processing method and device

By extracting and processing the characteristic areas and histograms of the license plate image, combined with projection division and interference removal technology, the problem of difficult recognition when the license plate image contains both dark characters on a bright background and bright characters on a dark background is solved, and the accuracy of license plate recognition is improved. accuracy and stability.

CN111898599BActive Publication Date: 2024-09-27ZHEJIANG DAHUA TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202010665123.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-10
Publication Date
2024-09-27
Estimated Expiration
2040-07-10

AI Technical Summary

Technical Problem

The existing technology is difficult to handle the situation where the license plate image contains both dark characters on a bright background and bright characters on a dark background, resulting in poor license plate recognition results.

Method used

By extracting the characteristic area of ​​the license plate image, counting the regional height histograms of different color types, determining the target area, dividing it by vertical and horizontal projection, removing interfering foreground and overlapping areas, and outputting the color type of the license plate or license plate sub-image.

Benefits of technology

Effectively detects and processes feature areas of different color types in license plate images, improves the accuracy and robustness of license plate recognition, and solves the problem of difficult recognition when there are two color types in the license plate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111898599B
    Figure CN111898599B
Patent Text Reader

Abstract

The present invention provides a license plate image processing method and device, wherein the method comprises: extracting a feature area of ​​a license plate image and features of the feature area, wherein the feature area comprises a plurality of areas; determining a color type of the feature area according to the features of the feature area; respectively counting regional height histograms of feature areas of different color types; determining a target area in the feature area according to the regional height histograms of the different color types, and outputting the color type of the target area, wherein the target area is the area where the license plate or the license plate sub-image is located, and can solve the problem in the related art that the situation in which two color types (bright background with dark characters and dark background with bright characters) in the license plate cannot be processed, and the feature areas of different color types in the license plate image are detected, and statistics are performed respectively, and the corresponding target areas are respectively retained, and the corresponding color types are output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and in particular to a method and device for processing a license plate image. Background Art

[0002] Traditional license plate recognition methods and deep learning methods are highly dependent on the type of background color of the license plate in the grayscale image. For traditional methods, different binarization strategies are required for dark characters on a bright background (brighter background color) and bright characters on a dark background (brighter character color). Incorrect use of strategies will directly affect the binarization results, and then affect the character segmentation results. For deep learning methods, when the number of license plates of the two types is extremely unbalanced, the type with a smaller number cannot be learned well. Type conversion through type judgment can improve the recognition effect of license plates with a smaller proportion.

[0003] In the related art, the license plate color determination method based on Bayes is based on the Bayes classifier to determine the license plate color type. It cannot handle the situation where there are two color types in the license plate (dark characters on a bright background and bright characters on a dark background).

[0004] There is no solution to the problem in the related art that the license plate cannot handle the situation where there are two types of colors (light background with dark characters and dark background with light characters). Summary of the invention

[0005] The embodiments of the present invention provide a license plate image processing method and device to at least solve the problem in the related art that the license plate cannot handle the situation where there are two types of colors (dark characters on a bright background and bright characters on a dark background).

[0006] According to one embodiment of the present invention, a license plate image processing method is provided, comprising:

[0007] Extracting a characteristic region of a license plate image and characteristics of the characteristic region, wherein the characteristic region includes a plurality of regions;

[0008] Determining a color type of the feature area according to the feature of the feature area;

[0009] Count the area height histograms of feature areas of different color types respectively;

[0010] A target area in the feature area is determined according to the area height histograms of different color types, and the color type of the target area is output, wherein the target area is the area where the license plate or the license plate sub-image is located.

[0011] Optionally, determining the target area in the feature area according to the area height histograms of different color types includes:

[0012] Counting the average values ​​of two adjacent bins from the area height histograms of different color types respectively, and if the average value is within a first preset value range, recording the height of the target feature area corresponding to the average value;

[0013] Determining the difference in heights of target feature regions of different color types;

[0014] If the difference is within a second preset numerical range, it is determined that the license plate image contains a feature area of ​​the first color type and a feature area of ​​the second color type, and the feature area with a height of [(n1-1)*S, (n1+2)*S] in the feature area of ​​the first color type and the feature area with a height of [(n2-1)*S, (n2+2)*S] in the feature area of ​​the second color type are determined as the target area, wherein n1 is the height index of the feature area of ​​the first color type, and n2 is the height index of the feature area of ​​the second color type;

[0015] If the difference is not within the second preset value range and n1>n2, determine that the license plate image only includes the feature area of ​​the first color type, and determine that the feature area of ​​the first color type with a height of [(n1-1)*S, (n1+2)*S] is the target area;

[0016] If the difference is not within the second preset value range and n1<n2, determine that the license plate image only contains the feature area of ​​the second color type, and determine that the feature area whose height of the feature area of ​​the second color type is [(n2-1)*S, (n2+2)*S] is the target area.

[0017] Optionally, after determining that a feature region with a height of [(n1-1)*S, (n1+2)*S] in the feature region of the first color type and a feature region with a height of [(n2-1)*S, (n2+2)*S] in the feature region of the second color type are the target region, the method further includes:

[0018] Performing vertical and horizontal projection on the license plate image, wherein if a pixel point in the license plate image is located in the first type of area, 1 is added, and if a pixel point in the license plate image is located in the second type of area, 1 is subtracted;

[0019] The license plate image is divided according to the zero-crossing points in the vertical projection and the horizontal projection to obtain a feature region of the first color type and a feature region of the second color type.

[0020] Optionally, respectively counting the region height histograms of the feature regions of different color types includes:

[0021] Set a histogram, where the histogram includes X bins and the moving step is S. H is the height of the license plate image, the range of the nth bin is [n*S, (n+2)*S], 0≤n≤X-1, n is an integer;

[0022] The positions of the feature regions of different color types in the histogram are determined according to the ratios of the heights of the feature regions of different color types to the moving step lengths, so as to obtain the region height histogram.

[0023] Optionally, determining the color type of the characteristic region according to the characteristic of the characteristic region includes:

[0024] The following operations are performed on each region in the feature region, where the region being executed is called the current region:

[0025] Determine the grayscale sum of the current area and the grayscale sum of the feature points of the current area;

[0026] Determine a ratio of the grayscale sum of the feature points of the current region to the number of the feature points as a first average grayscale value of the feature points of the current region, and determine a ratio of a difference between the grayscale sum of the current region and the grayscale sum of the feature points of the current region to a difference between the number of all pixels in the current region and the number of the feature points as a second average grayscale value of the background of the current region;

[0027] If the first average grayscale value is greater than the second average grayscale value, determining that the current region is a characteristic region of the first color type;

[0028] If the first average grayscale value is less than or equal to the second average grayscale value, the current region is determined to be a characteristic region of the second color type.

[0029] Optionally, before respectively calculating the area height histograms of the feature areas of different color types, the method further includes:

[0030] Remove interfering foreground from feature areas of different color types;

[0031] The overlapping areas of the feature areas of different color types are removed.

[0032] Optionally, removing interference foregrounds for feature regions of different color types includes:

[0033] Remove feature areas whose height and width are greater than a preset threshold;

[0034] Removing feature areas whose height is less than a second preset threshold;

[0035] Remove feature areas whose width-to-height ratio does not meet the preset license plate character aspect ratio range;

[0036] The feature area where the ratio of the number of feature points to the area of ​​the feature area is less than a third preset threshold is removed.

[0037] According to another embodiment of the present invention, there is also provided a license plate image processing device, characterized in that it comprises:

[0038] An extraction module, used to extract a characteristic region of a license plate image and characteristics of the characteristic region, wherein the characteristic region includes a plurality of regions;

[0039] A first determining module, configured to determine a color type of the feature area according to a feature of the feature area;

[0040] A statistical module, used to count the area height histograms of feature areas of different color types respectively;

[0041] The second determination module is used to determine the target area in the feature area according to the area height histogram of different color types, and output the color type of the target area, wherein the target area is the area where the license plate or the license plate sub-image is located.

[0042] Optionally, the second determining module includes:

[0043] A recording submodule, used for respectively counting the average values ​​of two adjacent bins from the area height histograms of different color types, and if the average value is within a first preset value range, recording the height of the target feature area corresponding to the average value;

[0044] A first determination submodule is used to determine the height difference of the target feature areas of different color types;

[0045] A second determination submodule is used to determine, if the difference is within a second preset numerical range, that the license plate image contains a feature area of ​​a first color type and a feature area of ​​a second color type, and to determine that a feature area with a height of [(n1-1)*S, (n1+2)*S] in the feature area of ​​the first color type and a feature area with a height of [(n2-1)*S, (n2+2)*S] in the feature area of ​​the second color type are the target area, wherein n1 is a height index of the feature area of ​​the first color type, and n2 is a height index of the feature area of ​​the second color type;

[0046] A third determination submodule is configured to determine that the license plate image only includes a feature area of ​​the first color type, and determine that a feature area of ​​the first color type with a height of [(n1-1)*S, (n1+2)*S] is the target area if the difference is not within the second preset value range and n1>n2;

[0047] The fourth determination submodule is used to determine that the license plate image only contains a feature area of ​​the second color type if the difference is not within the second preset numerical range and n1<n2, and determine that the feature area of ​​the second color type whose height is [(n2-1)*S, (n2+2)*S] is the target area.

[0048] Optionally, the device further comprises:

[0049] A projection submodule, used to perform vertical and horizontal projection on the license plate image, wherein if a pixel point in the license plate image is located in the first type of area, 1 is added, and if a pixel point in the license plate image is located in the second type of area, 1 is subtracted;

[0050] The division submodule is used to divide the license plate image according to the zero-crossing points in the vertical projection and the horizontal projection to obtain the characteristic region of the first color type and the characteristic region of the second color type.

[0051] Optionally, the statistics module includes:

[0052] The setting submodule is used to set a histogram, wherein the histogram includes X bins and the moving step is S. H is the height of the license plate image, the range of the nth bin is [n*S, (n+2)*S], 0≤n≤X-1, n is an integer;

[0053] The fifth determination submodule is used to determine the position of the feature area of ​​different color types in the histogram according to the ratio of the height of the feature area of ​​different color types to the moving step length, so as to obtain the area height histogram.

[0054] Optionally, the first determining module includes:

[0055] The execution submodule is used to perform the following operations on each area in the feature area, wherein the area being executed is called the current area:

[0056] Determine the grayscale sum of the current area and the grayscale sum of the feature points of the current area;

[0057] Determine a ratio of the grayscale sum of the feature points of the current region to the number of the feature points as a first average grayscale value of the feature points of the current region, and determine a ratio of a difference between the grayscale sum of the current region and the grayscale sum of the feature points of the current region to a difference between the number of all pixels in the current region and the number of the feature points as a second average grayscale value of the background of the current region;

[0058] If the first average grayscale value is greater than the second average grayscale value, determining that the current region is a characteristic region of the first color type;

[0059] If the first average grayscale value is less than or equal to the second average grayscale value, it is determined that the current region is a characteristic region of the second color type.

[0060] Optionally, the device further comprises:

[0061] The first removal module is used to remove interference foreground from feature areas of different color types;

[0062] The second removal module is used to remove overlapping areas of the feature areas of different color types.

[0063] Optionally, the first removal module includes:

[0064] A first removal submodule is used to remove feature areas whose height and width are greater than a preset threshold;

[0065] A second removal submodule is used to remove feature areas whose height is less than a second preset threshold;

[0066] The third removal submodule is used to remove feature areas whose width-to-height ratio does not meet a preset license plate character aspect ratio range;

[0067] The fourth removal submodule is used to remove feature areas where the ratio of the number of feature points to the area of ​​the feature area is less than a third preset threshold.

[0068] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0069] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0070] Through the present invention, a characteristic area of ​​a license plate image and the characteristics of the characteristic area are extracted, wherein the characteristic area includes a plurality of areas; the color type of the characteristic area is determined according to the characteristics of the characteristic area; the area height histograms of the characteristic areas of different color types are respectively counted; the target area in the characteristic area is determined according to the area height histograms of the different color types, and the color type of the target area is output, wherein the target area is the area where the license plate or the license plate sub-image is located, which can solve the problem in the related art that the situation in which two color types (dark characters on a bright background and bright characters on a dark background) cannot be handled, the characteristic areas of different color types in the license plate image are detected, statistics are performed respectively, the corresponding target areas are respectively retained, and the corresponding color types are output. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0072] Figure 1 is a hardware structure block diagram of a mobile terminal of a license plate image processing method according to an embodiment of the present invention;

[0073] Figure 2 is a flow chart of a license plate image processing method according to an embodiment of the present invention;

[0074] Figure 3 is a flow chart of determining a license plate color type based on a stable area according to an embodiment of the present invention;

[0075] Figure 4 is a schematic diagram of a feature area of ​​a license plate image according to an embodiment of the present invention;

[0076] Figure 5 is a schematic diagram of color type division of feature areas of a license plate image according to an embodiment of the present invention;

[0077] Figure 6 Schematic diagram of color type determination of a characteristic region of a license plate image according to an embodiment of the present invention Figure 1 ;

[0078] Figure 7 Schematic diagram of color type determination of a characteristic region of a license plate image according to an embodiment of the present invention Figure 2 ;

[0079] Figure 8 is a block diagram of a license plate image processing device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0080] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0081] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0082] Example 1

[0083] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of a mobile terminal of a license plate image processing method according to an embodiment of the present invention, such as Figure 1 As shown, the mobile terminal 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0084] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the message receiving method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0085] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0086] In this embodiment, a license plate image processing method running on the above mobile terminal or network architecture is provided. Figure 2 is a flow chart of a license plate image processing method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0087] Step S202, extracting a characteristic region of the license plate image and features of the characteristic region, wherein the characteristic region includes a plurality of regions;

[0088] Step S204, determining the color type of the feature area according to the feature of the feature area;

[0089] Furthermore, the above step S204 may specifically include:

[0090] The following operations are performed on each region in the feature region, where the region being executed is called the current region:

[0091] Determine the grayscale sum of the current area and the grayscale sum of the feature points of the current area;

[0092] Determine a ratio of the grayscale sum of the feature points of the current region to the number of the feature points as a first average grayscale value of the feature points of the current region, and determine a ratio of a difference between the grayscale sum of the current region and the grayscale sum of the feature points of the current region to a difference between the number of all pixels in the current region and the number of the feature points as a second average grayscale value of the background of the current region;

[0093] If the first average grayscale value is greater than the second average grayscale value, determining that the current region is a characteristic region of the first color type;

[0094] If the first average grayscale value is less than or equal to the second average grayscale value, it is determined that the current region is a characteristic region of the second color type.

[0095] Step S206, respectively counting the area height histograms of the feature areas of different color types;

[0096] Furthermore, the above step S206 may specifically include:

[0097] Set a histogram, where the histogram includes X bins and the moving step is S. H is the height of the license plate image, the range of the nth bin is [n*S, (n+2)*S], 0≤n≤X-1, n is an integer;

[0098] The positions of the feature regions of different color types in the histogram are determined according to the ratios of the heights of the feature regions of different color types to the moving step lengths, so as to obtain the region height histogram.

[0099] Step S208, determining a target area in the feature area according to the area height histograms of different color types, and outputting the color type of the target area, wherein the target area is the area where the license plate or the license plate sub-image is located.

[0100] Furthermore, the above step S208 may specifically include:

[0101] The average values ​​of two adjacent bins are respectively counted from the area height histograms of the different color types. If the average value is within the first preset value range, the height of the target feature area corresponding to the average value is recorded. When counting, count from the area with larger height value forward, that is, count from the area with larger height value toward the direction of smaller X-axis coordinate.

[0102] Determining the difference in heights of target feature regions of different color types;

[0103] If the difference is within a second preset numerical range, it is determined that the license plate image contains a feature area of ​​the first color type and a feature area of ​​the second color type, and the feature area with a height of [(n1-1)*S, (n1+2)*S] in the feature area of ​​the first color type and the feature area with a height of [(n2-1)*S, (n2+2)*S] in the feature area of ​​the second color type are determined as the target area, wherein n1 is the height index of the feature area of ​​the first color type, and n2 is the height index of the feature area of ​​the second color type;

[0104] If the difference is not within the second preset value range and n1>n2, determine that the license plate image only includes the feature area of ​​the first color type, and determine that the feature area of ​​the first color type with a height of [(n1-1)*S, (n1+2)*S] is the target area;

[0105] If the difference is not within the second preset value range and n1<n2, determine that the license plate image only contains the feature area of ​​the second color type, and determine that the feature area whose height of the feature area of ​​the second color type is [(n2-1)*S, (n2+2)*S] is the target area.

[0106] Further, after determining that the feature area with a height of [(n1-1)*S, (n1+2)*S] in the feature area of ​​the first color type and the feature area with a height of [(n2-1)*S, (n2+2)*S] in the feature area of ​​the second color type are the target area, the license plate image is vertically projected and horizontally projected, wherein if a pixel point in the license plate image is located in the first type of area, 1 is added, and if a pixel point in the license plate image is located in the second type of area, 1 is subtracted; the license plate image is divided by the zero-crossing points in the vertical projection and the horizontal projection to obtain the feature area of ​​the first color type and the feature area of ​​the second color type.

[0107] Through the above steps S202 to S208, the characteristic area of ​​the license plate image and the characteristics of the characteristic area are extracted, wherein the characteristic area includes multiple areas; the color type of the characteristic area is determined according to the characteristics of the characteristic area; the regional height histograms of the characteristic areas of different color types are respectively counted; the target area in the characteristic area is determined according to the regional height histograms of the different color types, and the color type of the target area is output, wherein the target area is the area where the license plate or the license plate sub-image is located, which can solve the problem in the related technology that the situation of having two color types (dark characters on a bright background and bright characters on a dark background) in the license plate cannot be handled, the characteristic areas of different color types in the license plate image are detected, and statistics are performed separately, and the corresponding target areas are retained respectively, and the corresponding color types are output.

[0108] Optionally, before respectively counting the area height histograms of the feature areas of different color types, the interfering foreground of the feature areas of different color types is removed, and further, the feature areas whose height and width are greater than a preset threshold are removed, the feature areas whose height is less than a second preset threshold are removed, the feature areas whose ratio of width to height does not conform to the preset license plate character aspect ratio range are removed, and the feature areas where the proportion of the number of feature points to the area of ​​the feature area is less than a third preset threshold are removed; and the overlapping areas of the feature areas of the different color types are removed.

[0109] In the embodiment of the present invention, the color type of the license plate is determined based on the stable area (i.e., the characteristic area). Figure 3 is a flow chart of determining the color type of a license plate based on a stable region according to an embodiment of the present invention. Figure 3 As shown, the following steps are included:

[0110] Step S301, extracting characteristic regions and features of the license plate image, specifically, using the Maximally Stable Extremal Regions (MSER) ​​method to extract stable regions and features; Figure 4 is a schematic diagram of a feature area of ​​a license plate image according to an embodiment of the present invention. Figure 4 As shown, the identified feature area is marked with a box.

[0111] Step S302, judging the color type of each region according to the characteristics of each stable region, specifically includes:

[0112] 1) Use the following formula to calculate the grayscale sum of the i-th region

[0113]

[0114] Among them, R i is the set of all pixels in the ith region, and gray(x,y) is the grayscale value at the point (x,y).

[0115] 2) Use the following formula to calculate the grayscale and feature points of the i-th region

[0116]

[0117] Among them, f i are all the feature points in the ith region, and gray(x,y) is the grayscale value at point (x,y).

[0118] 3) Use the following formula to calculate the average gray value of the foreground (feature point) of the i-th region:

[0119] Among them, N(f i ) is the number of feature points in the i-th region.

[0120] 4) Use the following formula to calculate the average gray value of the background of the i-th region:

[0121]

[0122] Among them, N(R i ) is the number of all pixels in the ith region.

[0123] 5) All regions are divided into two categories using the following formula:

[0124]

[0125] Among them, 0 means that the i-th area is a dark background with bright characters, and 1 means that the area is a light background with dark characters, so all areas are divided into two categories.

[0126] Figure 5 is a schematic diagram of color type division of feature areas of a license plate image according to an embodiment of the present invention, such as Figure 5 As shown, different color types are identified by different frames, the solid line frame indicates dark text on a light background, and the dotted line frame indicates light text on a dark background.

[0127] Step S303, removing the interfering foreground for each type of area, including: removing areas with too large height and width; removing areas with too small height; removing areas whose aspect ratio does not conform to the aspect ratio range of the license plate characters; removing areas where the number of feature points accounts for too small a proportion of the area.

[0128] Step S304, removing overlapping areas for each type of area, including: removing the smaller area among the areas with overlapping areas exceeding 90%; removing the outer area if the area contains multiple nested areas and the horizontal overlap between the nested areas is small; removing all the nested areas if the area contains multiple nested areas and the overlap between the nested areas is large.

[0129] Step S305, counting the area height histogram corresponding to each type of area, as follows:

[0130] 1) The minimum height is 0, the maximum is the license plate image height H, the histogram is set to 21 bins (that is, the above X is set to 21), and the moving step is set to

[0131] 2) The range of the nth bin is set to [n*S, (n+2)*S], which means there is a certain amount of overlapping information between bins;

[0132] 3) The i-th area is based on the height h i / S value, determine which two bins it falls into, and thus update the histogram value;

[0133] Step S306, retaining the area corresponding to the main height, specifically includes:

[0134] 1) For the two histograms obtained above, the average values ​​of the two adjacent bins are counted from the area with larger histogram height values. When the value meets the character number range, stop and record the indexes n1 and n2, or the index corresponding to the maximum average value is obtained.

[0135] 2) Figure 6 Schematic diagram of color type determination of a characteristic region of a license plate image according to an embodiment of the present invention Figure 1 ,like Figure 6As shown, if the difference between n1 and n2 is in the range of [-2,2], it proves that the license plate contains two types of characters at the same time. For the two types of areas, all areas with heights in the range of [(n1-1)*S, (n1+2)*S] and [(n2-1)*S, (n2+2)*S] are retained respectively, that is, the characters marked by the solid line box and the dotted line box are retained at the same time; Figure 7 Schematic diagram of color type determination of a characteristic region of a license plate image according to an embodiment of the present invention Figure 2 ,like Figure 7 As shown, if n1 and n2 differ greatly, when n1>n2, the area with the first type of height in the range of [(n1-1)*S, (n1+2)*S] is retained, that is, only the characters marked by the solid line frame are retained; otherwise, the area with the second type of height in the range of [(n2-1)*S, (n2+2)*S] is retained.

[0136] Step S307, vertical projection and horizontal projection, specifically, vertical projection, divides the license plate vertically according to the area type; horizontal projection, divides the license plate horizontally according to the area type. Specifically, scan the entire image from left to right and from top to bottom, add 1 to the points falling in the first type of area, and subtract 1 from the points falling in the second type of area, to obtain horizontal and vertical projections respectively. Use the zero-crossing points in the vertical and horizontal projections (the positive and negative points before and after the point are different) to divide the image.

[0137] If only one type of area is retained, simply skip outputting the color type.

[0138] Step S308, output the color type of the license plate image. Specifically, based on whether the license plate is a dark background with bright characters, a bright background with dark characters, or a mixed type, determine which part of the mixed type license plate is a dark background with bright characters and which part is a light background with dark characters, and then output it.

[0139] Example 2

[0140] According to another embodiment of the present invention, a license plate image processing device is also provided. Figure 8 is a block diagram of a license plate image processing device according to an embodiment of the present invention. Figure 8 As shown, including:

[0141] An extraction module 82, used to extract a characteristic region of a license plate image and characteristics of the characteristic region, wherein the characteristic region includes a plurality of regions;

[0142] A first determining module 84, configured to determine a color type of the feature area according to a feature of the feature area;

[0143] A statistics module 86, used for respectively counting the area height histograms of feature areas of different color types;

[0144] The second determination module 88 is used to determine the target area in the feature area according to the area height histograms of different color types, and output the color type of the target area, wherein the target area is the area where the license plate or the license plate sub-image is located.

[0145] Optionally, the second determining module 88 includes:

[0146] A recording submodule, used for respectively counting the average values ​​of two adjacent bins from the area height histograms of different color types, and if the average value is within a first preset value range, recording the height of the target feature area corresponding to the average value;

[0147] A first determination submodule is used to determine the height difference of the target feature areas of different color types;

[0148] A second determination submodule is used to determine, if the difference is within a second preset numerical range, that the license plate image contains a feature area of ​​a first color type and a feature area of ​​a second color type, and to determine that a feature area with a height of [(n1-1)*S, (n1+2)*S] in the feature area of ​​the first color type and a feature area with a height of [(n2-1)*S, (n2+2)*S] in the feature area of ​​the second color type are the target area, wherein n1 is a height index of the feature area of ​​the first color type, and n2 is a height index of the feature area of ​​the second color type;

[0149] A third determination submodule is configured to determine that the license plate image only includes a feature area of ​​the first color type, and determine that a feature area of ​​the first color type with a height of [(n1-1)*S, (n1+2)*S] is the target area if the difference is not within the second preset value range and n1>n2;

[0150] The fourth determination submodule is used to determine that the license plate image only contains a feature area of ​​the second color type if the difference is not within the second preset numerical range and n1<n2, and determine that the feature area of ​​the second color type whose height is [(n2-1)*S, (n2+2)*S] is the target area.

[0151] Optionally, the device further comprises:

[0152] A projection submodule, used to perform vertical and horizontal projection on the license plate image, wherein if a pixel point in the license plate image is located in the first type of area, 1 is added, and if a pixel point in the license plate image is located in the second type of area, 1 is subtracted;

[0153] The division submodule is used to divide the license plate image according to the zero-crossing points in the vertical projection and the horizontal projection to obtain the characteristic region of the first color type and the characteristic region of the second color type.

[0154] Optionally, the statistics module 86 includes:

[0155] The setting submodule is used to set a histogram, wherein the histogram includes X bins and the moving step is S. H is the height of the license plate image, the range of the nth bin is [n*S, (n+2)*S], 0≤n≤X-1, n is an integer;

[0156] The fifth determination submodule is used to determine the position of the feature area of ​​different color types in the histogram according to the ratio of the height of the feature area of ​​different color types to the moving step length, so as to obtain the area height histogram.

[0157] Optionally, the first determining module 84 includes:

[0158] The execution submodule is used to perform the following operations on each area in the feature area, wherein the area being executed is called the current area:

[0159] Determine the grayscale sum of the current area and the grayscale sum of the feature points of the current area;

[0160] Determine a ratio of the grayscale sum of the feature points of the current region to the number of the feature points as a first average grayscale value of the feature points of the current region, and determine a ratio of a difference between the grayscale sum of the current region and the grayscale sum of the feature points of the current region to a difference between the number of all pixels in the current region and the number of the feature points as a second average grayscale value of the background of the current region;

[0161] If the first average grayscale value is greater than the second average grayscale value, determining that the current region is a characteristic region of the first color type;

[0162] If the first average grayscale value is less than or equal to the second average grayscale value, it is determined that the current region is a characteristic region of the second color type.

[0163] Optionally, the device further comprises:

[0164] The first removal module is used to remove interference foreground from feature areas of different color types;

[0165] The second removal module is used to remove overlapping areas of the feature areas of different color types.

[0166] Optionally, the first removal module includes:

[0167] A first removal submodule is used to remove feature areas whose height and width are greater than a preset threshold;

[0168] A second removal submodule is used to remove feature areas whose height is less than a second preset threshold;

[0169] The third removal submodule is used to remove feature areas whose width-to-height ratio does not meet a preset license plate character aspect ratio range;

[0170] The fourth removal submodule is used to remove feature areas where the ratio of the number of feature points to the area of ​​the feature area is less than a third preset threshold.

[0171] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0172] Example 3

[0173] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0174] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0175] S1, extracting a characteristic region of a license plate image and characteristics of the characteristic region, wherein the characteristic region includes a plurality of regions;

[0176] S2, determining the color type of the feature area according to the feature of the feature area;

[0177] S3, respectively counting the regional height histograms of feature regions of different color types;

[0178] S4, determining a target area in the feature area according to the area height histograms of different color types, and outputting the color type of the target area, wherein the target area is an area where a license plate or a license plate sub-image is located.

[0179] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0180] Example 4

[0181] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0182] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0183] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0184] S1, extracting a characteristic region of a license plate image and characteristics of the characteristic region, wherein the characteristic region includes a plurality of regions;

[0185] S2, determining the color type of the feature area according to the feature of the feature area;

[0186] S3, respectively counting the regional height histograms of feature regions of different color types;

[0187] S4, determining a target area in the feature area according to the area height histograms of different color types, and outputting the color type of the target area, wherein the target area is an area where a license plate or a license plate sub-image is located.

[0188] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0189] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0190] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A license plate image processing method, characterized in that: include: Extracting a characteristic region of a license plate image and characteristics of the characteristic region, wherein the characteristic region includes a plurality of regions; Determining a color type of the characteristic region according to the characteristics of the characteristic region, wherein the color type includes dark characters on a bright background and bright characters on a dark background; Counting the area height histograms of feature areas of different color types respectively, including: setting a histogram, wherein the histogram includes X bins, the moving step length is S, H is the height of the license plate image, the range of the nth bin is [n*S, (n+2)*S], 0≤n≤X-1, and n is an integer; the position of the feature area of ​​different color types in the histogram is determined according to the ratio of the height of the feature area of ​​different color types to the moving step length, and the area height histogram is obtained; Determine a target area in the feature area according to the area height histograms of different color types, and output the color type of the target area, wherein the target area is the area where the license plate or the license plate sub-image is located; Wherein, determining the target area in the feature area according to the area height histograms of different color types includes: The average values ​​of two adjacent bins are respectively counted from the height histograms of the regions of different color types. If the average value is within a first preset numerical range, the height of the target feature region corresponding to the average value is recorded; the difference in heights of the target feature regions of different color types is determined; if the difference is within a second preset numerical range, it is determined that the license plate image contains a feature region of the first color type and a feature region of the second color type, and the feature region with a height of [(n1-1)*S, (n1+2)*S] in the feature region of the first color type and the feature region with a height of [(n2-1)*S, (n2+2)*S] in the feature region of the second color type are determined as the target region, wherein n1 is n2 is the height index of the feature area of ​​the first color type, and n1 is the height index of the feature area of ​​the second color type; if the difference is not within the second preset numerical range and n1>n2, it is determined that the license plate image only contains the feature area of ​​the first color type, and the feature area with a height of [(n1-1)*S, (n1+2)*S] in the feature area of ​​the first color type is determined to be the target area; if the difference is not within the second preset numerical range and n1<n2, it is determined that the license plate image only contains the feature area of ​​the second color type, and the feature area with a height of [(n2-1)*S, (n2+2)*S] in the feature area of ​​the second color type is determined to be the target area.

2. The method according to claim 1, characterized in that After determining that the feature area with a height of [(n1-1)*S, (n1+2)*S] in the feature area of ​​the first color type and the feature area with a height of [(n2-1)*S, (n2+2)*S] in the feature area of ​​the second color type are the target area, the method further includes: Performing vertical and horizontal projection on the license plate image, wherein if a pixel point in the license plate image is located in the first type of area, 1 is added, and if a pixel point in the license plate image is located in the second type of area, 1 is subtracted; The license plate image is divided according to the zero-crossing points in the vertical projection and the horizontal projection to obtain a feature region of the first color type and a feature region of the second color type.

3. The method according to claim 1, characterized in that: Determining the color type of the feature area according to the feature of the feature area includes: The following operations are performed on each region in the feature region, where the region being executed is called the current region: Determine the grayscale sum of the current area and the grayscale sum of the feature points of the current area; Determine a ratio of the grayscale sum of the feature points of the current region to the number of the feature points as a first average grayscale value of the feature points of the current region, and determine a ratio of a difference between the grayscale sum of the current region and the grayscale sum of the feature points of the current region to a difference between the number of all pixels in the current region and the number of the feature points as a second average grayscale value of the background of the current region; If the first average grayscale value is greater than the second average grayscale value, determining that the current region is a characteristic region of the first color type; If the first average grayscale value is less than or equal to the second average grayscale value, the current region is determined to be a characteristic region of the second color type.

4. The method according to any one of claims 1 to 3, characterized in that Before respectively calculating the area height histograms of the feature areas of different color types, the method further includes: Remove interfering foreground from feature areas of different color types; The overlapping areas of the feature areas of different color types are removed.

5. The method according to claim 4, characterized in that The foreground of removing interference from feature areas of different color types includes: Remove feature areas whose height and width are greater than a preset threshold; Removing feature areas whose height is less than a second preset threshold; Remove feature areas whose width-to-height ratio does not meet the preset license plate character aspect ratio range; The feature area where the ratio of the number of feature points to the area of ​​the feature area is less than a third preset threshold is removed.

6. A license plate image processing device, characterized in that: include: An extraction module, used to extract a characteristic region of a license plate image and characteristics of the characteristic region, wherein the characteristic region includes a plurality of regions; A first determination module is used to determine the color type of the feature area according to the characteristics of the feature area, wherein the color type includes light background with dark characters and dark background with light characters; A statistical module is used to count the area height histograms of feature areas of different color types respectively, including: setting a histogram, wherein the histogram includes X bins, the moving step is S, H is the height of the license plate image, the range of the nth bin is [n*S, (n+2)*S], 0≤n≤X-1, and n is an integer; the position of the feature area of ​​different color types in the histogram is determined according to the ratio of the height of the feature area of ​​different color types to the moving step length, and the area height histogram is obtained; A second determination module is used to determine a target area in the feature area according to the area height histograms of different color types, and output the color type of the target area, wherein the target area is an area where a license plate or a license plate sub-image is located; A recording submodule, used for respectively counting the average values ​​of two adjacent bins from the area height histograms of different color types, and if the average value is within a first preset value range, recording the height of the target feature area corresponding to the average value; A first determination submodule is used to determine the height difference of the target feature areas of different color types; A second determination submodule is used to determine, if the difference is within a second preset numerical range, that the license plate image contains a feature area of ​​a first color type and a feature area of ​​a second color type, and to determine that a feature area with a height of [(n1-1)*S, (n1+2)*S] in the feature area of ​​the first color type and a feature area with a height of [(n2-1)*S, (n2+2)*S] in the feature area of ​​the second color type are the target area, wherein n1 is a height index of the feature area of ​​the first color type, and n2 is a height index of the feature area of ​​the second color type; A third determination submodule is configured to determine that the license plate image only includes a feature area of ​​the first color type, and determine that a feature area of ​​the first color type with a height of [(n1-1)*S, (n1+2)*S] is the target area if the difference is not within the second preset value range and n1>n2; The fourth determination submodule is used to determine that the license plate image only contains a feature area of ​​the second color type if the difference is not within the second preset numerical range and n1<n2, and determine that the feature area of ​​the second color type whose height is [(n2-1)*S, (n2+2)*S] is the target area.

7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 5 when executed.

8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Location method of plate number based on difference and color pair characteristic point

    CN101866553A

  • License plate image locating method and device

    CN103093181A

  • License plate color judging method based on Bayes classifier

    CN104834937A

  • Method and device for positioning license plate image

    WO2013063820A1

  • License plate enhancement method, apparatus and electronic device

    WO2019201184A1