CN111476233A - License plate number positioning method and device - Google Patents
License plate number positioning method and device Download PDFInfo
- Publication number
- CN111476233A CN111476233A CN202010171194.7A CN202010171194A CN111476233A CN 111476233 A CN111476233 A CN 111476233A CN 202010171194 A CN202010171194 A CN 202010171194A CN 111476233 A CN111476233 A CN 111476233A
- Authority
- CN
- China
- Prior art keywords
- license plate
- plate number
- connected domain
- image
- curve
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000007781 pre-processing Methods 0.000 claims abstract description 18
- 238000010801 machine learning Methods 0.000 claims abstract description 12
- 238000012545 processing Methods 0.000 claims description 21
- 230000000877 morphologic effect Effects 0.000 claims description 14
- 238000012549 training Methods 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000000354 decomposition reaction Methods 0.000 claims description 6
- 238000012706 support-vector machine Methods 0.000 claims description 6
- 238000004458 analytical method Methods 0.000 claims description 4
- 238000000605 extraction Methods 0.000 claims description 2
- 238000004891 communication Methods 0.000 claims 2
- 230000006872 improvement Effects 0.000 description 8
- 230000011218 segmentation Effects 0.000 description 8
- 230000008569 process Effects 0.000 description 7
- 230000006870 function Effects 0.000 description 6
- 238000004590 computer program Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 3
- 238000003708 edge detection Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 206010039203 Road traffic accident Diseases 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 239000002131 composite material Substances 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000002790 cross-validation Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 230000010339 dilation Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000000630 rising effect Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/60—Type of objects
- G06V20/62—Text, e.g. of license plates, overlay texts or captions on TV images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2411—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/40—Image enhancement or restoration using histogram techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/60—Analysis of geometric attributes
- G06T7/62—Analysis of geometric attributes of area, perimeter, diameter or volume
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10024—Color image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V20/00—Scenes; Scene-specific elements
- G06V20/60—Type of objects
- G06V20/62—Text, e.g. of license plates, overlay texts or captions on TV images
- G06V20/625—License plates
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Multimedia (AREA)
- Geometry (AREA)
- Medical Informatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a method for positioning a license plate number, which comprises the following steps: converting the license plate image from an RGB color space to a YCrCb color space, and acquiring a hue histogram; performing curve fitting on the tone histogram by adopting a least squares method to obtain an optimal fitting curve; dividing the license plate image into a plurality of image layers by taking each maximum value of the optimal fitting curve as a representative tone; preprocessing each layer of the license plate image, and extracting alternative license plate number information connected domains; and performing machine learning classification and judgment on the alternative license plate number information connected domain to locate and obtain a license plate number region. The invention also discloses a corresponding license plate number positioning device, and by adopting the embodiment of the invention, the license plate number in a complex environment can be accurately positioned based on the color information of the color image, so that the license plate number positioning accuracy is effectively improved, and the method has higher universality.
Description
Technical Field
The invention relates to the technical field of image recognition, in particular to a license plate number positioning method and device.
Background
With the rapid development of science and technology, urban traffic problems are increasingly prominent, and vehicles must be strictly supervised in order to maintain road traffic order and reduce traffic accidents. The vehicle license plate recognition technology is also developed, and the main task of the technology is to monitor and process vehicles, quickly and intelligently recognize license plate numbers and output the license plate numbers to a database for unified management.
The existing license plate area positioning method is based on edge detection, and utilizes edge or edge density to detect the license plate of an automobile, and combines edge detection through a multi-edge detection algorithm to realize the positioning of the license plate number. However, in the process of implementing the invention, the inventor finds that the prior art has at least the following problems: the real scene is often relatively complicated, most license plate numbers are embedded in a complicated image background, the accuracy of extracting the license plate numbers is seriously influenced by a large number of non-text edges in a complicated environment, and meanwhile, the method in the prior art can lose more color information and further influences the accuracy of extracting the license plate numbers. Therefore, how to rapidly and accurately segment and extract the license plate number under the complex image background has wide application prospect and research value.
Disclosure of Invention
The embodiment of the invention aims to provide a license plate number positioning method and a license plate number positioning device, which can accurately position a license plate number in a complex environment based on color information of a color image, effectively improve the accuracy of license plate number positioning and have higher universality.
In order to achieve the above object, an embodiment of the present invention provides a method for positioning a license plate number, including:
converting the license plate image from an RGB color space to a YCrCb color space, and acquiring a hue histogram;
performing curve fitting on the tone histogram by adopting a least squares method to obtain an optimal fitting curve;
dividing the license plate image into a plurality of image layers by taking each maximum value of the optimal fitting curve as a representative tone;
preprocessing each layer of the license plate image, and extracting alternative license plate number information connected domains;
and performing machine learning classification and judgment on the alternative license plate number information connected domain to locate and obtain a license plate number region.
As an improvement of the above scheme, dividing the license plate image into a plurality of image layers by using each maximum value of the best fit curve as a representative tone specifically includes:
obtaining an interval consisting of two adjacent inflection points of each maximum value on the optimal fitting curve;
and defining image pixels corresponding to all tone phase values in each interval as a layer so as to decompose the license plate image into a plurality of layers.
As an improvement of the above scheme, the preprocessing each layer of the license plate image and extracting a candidate license plate number information connected domain specifically includes:
carrying out binarization processing on each layer of the license plate image, and carrying out morphological processing on the binarized layer;
acquiring a connected domain with the area, width and height meeting preset thresholds in the image layer after the morphological processing as a first connected domain;
and performing projection analysis on the first connected domain to obtain the first connected domain with a projection curve with obvious wave crests and wave troughs as the alternative license plate number information connected domain.
As an improvement of the above scheme, in the map layer after the morphological processing, acquiring a connected domain whose area, width, and height all meet a preset threshold as a first connected domain specifically includes:
marking all connected domains in the map layer after the morphological processing;
calculating the area ratio and the height-width ratio of each connected domain; wherein the area ratio represents the ratio of the area of the connected domain to the area of the layer where the connected domain is located, and the aspect ratio represents the ratio of the height to the width of the connected domain;
and acquiring a connected domain of which the area ratio accords with a preset area ratio and the height-width ratio accords with a preset height-width ratio as the first connected domain.
As an improvement of the above, the morphological treatment comprises:
performing filling operation by adopting a horizontal linear operator and a vertical linear operator with a first preset size;
and performing expansion operation by adopting a structural operator with a second preset size.
As an improvement of the above scheme, machine learning classification and discrimination are performed on the alternative license plate number information connected domain to locate and obtain a license plate number region, which specifically includes:
performing wavelet decomposition on the alternative license plate number information connected domain, and calculating the amplitude-frequency characteristic vector of the alternative license plate number information connected domain;
and taking the amplitude-frequency characteristic vector obtained by calculation as an input vector of a preset license plate number classifier, and positioning the license plate number region according to a classification output result of the license plate number classifier.
As an improvement of the above scheme, the performing wavelet decomposition on the alternative license plate number information connected domain to calculate the amplitude-frequency feature vector of the alternative license plate number information connected domain specifically includes:
converting the layer where the alternative license plate number information connected domain is located to a wavelet domain;
setting a sliding window of size W × H by a sliding step l1×l2(l1∈[1,W],l2[1,H]) Scanning the high-frequency sub-band of the alternative license plate number information connected domain;
calculating the statistical characteristic value of each high-frequency sub-band of the alternative license plate number information connected domain in each sliding window area; wherein the statistical characteristic values comprise the mean, mean square error, energy and inertia of the high-frequency wavelet coefficients;
and constructing the amplitude-frequency characteristic vector by taking the statistical characteristic value of each high-frequency sub-band of the alternative license plate number information connected domain as a component.
As an improvement of the above scheme, the license plate number classifier is obtained by the following steps:
dividing a connected domain obtained by preprocessing a plurality of sample images into a license plate number area and a non-license plate number area as a training data set;
importing the training data set into a preset classifier model, and performing classification training on the preset classifier model to obtain the license plate number classifier; wherein the classifier model is a Support Vector Machine (SVM).
As an improvement of the above scheme, the performing curve fitting on the tone histogram by using a least squares method to obtain an optimal fitting curve specifically includes:
performing curve fitting on the tone histogram according to preset iteration orders, and calculating the error square sum of each order fitting;
selecting the order with the minimum fitted error square sum in all orders as the optimal fitting order;
and obtaining the curve of the optimal fitting order fitting as the optimal fitting curve.
The embodiment of the invention also provides a positioning device for the license plate number, which comprises:
the hue histogram acquisition module is used for converting the license plate image from an RGB color space to a YCrCb color space and acquiring a hue histogram;
the curve fitting module is used for performing curve fitting on the tone histogram by adopting a least squares method to obtain an optimal fitting curve;
the layer dividing module is used for dividing the license plate image into a plurality of layers by taking each maximum value of the optimal fitting curve as a representative tone;
the connected domain extraction module is used for preprocessing each layer of the license plate image and extracting alternative license plate number information connected domains;
and the license plate number positioning module is used for performing machine learning judgment on the alternative license plate number information connected domain so as to position and obtain a license plate number region.
Compared with the prior art, the license plate number positioning method disclosed by the invention has the advantages that the color information of the license plate image is well reserved by converting the RGB color space of the license plate image into the YCrCb color space and acquiring the hue histogram. Then, performing curve fitting on the tone histogram by adopting a least squares method to obtain an optimal fitting curve; and dividing the license plate image into a plurality of image layers by taking each maximum value of the optimal fitting curve as a representative tone, carrying out color clustering segmentation on the color image, and further positioning license plate number information. And finally, preprocessing each image layer of the license plate image, extracting alternative license plate number information connected domains, and performing machine learning classification judgment on the alternative license plate number information connected domains to locate and obtain a license plate number region. Based on the color information of the color image, the license plate number in a complex environment is accurately positioned, the influence of background noise and non-text edges in the license plate image on the license plate number positioning process is reduced, the license plate number positioning accuracy is effectively improved, and the method has high universality.
Drawings
Fig. 1 is a schematic flowchart illustrating steps of a license plate number positioning method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the distribution of color information in the UV plane in an embodiment of the present invention;
FIG. 3 is a flow chart illustrating the steps of fitting a best fit curve in an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a step of dividing layers according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating a step of layer preprocessing and extracting a reserved license plate number information connection domain according to an embodiment of the present invention;
FIG. 6 is a flowchart illustrating steps for locating a license plate number region according to an embodiment of the present invention;
FIG. 7 is a flowchart illustrating the steps of calculating amplitude-frequency eigenvectors in an embodiment of the invention;
fig. 8 is a schematic structural diagram of a license plate number positioning device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow chart illustrating steps of a license plate number positioning method according to embodiment 1 of the present invention. The method for positioning the license plate number provided by the embodiment of the invention comprises the following steps of S1-S5:
and S1, converting the license plate image from an RGB color space to a YCrCb color space, and acquiring a tone histogram.
Specifically, the conversion of the RGB color space to the YCrCb color space satisfies the following calculation formula:
Y=0.299R+0.587G+0.114B
U=k1(B-Y);
V=k2(R-Y)
wherein k is1、k2Respectively being blue and red primary colorsThe color difference compression factor of (1). Preferably, k is1、k2Values are respectively k1=0.493,k20.877. The Y component is a luminance signal of a color, U, V are two chrominance signals orthogonal to each other, and (B-Y) and (R-Y) are two color difference signals.
The color signal can be regarded as being a composite of a luminance signal and a chrominance signal. The chrominance signals U and V form a two-dimensional vector in a two-dimensional plane space, the modulus F of whichmRepresenting the saturation of the color, and reflecting the sizes of R, G and B; phase valueRepresents the color tone and shows the proportion of R, G and B.
referring to fig. 2, a schematic diagram of the distribution of color information in the UV plane in the embodiment of the present invention is shown.
In the embodiment of the invention, the hue phase valueHas positive and negative components, and is unified to [0 DEG, 360 DEG ]]Within the range of (1), the phases of all the obtained pixel points are all in [0 degrees ] and 360 degrees DEG after the processing]And a foundation is laid for color classification. Hue phase valueAfter being unified, the following formula is satisfied:
in the embodiment of the invention, the YCrCb space decomposes the image into a luminance signal Y and two chrominance signals U, V, which are independent from each other, and the color information in the license plate image can be better preserved by converting the license plate image from an RGB color space to a YCrCb color space. Compared with the prior art, the method has the advantages of high correlation among components in the RGB color space or the HSV color space, more redundant information and large calculation amount. Therefore, the YCrCb color space is selected to perform color clustering segmentation on the color image, and the accuracy of license plate recognition can be improved.
Further, after the license plate image is converted into the YCrCb color space, a hue histogram needs to be obtained. In the aspect of color feature representation, directly taking the tone as the color feature of the image, the corresponding tone histogram, the tone phase value in the YCrCb space can be obtainedRepresenting hue information, hue phase valueCorresponding to the hue. In the tone histogram, the abscissa is [0, 2 π ]]Phase value ofThe ordinate represents the number of pixels corresponding to the phase value in the image. The tone histogram is used for describing the statistical distribution characteristics of image tones and has the invariance of translation, scale and rotation.
And S2, performing curve fitting on the tone histogram by adopting a least squares method to obtain an optimal fitting curve.
Specifically, in order to facilitate clustering segmentation of images by using a tone histogram, a histogram fitting algorithm based on a least squares method is used for processing to obtain a fitting curve. The principle of the least squares method is as follows:
given a set of data (x)i,yi) (i-0, 1, …, m), in function classFind a function y ═ S*(x) So that the sum of squared errors is minimal:
wherein,generally, the function class is mostly performed by using a polynomial, and the least squares method is used to obtain a curve fit, that is, in S (x), a function y is obtained as S*(x) The sum of squared errors is minimized.
As a preferred implementation, refer to FIG. 3, which is a schematic flow chart of the steps of fitting the best-fit curve in the embodiment of the present invention. Step S2 is performed by steps S21 to S23:
and S21, performing curve fitting on the tone histogram according to a preset iteration order N, and calculating the error square sum of each order fitting.
And S22, selecting the order with the minimum fitted error square sum in all orders as the optimal fitting order.
And S23, obtaining the curve of the optimal fitting order fitting as the optimal fitting curve.
The preset iteration order N is greater than or equal to 1, and may be set or adjusted according to actual operation requirements, which is not specifically limited herein.
In the embodiment of the invention, the tone histogram does not show obvious peak-valley characteristics and is not suitable for the implementation of a segmentation algorithm, so that the tone histogram is subjected to curve fitting to obtain an optimal fitting curve. The optimal fitting curve can well represent the tone distribution of the image, has a good peak characteristic and is convenient for the next step of image layering work.
And S3, dividing the license plate image into a plurality of image layers by taking each maximum value of the optimal fitting curve as a representative tone.
The best fit curve has a good peak characteristic, each peak representing a relatively concentrated tone distribution of the image. By taking each maximum value as a representative tone, the license plate image is divided into a plurality of layers, and the license plate number information is distributed in one or more layers.
As a preferred implementation manner, refer to fig. 4, which is a schematic flow chart of a step of dividing a layer in an embodiment of the present invention. Step S3 is performed by steps S31 to S32:
and S31, acquiring an interval formed by two adjacent inflection points of each maximum value on the optimal fitting curve.
And S32, defining image pixels corresponding to all the tone phase values in each interval as a layer, so as to decompose the license plate image into a plurality of layers.
Specifically, for the best-fit curve y ═ S (x), the second derivative y ═ S ″ (x) ═ 0 is calculated in the interval [0, 2 pi ═ 0]All real solutions x withini(i=1,2,3,…,n0) Wherein n is0The number of solutions for all real numbers. Determine all real solutions { x }iAnd (4) signs of adjacent second derivative values at the left side and the right side are opposite, and when the signs at the two sides are opposite, the point where the real solution is located is determined as an inflection point. Let all the turning points be xj(j=1,2,3,…,n1) Wherein n is1The number of all the inflection points.
Selecting two inflection points x adjacent to the maximum of the best-fit curve y ═ S (x)jAnd xj+1Obtaining the position in the interval [ x ]j,xj]All hue phase values withinThen all hue phase values are comparedAnd redefining the corresponding image pixels into one layer, so as to decompose the license plate image into a plurality of new layers. The number of the new image layers is equal to the number of the maximum value points of the optimal fitting curve.
In the embodiment of the invention, the condition that the color of the license plate number is not much different from the background color is considered, the inflection point between the maximum value and the minimum value on the optimal fitting curve is used as the optimal critical value point, and the rising (or falling) trends of the curve before and after the inflection point are different according to the inflection point characteristic, so that a better segmentation effect can be obtained by using the inflection point, the license plate number information area is reserved to the maximum extent, the noise influence caused by the color similarity between the background area and the license plate number area is reduced, and the accuracy of license plate number positioning is improved. Meanwhile, multi-critical value clustering is carried out by using the inflection point, repeated iteration is not needed, and parameters do not need to be set by manual participation, so that self-adaptive processing can be realized, and the operation is more convenient.
S4, preprocessing each layer of the license plate image, and extracting alternative license plate number information connected domains.
The color layer where the license plate number area is located can be effectively extracted by utilizing the hue histogram, but a large amount of noise interference still exists in other non-license plate layers. And further preprocessing all the image layers obtained after segmentation to remove background noise, and further filling and repairing the license plate image to obtain a complete license plate image, so that the accuracy of license plate number region detection is improved.
As a preferred embodiment, refer to fig. 5, which is a schematic flow chart illustrating steps of layer preprocessing and extracting a spare license plate number information connected domain in an embodiment of the present invention. Step S4 is performed by steps S41 to S43:
and S41, performing binarization processing on each image layer of the license plate image, and performing morphological processing on the binarized image layer.
The morphological processing comprises filling processing and expansion processing, filling operation is carried out by adopting a horizontal linear operator and a vertical linear operator with a first preset size, holes are filled in the segmented picture, broken character strokes are repaired, then expansion operation is carried out by adopting a structural operator with a second preset size, and noise in the background of the picture layer is removed.
The first preset size and the second preset size may be set or adjusted according to a conventional technical means in the art, and are not specifically limited herein.
Preferably, a structuring operator of size 2 × 2 is selected for the dilation operation.
By adopting the embodiment of the invention, a more complete license plate image can be obtained, and the license plate number area is more obvious.
And S42, acquiring a connected domain with the area, width and height meeting preset thresholds in the map layer after the morphological processing as a first connected domain.
In the embodiment of the invention, various license plate number characteristics in the connected domain are extracted by marking the connected domain in the preprocessed layer, and the license plate number information connected domain and the non-license plate number information connected domain can be well distinguished by utilizing the combination of the license plate number characteristics, so that the obvious non-license plate number information connected domain is removed.
Specifically, step S42 includes:
and S421, marking all connected domains in the map layer after the morphological processing.
S422, calculating the area ratio K of each connected domainAreaAnd an aspect ratio KAspect. The area ratio represents the ratio of the area of the connected domain to the area of the layer where the connected domain is located, and the aspect ratio represents the ratio of the height to the width of the connected domain. The formula is specifically satisfied:
KArea=Area(cc)/Area(pic);
KAspect=H(cc)/W(pic);
wherein, area (cc) and area (pic) are the area of the connected domain and the area of the layer where the connected domain is located, H (cc) and W (pic) are the height and width of the connected domain.
And S423, acquiring a connected domain, as the first connected domain, of which the area ratio meets a preset area ratio and the height-to-width ratio meets a preset height-to-width ratio.
In general, the area of the character connected domain is not too large, the height and width of the connected domain are similar, the area ratio can exclude the non-character connected domain with too large area, and the height-width ratio can exclude the connected domain without the license plate number characteristics.
Preferably, the predetermined area ratio is in the interval [0, 0.1 ]]The preset aspect ratio value is in the interval [0.5,5 ]]. Therefore, when the area ratio satisfies KArea<0.1, and the aspect ratio satisfies 0.5<KAspect<And 5, the connected domain initially meets the requirement of the alternative license plate number information connected domain, and is marked as a first connected domain. And taking the connected domain which does not meet the requirement as a non-license number information connected domain, and eliminating the layer where the non-license number information connected domain is located.
S43, performing projection analysis on the first connected domain to obtain the first connected domain with the projection curve with obvious wave crests and wave troughs as the alternative license plate number information connected domain.
The projection curve of the license plate number region to the x axis has obvious wave crests and wave troughs, the wave crests correspond to strokes of characters, the wave troughs correspond to character gaps, the projection curve of the non-license plate number information region to the x axis is relatively smooth, and no obvious wave crests or less wave crests are formed. And performing projection analysis on the first connected domain to obtain the first connected domain with a projection curve with obvious wave crests and wave troughs as the alternative license plate number information connected domain, and further eliminating the layer where the non-license plate number information connected domain is located.
And S5, performing machine learning judgment on the alternative license plate number information connected domain to locate and obtain a license plate number region.
In order to further improve the accuracy of license plate number positioning, a method of combining wavelet decomposition and a classifier is adopted to classify the license plate number region so as to finally position the license plate number region in the license plate image.
Preferably, referring to fig. 6, a flowchart of a step of locating a license plate number region in an embodiment of the present invention is shown. Step S5 is performed by steps S51 to S52:
and S51, performing wavelet decomposition on the alternative license plate number information connected domain, and calculating the amplitude-frequency characteristic vector of the alternative license plate number information connected domain.
The license plate number region has irregular amplitude-frequency characteristics to some extent, so that the license plate number region is regarded as special amplitude-frequency, the image is converted into a wavelet domain, and statistical characteristic values such as the mean value, mean square error, energy, inertia and the like of high-frequency wavelet coefficients are calculated to serve as the amplitude-frequency characteristics, so that the license plate number region is classified.
As a preferred implementation manner, refer to fig. 7, which is a schematic flow chart of a step of calculating a magnitude-frequency eigenvector in an embodiment of the present invention. Includes steps S511 to S514:
and S511, converting the layer where the alternative license plate number information connected domain is located into a wavelet domain.
S512, setting a sliding window with the size of W × H and sliding by a step length l1×l2(l1∈[1,W],l2[1,H]) And scanning the high-frequency sub-band of the alternative license plate number information connected domain.
S513, calculating a statistical characteristic value of each high-frequency sub-band of the alternative license plate number information connected domain in each sliding window region; wherein the statistical characteristic values comprise mean, mean square error, energy and inertia of the high-frequency wavelet coefficients.
The coverage area of the high-frequency sub-band theta is [ u +1, u + W ]]×[v+1,v+H]In the sliding window of (2), the statistical characteristic value thereof is calculated by the following calculation formula, including the mean value mu0Mean square error σθEnergy EθAnd inertia Gθ:
Wherein, theta ∈ [ L H, H L],Is the wavelet coefficient of the high frequency subband, W is the width of the sliding window, H is the height of the sliding window, and (i, j) is the starting position of the wavelet coefficient in the current sliding window relative to the sliding windowThe coordinates of (a).
And S514, constructing the amplitude-frequency characteristic vector by taking the statistical characteristic value of each high-frequency sub-band of the alternative license plate number information connected domain as a component.
Specifically, 12 statistical eigenvalues can be obtained finally by calculating the statistical eigenvalues of 3 high-frequency subbands in each candidate license plate number information connected domain, and a group of 12-dimensional amplitude-frequency eigenvectors X is constructed by taking the 12 statistical eigenvalues as components and is used as the amplitude-frequency eigenvectors.
And S52, using the amplitude-frequency characteristic vector obtained by calculation as an input vector of a preset license plate number classifier, and positioning the license plate number region according to the classification output result of the license plate number classifier.
And further classifying the alternative license plate number information connected domain through a pre-trained license plate number classifier.
Preferably, the license plate number classifier is obtained by:
a connected domain obtained by preprocessing a plurality of sample images is divided into a license plate number area and a non-license plate number area, a positive sample (license plate number area) is marked as '1', and a negative sample (non-license plate number area) is marked as '1'. And extracting the feature vector of each test sample, and performing cross validation to obtain an optimal penalty parameter c-13.9288 and a kernel function parameter g-2.639 to obtain a training data set.
Importing the training data set into a preset classifier model, and performing classification training on the preset classifier model to obtain the license plate number classifier; wherein the classifier model is a Support Vector Machine (SVM).
And solving a decision function for the newly input amplitude-frequency characteristic vector of the connected domain by using the trained classifier model, and carrying out classification and judgment so as to locate and obtain a license plate number region.
The embodiment of the invention provides a license plate number positioning method, which can better reserve the color information of a license plate image by converting the RGB color space of the license plate image into YCrCb color space and acquiring a hue histogram. Then, performing curve fitting on the tone histogram by adopting a least squares method to obtain an optimal fitting curve; and dividing the license plate image into a plurality of image layers by taking each maximum value of the optimal fitting curve as a representative tone, and performing color clustering segmentation on the color image so as to further position license plate number information. And finally, preprocessing each image layer of the license plate image, extracting alternative license plate number information connected domains, and performing machine learning classification judgment on the alternative license plate number information connected domains to locate and obtain a license plate number region. Based on the color information of the color image, the license plate number in a complex environment is accurately positioned, the influence of background noise and non-text edges in the license plate image on the license plate number positioning process is reduced, the license plate number positioning accuracy is effectively improved, and the method has high universality.
Fig. 8 is a schematic structural diagram of a license plate number positioning device according to an embodiment of the present invention. The embodiment of the present invention provides a device 20 for locating a license plate number, including: the system comprises a tone histogram obtaining module 21, a curve fitting module 22, a layer dividing module 23, a connected domain extracting module 24 and a license plate number positioning module 25. Wherein,
and the hue histogram acquisition module 21 is configured to convert the license plate image from an RGB color space to a YCrCb color space, and acquire a hue histogram.
And the curve fitting module 22 is configured to perform curve fitting on the tone histogram by using a least squares method to obtain an optimal fitting curve.
And the layer dividing module 23 is configured to divide the license plate image into a plurality of layers by using each maximum value of the best fit curve as a representative tone.
And the connected domain extracting module 24 is configured to perform preprocessing on each layer of the license plate image and extract a candidate license plate number information connected domain.
And the license plate number positioning module 25 is used for performing machine learning judgment on the alternative license plate number information connected domain so as to position and obtain a license plate number region.
It should be noted that the positioning device for license plate numbers provided in the embodiments of the present invention is used for executing all the process steps of the positioning method for license plate numbers provided in the embodiments, and the working principles and beneficial effects of the two are in one-to-one correspondence, so that further description is omitted.
The embodiment of the invention provides a license plate number positioning device.A hue histogram acquisition module converts a license plate image from an RGB color space to a YCrCb color space, acquires a hue histogram and well reserves the color information of the license plate image. And the curve fitting module performs curve fitting on the tone histogram by adopting a least square method to obtain an optimal fitting curve. And the layer dividing module divides the license plate image into a plurality of layers by taking each maximum value of the optimal fitting curve as a representative tone, and performs color clustering segmentation on the color image so as to further position license plate number information. The connected domain extracting module is used for preprocessing each layer of the license plate image and extracting alternative license plate number information connected domains, and the license plate number positioning module is used for performing machine learning classification judgment on the alternative license plate number information connected domains so as to position and obtain a license plate number region. The embodiment of the invention realizes the accurate positioning of the license plate number in a complex environment based on the color information of the color image, reduces the influence of background noise and non-text edges in the license plate image on the license plate number positioning process, effectively improves the accuracy of the license plate number positioning, and has higher universality.
The embodiment of the present invention further provides a device for locating a license plate number, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor executes the computer program to implement the method for locating a license plate number according to the above embodiment.
The embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the license plate number positioning method according to the above embodiment.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.
Claims (10)
1. A method for locating a license plate number is characterized by comprising the following steps:
converting the license plate image from an RGB color space to a YCrCb color space, and acquiring a hue histogram;
performing curve fitting on the tone histogram by adopting a least squares method to obtain an optimal fitting curve;
dividing the license plate image into a plurality of image layers by taking each maximum value of the optimal fitting curve as a representative tone;
preprocessing each layer of the license plate image, and extracting alternative license plate number information connected domains;
and performing machine learning classification and judgment on the alternative license plate number information connected domain to locate and obtain a license plate number region.
2. The method of claim 1, wherein the dividing the license plate image into a plurality of image layers using each maximum of the best fit curve as a representative color tone comprises:
obtaining an interval consisting of two adjacent inflection points of each maximum value on the optimal fitting curve;
and defining image pixels corresponding to all tone phase values in each interval as a layer so as to decompose the license plate image into a plurality of layers.
3. The method for locating a license plate number according to claim 1, wherein the preprocessing each layer of the license plate image and extracting a candidate license plate number information connected domain specifically comprises:
carrying out binarization processing on each layer of the license plate image, and carrying out morphological processing on the binarized layer;
acquiring a connected domain with the area, width and height meeting preset thresholds in the image layer after the morphological processing as a first connected domain;
and performing projection analysis on the first connected domain to obtain the first connected domain with a projection curve with obvious wave crests and wave troughs as the alternative license plate number information connected domain.
4. The method for locating a license plate number according to claim 3, wherein the obtaining, as the first communication domain, a communication domain whose area, width, and height all meet a preset threshold in the map layer after the morphological processing specifically includes:
marking all connected domains in the map layer after the morphological processing;
calculating the area ratio and the height-width ratio of each connected domain; wherein the area ratio represents the ratio of the area of the connected domain to the area of the layer where the connected domain is located, and the aspect ratio represents the ratio of the height to the width of the connected domain;
and acquiring a connected domain of which the area ratio accords with a preset area ratio and the height-width ratio accords with a preset height-width ratio as the first connected domain.
5. The method of claim 3, wherein the morphological processing comprises:
performing filling operation by adopting a horizontal linear operator and a vertical linear operator with a first preset size;
and performing expansion operation by adopting a structural operator with a second preset size.
6. The method for locating a license plate number according to claim 1, wherein the step of performing machine learning classification and discrimination on the alternative license plate number information connected domain to locate and obtain a license plate number region specifically comprises:
performing wavelet decomposition on the alternative license plate number information connected domain, and calculating the amplitude-frequency characteristic vector of the alternative license plate number information connected domain;
and taking the amplitude-frequency characteristic vector obtained by calculation as an input vector of a preset license plate number classifier, and positioning the license plate number region according to a classification output result of the license plate number classifier.
7. The method for locating a license plate number according to claim 6, wherein the wavelet decomposition is performed on the alternative license plate number information connected domain to calculate the amplitude-frequency eigenvector of the alternative license plate number information connected domain, and specifically comprises:
converting the layer where the alternative license plate number information connected domain is located to a wavelet domain;
setting a sliding window of size W × H by a sliding step l1×l2(1∈[1,W],2[1,H]) Scanning the high-frequency sub-band of the alternative license plate number information connected domain;
calculating the statistical characteristic value of each high-frequency sub-band of the alternative license plate number information connected domain in each sliding window area; wherein the statistical characteristic values comprise the mean, mean square error, energy and inertia of the high-frequency wavelet coefficients;
and constructing the amplitude-frequency characteristic vector by taking the statistical characteristic value of each high-frequency sub-band of the alternative license plate number information connected domain as a component.
8. The method of claim 6, wherein the license plate number classifier is obtained by:
dividing a connected domain obtained by preprocessing a plurality of sample images into a license plate number area and a non-license plate number area as a training data set;
importing the training data set into a preset classifier model, and performing classification training on the preset classifier model to obtain the license plate number classifier; wherein the classifier model is a Support Vector Machine (SVM).
9. The method for locating a license plate number according to claim 1, wherein the curve fitting the histogram of hues by using a least squares method to obtain an optimal fitting curve specifically comprises:
performing curve fitting on the tone histogram according to preset iteration orders, and calculating the error square sum of each order fitting;
selecting the order with the minimum fitted error square sum in all orders as the optimal fitting order;
and obtaining the curve of the optimal fitting order fitting as the optimal fitting curve.
10. A license plate number positioning device, comprising:
the hue histogram acquisition module is used for converting the license plate image from an RGB color space to a YCrCb color space and acquiring a hue histogram;
the curve fitting module is used for performing curve fitting on the tone histogram by adopting a least squares method to obtain an optimal fitting curve;
the layer dividing module is used for dividing the license plate image into a plurality of layers by taking each maximum value of the optimal fitting curve as a representative tone;
the connected domain extraction module is used for preprocessing each layer of the license plate image and extracting alternative license plate number information connected domains;
and the license plate number positioning module is used for performing machine learning judgment on the alternative license plate number information connected domain so as to position and obtain a license plate number region.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010171194.7A CN111476233A (en) | 2020-03-12 | 2020-03-12 | License plate number positioning method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010171194.7A CN111476233A (en) | 2020-03-12 | 2020-03-12 | License plate number positioning method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111476233A true CN111476233A (en) | 2020-07-31 |
Family
ID=71747382
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010171194.7A Pending CN111476233A (en) | 2020-03-12 | 2020-03-12 | License plate number positioning method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111476233A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113538491A (en) * | 2021-09-15 | 2021-10-22 | 风脉能源(武汉)股份有限公司 | Edge identification method, system and storage medium based on self-adaptive threshold |
CN115542362A (en) * | 2022-12-01 | 2022-12-30 | 成都信息工程大学 | High-precision space positioning method, system, equipment and medium for electric power operation site |
-
2020
- 2020-03-12 CN CN202010171194.7A patent/CN111476233A/en active Pending
Non-Patent Citations (1)
Title |
---|
周翔等: "复杂背景下的图像文本区域定位方法研究" * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113538491A (en) * | 2021-09-15 | 2021-10-22 | 风脉能源(武汉)股份有限公司 | Edge identification method, system and storage medium based on self-adaptive threshold |
CN113538491B (en) * | 2021-09-15 | 2021-11-23 | 风脉能源(武汉)股份有限公司 | Edge identification method, system and storage medium based on self-adaptive threshold |
CN115542362A (en) * | 2022-12-01 | 2022-12-30 | 成都信息工程大学 | High-precision space positioning method, system, equipment and medium for electric power operation site |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108564814B (en) | Image-based parking lot parking space detection method and device | |
CN109657632B (en) | Lane line detection and identification method | |
CN104751142B (en) | A kind of natural scene Method for text detection based on stroke feature | |
CN112819094B (en) | Target detection and identification method based on structural similarity measurement | |
CN104200210B (en) | A kind of registration number character dividing method based on component | |
CN107301405A (en) | Method for traffic sign detection under natural scene | |
CN107103317A (en) | Fuzzy license plate image recognition algorithm based on image co-registration and blind deconvolution | |
CN103824091B (en) | A kind of licence plate recognition method for intelligent transportation system | |
CN106650553A (en) | License plate recognition method and system | |
Paunwala et al. | A novel multiple license plate extraction technique for complex background in Indian traffic conditions | |
CN108280409B (en) | Large-space video smoke detection method based on multi-feature fusion | |
CN104299008A (en) | Vehicle type classification method based on multi-feature fusion | |
CN109460722B (en) | Intelligent license plate recognition method | |
CN104299009A (en) | Plate number character recognition method based on multi-feature fusion | |
CN109509188B (en) | Power transmission line typical defect identification method based on HOG characteristics | |
CN111027544B (en) | MSER license plate positioning method and system based on visual saliency detection | |
CN111915583A (en) | Vehicle and pedestrian detection method based on vehicle-mounted thermal infrared imager in complex scene | |
CN104008404B (en) | Pedestrian detection method and system based on significant histogram features | |
CN105139011A (en) | Method and apparatus for identifying vehicle based on identification marker image | |
CN109190455A (en) | Black smoke vehicle recognition methods based on Gaussian Mixture and autoregressive moving-average model | |
CN110516666B (en) | License plate positioning method based on combination of MSER and ISODATA | |
CN111476233A (en) | License plate number positioning method and device | |
CN117079097A (en) | Sea surface target identification method based on visual saliency | |
CN107301421A (en) | The recognition methods of vehicle color and device | |
CN103680145B (en) | A kind of people's car automatic identifying method based on local image characteristics |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200731 |
|
RJ01 | Rejection of invention patent application after publication |