A license plate character segmentation and comparison recognition method

By performing perspective transformation and grayscale difference to locate the boundary of the license plate image, and combining gradient direction marking to generate character segmentation seam coordinates, the problem of asymmetrical transition of character edges in complex environments is solved, and character segmentation and comparison recognition with high accuracy and stability is achieved.

CN121121764BActive Publication Date: 2026-04-17BENGBU COLLEGE
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BENGBU COLLEGE
Filing Date
2025-10-28
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing license plate character segmentation methods struggle to accurately handle asymmetrical transitions at character edges in complex environments, leading to inaccurate segmentation and recognition matching. This is especially true when character spacing is blurred, background interference is strong, and boundary transitions are unclear, resulting in poor recognition stability and a high false recognition rate.

Method used

A flattened image is generated by perspective transformation based on license plate image. The vertical boundary is located by first-order difference of gray level change. The character segmentation seam coordinate set is generated by gradient direction mark. The template appearance is generated by one-dimensional convolution. The normalized cross-correlation score is calculated to confirm candidate characters and reduce interference from external factors.

Benefits of technology

It improves the adaptability and universality of character boundary extraction, enhances the accuracy of boundary localization and recognition, and achieves highly robust character segmentation and comparison recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121121764B_ABST
    Figure CN121121764B_ABST
Patent Text Reader

Abstract

This invention discloses a method for license plate character segmentation and comparison recognition, belonging to the field of license plate character segmentation and comparison recognition technology. The method includes: performing perspective transformation based on the four corner coordinates of the license plate image to obtain a flattened license plate image; reading the grayscale percentile positions row by row on the flattened image, calculating the bright side half-width and dark side half-width, and determining the unbiased boundary and character segmentation seam by combining gradient direction markings, and cropping character blocks; then constructing a one-sided exponential tailed convolution kernel using the two half-widths, performing one-dimensional convolution on a standard template row by row to generate the template appearance, selecting candidate characters using normalized cross-correlation, and obtaining the confidence level by combining the pixel residual ratio. This invention can achieve stable segmentation and high-precision recognition under complex lighting and imaging conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of license plate character segmentation and comparison recognition technology, and in particular to a method for license plate character segmentation and comparison recognition. Background Technology

[0002] With the widespread application of intelligent transportation, electronic law enforcement, and parking management, image-based license plate recognition technology is playing an increasingly important role in urban safety, travel convenience, and vehicle management. In practical applications, license plate images come from diverse sources, including surveillance cameras on urban roads, lane cameras at highway toll stations, and capture devices in various fixed or mobile locations such as parking lots, gas stations, and logistics parks. These images may suffer from distortion, blurring, trailing, and uneven brightness due to changes in vehicle speed, angle deviation, uneven lighting, and dirt occlusion, posing significant challenges to accurate character segmentation and reliable recognition. Especially under conditions of blurred character spacing, strong background interference, and unclear boundary transitions, it is difficult to accurately extract character regions and restore the character appearance, thus affecting overall recognition performance.

[0003] Current mainstream character segmentation methods mostly rely on prior knowledge of character morphology or global threshold judgment of edge strength. However, in complex environments, these methods often face two prominent problems: First, due to the inability to accurately model the trailing characteristics of character edges under different lighting conditions, over-segmentation or overlapping segmentation of characters is prone to occur. Second, existing methods, in the template matching process, are mostly based on symmetrical convolution or fixed structures, ignoring the asymmetrical transition of edges caused by uneven lighting in the image, thus leading to decreased template matching accuracy and an increased possibility of incorrect character selection. Especially when character boundaries are blurred or stroke details are weak, traditional methods struggle to establish unified segmentation and comparison standards, resulting in poor recognition stability and a high false recognition rate. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of existing technologies that cannot accurately handle asymmetrical transitions at character edges, leading to inaccurate segmentation and recognition matching. Therefore, this invention proposes a method for segmenting and comparing license plate characters.

[0005] To address the problems existing in the prior art, the present invention adopts the following technical solution:

[0006] A method for license plate character segmentation, comparison, and recognition includes:

[0007] S1. Transform the target plane based on the vertex coordinates of the license plate image to generate a flattened license plate image;

[0008] S2. Determine the position parameters in the flattened license plate image, and calculate the bright half-width and dark half-width based on the position parameters;

[0009] S3. Generate candidate vertical edges in the flattened license plate image, and perform gradient direction marking on the candidate vertical edges based on the position parameters in the flattened license plate image;

[0010] S4. Generate a set of character segmentation seam coordinates based on gradient direction markings;

[0011] S5. Extract character blocks from the flattened license plate image based on the character segmentation seam coordinate set;

[0012] S6. Perform one-dimensional convolution on the standard template characters based on the bright half-width and dark half-width to generate the template appearance. Based on the normalized cross-correlation score between the character patch and the template appearance, confirm the candidate characters and calculate the confidence level of the confirmed candidate characters.

[0013] Preferably, the target plane is transformed based on the vertex coordinates of the license plate image to generate a flattened license plate image, including:

[0014] The license plate image is detected and the circumscribed quadrilateral of the license plate region is determined. The coordinates of the four vertices of the circumscribed quadrilateral are extracted in clockwise order and used as the coordinates of the four corners of the source plane.

[0015] Set the coordinates of the four corners of the target on the preset target plane, where the long side of the target plane is kept horizontal and the short side is kept vertical, and the row direction of the target plane is consistent with the vertical edge direction of the license plate characters.

[0016] Calculate the perspective transformation matrix based on the four-corner coordinates of the source plane and the four-corner coordinates of the target plane;

[0017] The license plate image is subjected to perspective transformation based on the perspective transformation matrix, and then a flattened license plate image is generated through bilinear interpolation.

[0018] Preferably, determining positional parameters in the flattened license plate image and calculating the bright half-width and dark half-width based on the positional parameters includes:

[0019] For each row of the flattened license plate image, calculate the first-order difference along the column coordinate direction. The column coordinate corresponding to the local maximum value of the difference is used as the candidate vertical edge position of the corresponding row.

[0020] Bilinear interpolation sampling is performed on the flattened license plate image along the normal direction of the column coordinate at each candidate vertical edge position to obtain the gray intensity sequence;

[0021] The grayscale intensity sequence is linearly normalized to obtain a normalized sequence;

[0022] Read the column coordinates of the normalized grayscale when the normalized grayscale is 10%, 50%, and 90% respectively to obtain the low grayscale position, the middle grayscale position, and the high grayscale position.

[0023] The bright half-width is obtained by the difference between the high grayscale position and the mid grayscale position, and the dark half-width is obtained by the difference between the mid grayscale position and the low grayscale position.

[0024] Preferably, candidate vertical edges are generated in the flattened license plate image, and gradient direction marking is performed on the candidate vertical edges based on the position parameters in the flattened license plate image, including:

[0025] Read the grayscale low position, grayscale mid position and grayscale high position corresponding to each row of coordinates in the flattened license plate image, and assign a unique edge instance number to each set of position parameters;

[0026] Calculate the arithmetic mean of the low-level and high-level grayscale positions of each edge instance, and use the average value as the unbiased boundary position corresponding to the edge instance.

[0027] Calculate the average gray level on the left side of the gray level range from the low gray level position to the middle gray level position for each edge instance, and the average gray level on the right side of the gray level range from the middle gray level position to the high gray level position.

[0028] Based on the comparison between the average gray levels on the left and right, the gradient direction is marked as either dark to light or light to dark.

[0029] Preferably, the set of character segmentation seam coordinates is generated based on the gradient direction marker, including:

[0030] For each row of coordinates, read the unbiased boundary position and the gradient direction marker of the unbiased boundary, and arrange them in ascending order of column coordinates;

[0031] Within the same row of coordinates, two adjacent unbiased boundary positions are considered as candidate pairs.

[0032] When a candidate pair satisfies the following conditions: the gradient direction of the left boundary is from bright to dark and the gradient direction of the right boundary is from dark to bright, or the gradient direction of the left boundary is from dark to bright and the gradient direction of the right boundary is from bright to dark, the candidate pair is confirmed as a valid pair.

[0033] For each valid pair, calculate the arithmetic mean of the two unbiased boundary positions in the valid pair, and use the average value as the character segmentation column coordinates corresponding to the valid pair;

[0034] Assign serial numbers to all row seams in a left-to-right order. Take the median of the column coordinates of the seams with the same serial number across all rows to obtain the set of column coordinates of the character seams.

[0035] Preferably, the license plate flattened image is cropped according to the character segmentation seam coordinate set to obtain character blocks, including:

[0036] Based on the adjacent segmentation seams in the character segmentation seam column coordinate set and the position of the outermost unbiased boundary of the flattened license plate image, the closed interval of the column coordinate is determined.

[0037] Based on the closed interval of the column coordinates, the corresponding pixels are cropped row by row on the flattened license plate image to obtain character blocks.

[0038] Preferably, a one-dimensional convolution is performed on the standard template characters based on the bright-side half-width and the dark-side half-width to generate the template appearance. Candidate characters are identified based on the normalized cross-correlation score between the character patch and the template appearance, including:

[0039] Set the height of all templates in the standard template character set to be consistent with the height of the character block, and scale or fill the character block in the column direction so that the width of the character block is consistent with the width of the standard template character;

[0040] At each row coordinate, a one-sided exponential tailed convolution kernel is constructed in the column direction based on the bright half-width and the dark half-width.

[0041] The characters of the standard template are convolved row by row in the column direction using a one-sided exponential tail convolution kernel to generate the template appearance.

[0042] Calculate the normalized cross-correlation score between each character tile and each template appearance;

[0043] Within the same character block, the standard template character with the highest normalized cross-correlation score is selected as the candidate character.

[0044] Preferably, calculating the confidence level of the confirmed candidate character includes:

[0045] Calculate the pixel residual ratio between each character patch and the appearance of the corresponding candidate template;

[0046] The confidence level of each character patch is calculated based on the normalized cross-correlation score and the pixel residual ratio.

[0047] Compared with the prior art, the beneficial effects of the present invention are:

[0048] 1. This invention performs perspective transformation on the geometric structure of a license plate image to obtain a flattened image with column directions aligned with character edges. This allows the boundary features of the characters to unfold in a unified coordinate system, effectively eliminating interference from external factors such as shooting angle and imaging distortion, and providing a standardized image basis for subsequent precise measurement of character boundaries. The vertical boundaries are located in the flattened image using first-order difference based on grayscale changes, and a sub-pixel precision grayscale intensity sequence is obtained through bilinear interpolation. This allows for stable identification of the true edge range of light-dark transitions, improving the adaptability and universality of character boundary extraction.

[0049] 2. This invention constructs the bright half-width and dark half-width by reading the low-grayscale position, mid-grayscale position, and high-grayscale position of each row, respectively. It then combines this with gradient direction calculation for unbiased boundary calculation and direction marking, allowing the physical structure of edge transitions to be numerically expressed. This not only improves the accuracy of boundary localization but also ensures consistency between the image and the template in subsequent template generation. The character spacing is determined by the directional relationship of adjacent unbiased boundaries, and then the set of character segmentation seam coordinates is extracted. An aggregation strategy is employed to effectively suppress the interference of boundary anomalies and local reflections on the segmentation results, thereby achieving high robustness in character segmentation.

[0050] 3. This invention constructs a one-sided exponential tail convolution kernel using the bright-side half-width and dark-side half-width as scales, and performs one-dimensional convolution on standard template characters line by line to generate a template appearance consistent with the tail of the observed image patch, making the normalized cross-correlation score more interpretable. Simultaneously, it corrects the score results by comparing pixel residuals, achieving accurate measurement of local inconsistencies between the image patch and the template. This constructs a highly reliable, highly repeatable comparison and recognition process that does not rely on empirical parameters, improving recognition accuracy and engineering usability. Attached Figure Description

[0051] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0052] Figure 1 This is a flowchart illustrating a license plate character segmentation and comparison recognition method according to an embodiment of the present invention. Detailed Implementation

[0053] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0054] Example: This example provides a method for license plate character segmentation, comparison, and recognition. See [link to example]. Figure 1 Specifically, including:

[0055] S1. Transform the target plane based on the vertex coordinates of the license plate image to generate a flattened license plate image;

[0056] In an embodiment of the present invention, a target plane is transformed based on the vertex coordinates of the license plate image to generate a flattened license plate image, including:

[0057] The license plate image is detected and the circumscribed quadrilateral of the license plate region is determined. The coordinates of the four vertices of the circumscribed quadrilateral are extracted in clockwise order and used as the coordinates of the four corners of the source plane.

[0058] Set the coordinates of the four corners of the target on the preset target plane, where the long side of the target plane is kept horizontal and the short side is kept vertical, and the row direction of the target plane is consistent with the vertical edge direction of the license plate characters.

[0059] Specifically, the source plane four-corner coordinates refer to the numerical points of the four vertices extracted in the license plate image in a clockwise order from the circumscribed quadrilateral of the license plate area in the pixel coordinate system of the imaging plane. This set of points is located within the effective range of the image and forms the source-side control point set for perspective transformation, which is used to uniquely determine the geometric position and vertex order of the license plate area in the source plane. The preset target plane refers to the two-dimensional pixel coordinate domain determined in advance in the processing flow to achieve license plate flattening. Its four-corner coordinates are set according to the conditions that the long side is kept horizontal, the short side is kept vertical, and the row direction is consistent with the vertical edge direction of the license plate characters. It is also given a clear row and column increase / decrease direction and resolution, which is used as the target-side control point set for perspective transformation, so that the source plane four-corner coordinates correspond one-to-one with the target plane four-corner coordinates, so that after performing perspective transformation, a license plate flattened image with geometric distortion eliminated and row and column directions determined is obtained.

[0060] Specifically, when performing license plate region detection on the input license plate image, an edge detection operator is first used to extract the edges of the license plate image, obtaining an edge response map containing the license plate region. Based on the edge response map, contour extraction is performed, and closed contours with areas within the preset license plate size range and aspect ratios conforming to license plate characteristics are selected as candidate license plate contours. Polygon fitting is performed on the candidate license plate contours, and the quadrilateral contour with the smallest fitting error is retained as the circumscribed quadrilateral of the license plate region. When extracting the coordinates of the four vertices of this circumscribed quadrilateral, the top left corner of the license plate image is taken as the origin, the horizontal direction to the right is the positive direction of the column coordinate, and the vertical direction downward is the positive direction of the row coordinate. The four vertices are determined in a clockwise order, where the first vertex is the top left vertex of the circumscribed quadrilateral, the second vertex is the top right vertex, the third vertex is the bottom right vertex, and the fourth vertex is the bottom left vertex. The coordinates of these four vertices are defined as the four-corner coordinates of the source plane. When setting the coordinates of the four corners of the target plane, the size of the target plane is determined based on the aspect ratio of the circumscribed quadrilateral of the source plane. The length of the long side of the target plane is equal to the pixel length of the long side of the circumscribed quadrilateral of the source plane, and the length of the short side is equal to the pixel length of the short side of the circumscribed quadrilateral of the source plane. The long side of the target plane extends horizontally, and the short side extends vertically, making the target plane rectangular with the long side and the short side perpendicular to each other. At the same time, the row direction of the target plane is set horizontally, which is perpendicular to the vertical edge direction of the license plate characters, ensuring that the vertical edge of the characters is consistent with the column direction of the target plane in subsequent processing.

[0061] Calculate the perspective transformation matrix based on the four-corner coordinates of the source plane and the four-corner coordinates of the target plane;

[0062] The license plate image is subjected to perspective transformation based on the perspective transformation matrix, and then a flattened license plate image is generated through bilinear interpolation.

[0063] Specifically, the perspective transformation matrix is ​​calculated based on the coordinates of the four corners of the source plane and the four corners of the target plane. This is to mathematically uniquely determine the mapping relationship from the circumscribed quadrilateral in the license plate image to the coordinate domain of the target plane, thereby simultaneously correcting translation, rotation, scaling, and perspective distortion within this region. This ensures that the long side of the target plane remains horizontal, the short side remains vertical, and the row direction is consistent with the vertical edge direction of the license plate characters. Subsequently, the perspective transformation of the license plate image is performed based on the perspective transformation matrix, and bilinear interpolation is used to sample pixel by pixel on the target plane. This can balance geometric correction and grayscale continuity without introducing additional adjustable parameters, reducing resampling jaggedness and step-breaking errors, and obtaining a flattened license plate image with clear geometric relationships, definite row and column directions, and smooth transitions between light and dark areas. This provides a stable one-dimensional measurement benchmark for subsequent position parameter reading, boundary positioning, and seam calculation in the row direction.

[0064] Specifically, the coordinates of the four corners of the source plane and the four corners of the target plane are represented as homogeneous coordinates, where each coordinate includes a row coordinate, a column coordinate, and a homogeneous term with a value of 1. Based on the mathematical model of perspective transformation, a linear correspondence is established between the homogeneous coordinates of the source plane and the homogeneous coordinates of the target plane. This correspondence is composed of 3 rows and 3 columns of perspective transformation matrix parameters. Each set of corresponding vertex coordinates of the source plane and the target plane can construct 2 linear equations, and the four sets of corresponding vertex coordinates construct a total of 8 linear equations. The least squares method is used to solve the overdetermined system of equations composed of the above 8 linear equations to obtain the 9 parameter values ​​of the perspective transformation matrix, thus completing the calculation of the perspective transformation matrix. When performing perspective transformation on a license plate image based on the perspective transformation matrix, the pixel range of the target plane is first determined. Using the four corner coordinates of the target plane as boundaries, each pixel within the target plane is traversed to obtain its row and column coordinates, which are then represented as homogeneous coordinates. The homogeneous coordinates of the target plane pixel are multiplied by the inverse of the perspective transformation matrix to obtain the corresponding homogeneous coordinates of the pixel in the source plane. These coordinates are then normalized using homogeneous terms to convert them into non-homogeneous coordinates in the source plane, i.e., row and column coordinates. Finally, bilinear interpolation is used to determine the pixel's position. When calculating grayscale values, first determine the four neighboring integer coordinate pixels based on the non-homogeneous coordinates of the source plane. Calculate the row and column distance weights between this pixel and its four neighboring pixels. Multiply the grayscale values ​​of the four neighboring pixels by their corresponding row and column weights, and then sum the four product results to obtain the grayscale value of the pixel on the target plane. After traversing all pixels on the target plane and determining their respective grayscale values, generate a flattened license plate image. In this image, the license plate area is a regular rectangle, and the vertical edges of the characters are aligned with the column direction of the target plane.

[0065] S2. Determine the position parameters in the flattened license plate image, and calculate the bright half-width and dark half-width based on the position parameters;

[0066] In an embodiment of the present invention, determining position parameters in a flattened license plate image and calculating the bright half-width and dark half-width based on the position parameters includes:

[0067] For each row of the flattened license plate image, calculate the first-order difference along the column coordinate direction. The column coordinate corresponding to the local maximum value of the difference is used as the candidate vertical edge position of the corresponding row.

[0068] Bilinear interpolation sampling is performed on the flattened license plate image along the normal direction of the column coordinate at each candidate vertical edge position to obtain the gray intensity sequence;

[0069] Specifically, the first-order difference along the column coordinate direction is first calculated on each row coordinate of the flattened license plate image, and the local maxima of the absolute value of the difference are used as candidate vertical edge positions. This is to transform the two-dimensional boundary search into a one-dimensional transition detection along the row direction, so that the true dark-bright boundary is stably extracted in the form of gradient peaks. This allows a set of candidate positions that are insensitive to changes in illumination intensity without relying on empirical thresholds. Subsequently, bilinear interpolation sampling is performed on the flattened license plate image along the normal direction of the column coordinate at each candidate vertical edge position to obtain a continuous gray-level intensity sequence with sub-pixel precision. This ensures a consistent measurement benchmark when reading the low-level, mid-level, and high-level gray-level positions on this sequence, and provides a reliable data source for calculating the bright-side half-width and dark-side half-width, determining the unbiased boundary position, and generating the column coordinates of the character segmentation seam.

[0070] Specifically, in the flattened license plate image, each row of pixels is traversed sequentially according to the row coordinates. For the current row, the first-order difference along the column coordinate direction is calculated. Specifically, the difference between the gray values ​​of two adjacent columns of pixels in the current row is taken, and the absolute value of the difference is used as the difference response value of the current column position. Local maxima judgment is performed on the difference response values ​​of all column positions in the row. That is, if the difference response value of a certain column position is greater than the difference response value of its left adjacent column position and greater than the difference response value of its right adjacent column position, then the column position is determined as the candidate vertical edge position of the corresponding row. For each candidate vertical edge position, a sampling interval is set along the normal direction of the column coordinate (i.e., the horizontal direction). This interval extends to the left and right by a predetermined number of pixels, centered on the candidate vertical edge position. Within the sampling interval, the column coordinates of multiple sampling points are determined with a fixed step size. If the column coordinate of a sampling point is not an integer, the gray value of that point is calculated by bilinear interpolation. That is, the weights are calculated based on the gray values ​​of the four integer coordinate pixels surrounding the sampling point, combined with the row and column distances between the sampling point and these four pixels. The gray values ​​of the sampling point are then obtained by weighted summation. The gray values ​​of all sampling points within the sampling interval are arranged in order from left to right according to the column coordinates to form the gray intensity sequence corresponding to the candidate vertical edge position.

[0071] The grayscale intensity sequence is linearly normalized to obtain a normalized sequence;

[0072] Read the column coordinates of the normalized grayscale when the normalized grayscale is 10%, 50%, and 90% respectively to obtain the low grayscale position, the middle grayscale position, and the high grayscale position.

[0073] The bright half-width is obtained by the difference between the high gray level position and the mid gray level position, and the dark half-width is obtained by the difference between the mid gray level position and the low gray level position.

[0074] Specifically, linear normalization of the grayscale intensity sequence is performed to unify the differences in exposure, gain, and background brightness at different positions and rows to a range of zero to one, preserving the shape information of edge transitions and facilitating position reading under the same metric scale. Three isointense positions—10%, 50%, and 90%—are selected on the normalized sequence as the low-grayscale position, mid-grayscale position, and high-grayscale position, respectively. This is because these three points correspond to the dark end, midpoint, and bright end of the edge transition, stably reflecting the spatial positions of the transition ends and midpoint, are insensitive to noise and local reflection changes, and align with industry norms. The percentile rise distance measurement method used is consistent; furthermore, the bright side half-width is defined by the difference between the gray-level high position and the gray-level median position, which represents the spatial width of the edge transition from the dark end to the midpoint in the column direction. The dark side half-width is defined by the difference between the gray-level median position and the gray-level low position, which represents the spatial width of the edge transition from the midpoint to the bright end in the column direction. This can describe the extension of the edge on the bright side and the dark side in numerical form, thereby providing a directly usable width input for subsequent unbiased boundary positioning and template appearance generation, so that the segmentation and comparison stages are consistent on the same physical quantity, and reduce the dependence on thresholds and empirical parameters.

[0075] Specifically, when performing linear normalization on a grayscale intensity sequence, the maximum and minimum grayscale values ​​in the sequence are first determined, and the difference between the maximum and minimum grayscale values ​​is used as the normalization denominator. For each grayscale value in the sequence, the minimum grayscale value is subtracted from the grayscale value and then divided by the normalization denominator to obtain the normalized grayscale value corresponding to that grayscale value. All normalized grayscale values ​​are arranged in the column coordinate order of the original sequence to form a normalized sequence. When reading column coordinates corresponding to the percentage on the normalized sequence, first traverse the normalized sequence from left to right according to the column coordinates, and record the normalized gray value corresponding to each column coordinate. For a position where the normalized gray value is 10%, if there exists a column coordinate whose normalized gray value is exactly 10%, then directly take that column coordinate as the low gray value position. If not, then perform linear interpolation between the largest column coordinate with a normalized gray value less than 10% and the smallest column coordinate with a normalized gray value greater than 10%, and calculate the accurate column coordinate as the low gray value position. Using the same method, find the column coordinate in the normalized sequence where the normalized gray value is 50% as the gray value median position, and find the column coordinate where the normalized gray value is 90% as the gray value high position. When calculating the bright half-width and dark half-width, the difference between the column coordinates of the high gray level position and the column coordinates of the middle gray level position is the bright half-width; the difference between the column coordinates of the middle gray level position and the column coordinates of the low gray level position is the dark half-width.

[0076] S3. Generate candidate vertical edges in the flattened license plate image, and perform gradient direction marking on the candidate vertical edges based on the position parameters in the flattened license plate image;

[0077] In an embodiment of the present invention, candidate vertical edges are generated in a flattened license plate image, and gradient direction marking is performed on the candidate vertical edges based on position parameters in the flattened license plate image, including:

[0078] Read the grayscale low position, grayscale mid position and grayscale high position corresponding to each row of coordinates in the flattened license plate image, and assign a unique edge instance number to each set of position parameters;

[0079] Calculate the arithmetic mean of the low-level and high-level grayscale positions of each edge instance, and use the average value as the unbiased boundary position corresponding to the edge instance.

[0080] Calculate the average gray level on the left side of the gray level range from the low gray level position to the middle gray level position for each edge instance, and the average gray level on the right side of the gray level range from the middle gray level position to the high gray level position.

[0081] Based on the comparison between the average gray levels on the left and right, the gradient direction is marked as either dark to light or light to dark.

[0082] Specifically, the low-grayscale position, median grayscale position, and high-grayscale position are read from each row of the flattened license plate image, and a unique edge instance number is assigned to each set of position parameters. This establishes a one-to-one corresponding record unit for multiple candidate vertical edges within the same row, eliminating reference confusion caused by duplicate positions with the same name within the row, and ensuring that subsequent calculations and sorting can accurately trace back to a unique data source and a unique geometric object. The arithmetic mean of the low-grayscale position and the high-grayscale position is used as the unbiased boundary position corresponding to the edge instance. This is based on the objective situation that there is a unidirectional trailing on the bright or dark side of the edge transition. The median grayscale position is easily pulled by the trailing and produces a system offset. The equidistant average of the two ends can geometrically cancel this offset, thus providing a stable boundary location that does not rely on empirical thresholds and shape assumptions, which facilitates subsequent pairwise operations on adjacent edges within the row. Within each edge instance, the average grayscale value of the left side of the interval from the low-grayscale position to the median grayscale position and the average grayscale value of the interval from the median grayscale position to the high-grayscale position are calculated. The average gray level on the right is used to characterize the overall brightness and darkness levels on both sides of the boundary using interval statistics based on the same metric. This suppresses the influence of single-point noise and isolated pixel fluctuations on direction judgment, while maintaining a spatial range definition that is completely consistent with the position parameters, ensuring a one-to-one correspondence between statistical results and position readings. The gradient direction is marked as dark to light or light to dark based on the comparison between the average gray levels on the left and right. This is determined by using the overall intensity difference between the transitions from the dark end to the midpoint and from the midpoint to the bright end. When the average gray level on the right is greater than that on the left, it is marked as dark to light; when the average gray level on the right is less than that on the left, it is marked as light to dark. This provides direction information that can directly drive the calculation of paired and midpoint positions within the row without introducing additional thresholds or morphological parameters. This ensures that the unbiased boundary position and gradient direction marking form a closed loop within the same data source and the same row coordinates, guaranteeing the consistency of the order and the reliability of pairing when generating character segmentation column coordinates, and reducing the probability of misjudgment caused by uneven illumination and small artifacts.

[0083] Specifically, for the flattened license plate image, each row is traversed sequentially by row coordinates. The low-level, mid-level, and high-level grayscale positions corresponding to each candidate vertical edge in the current row are read, and these three positional parameters are treated as a set of associated data. A unique edge instance number is assigned to each set of positional parameters, with the number increasing sequentially from left to right according to the appearance order of the candidate vertical edges within the row, ensuring that each edge instance can be uniquely identified. When calculating the unbiased boundary position of each edge instance, the column coordinates of the low-level and high-level grayscale positions of that edge instance are taken and the arithmetic mean is calculated. The result is used as the column coordinate of the unbiased boundary position corresponding to that edge instance. When calculating the average gray levels on the left and right sides, for each edge instance, first determine the column coordinate interval from the low gray level position to the middle gray level position. Traverse all column coordinates within this interval, extract the gray values ​​at the corresponding positions, and calculate the arithmetic mean to obtain the left average gray level. Then, determine the column coordinate interval from the middle gray level position to the high gray level position, traverse all column coordinates within this interval, extract the gray values ​​at the corresponding positions, and calculate the arithmetic mean to obtain the right average gray level. When marking the gradient direction, compare the values ​​of the left and right average gray levels. If the right average gray level is greater than the left average gray level, mark the gradient direction of the edge instance as dark to light; if the right average gray level is less than the left average gray level, mark the gradient direction of the edge instance as light to dark.

[0084] S4. Generate a set of character segmentation seam coordinates based on gradient direction markings;

[0085] In an embodiment of the present invention, generating a set of character segmentation seam coordinates based on gradient direction markers includes:

[0086] For each row of coordinates, read the unbiased boundary position and the gradient direction marker of the unbiased boundary, and arrange them in ascending order of column coordinates;

[0087] Within the same row of coordinates, two adjacent unbiased boundary positions are considered as candidate pairs.

[0088] When a candidate pair satisfies the following conditions: the gradient direction of the left boundary is from bright to dark and the gradient direction of the right boundary is from dark to bright, or the gradient direction of the left boundary is from dark to bright and the gradient direction of the right boundary is from bright to dark, the candidate pair is confirmed as a valid pair.

[0089] Specifically, sorting the unbiased boundary positions and gradient direction markers on each row of coordinates in ascending order of column coordinates establishes a unique left-right order within the same row, avoiding positional confusion caused by cross-pairing. Under this order, only adjacent unbiased boundary positions form candidate pairs, transforming the two-dimensional combination problem into an intra-row adjacency determination, reducing irrelevant pairings and ensuring that candidate pairs correspond to actual adjacent structures. Furthermore, candidate pairs are determined using a direction consistency rule. When the gradient direction of the left boundary is from light to dark and the gradient direction of the right boundary is from dark to light, or when the gradient direction of the left boundary is from dark to light and the gradient direction of the right boundary is from light to dark, they are confirmed as valid pairs. This is because the geometric center of the character spacing must present opposite light and dark transitions on both sides, and only this opposite relationship can indicate the true character separation position. On the other hand, the same direction relationship often corresponds to the two sides of the same stroke or a false boundary generated by local reflection. Thus, without relying on layout rules and additional thresholds, the edge pairs entering the next step of midpoint calculation and dividing seam generation are both adjacent and have reasonable directions, improving the stability and accuracy of the dividing seam column coordinates from the source.

[0090] Specifically, for the flattened license plate image, each row is traversed sequentially by row coordinates. The unbiased boundary positions and their respective gradient direction labels for all edge instances in the current row are read, with the unbiased boundary positions represented by column coordinates. All unbiased boundary positions in the current row are sorted in ascending order of column coordinate values, and the gradient direction labels corresponding to each sorted unbiased boundary are synchronously associated, forming an ordered sequence of unbiased boundaries for that row. Within the same row coordinates, based on the sorted sequence of unbiased boundaries, adjacent unbiased boundary positions are grouped into a candidate pair. That is, the nth unbiased boundary in the sequence and the (n+1)th unbiased boundary form a candidate pair, where n is a positive integer starting from 1 and increasing sequentially. When judging the validity of each candidate pair, the sorted position is used as the reference. The unbiased boundary on the left is the left boundary of the candidate pair, and the unbiased boundary on the right is the right boundary of the candidate pair. If the gradient direction of the left boundary is marked as light to dark and the gradient direction of the right boundary is marked as dark to light, or the gradient direction of the left boundary is marked as dark to light and the gradient direction of the right boundary is marked as light to dark, then the candidate pair is determined to be a valid pair.

[0091] For each valid pair, calculate the arithmetic mean of the two unbiased boundary positions in the valid pair, and use the average value as the character segmentation column coordinates corresponding to the valid pair;

[0092] Assign serial numbers to the dividing seams of all rows in order from left to right. Take the median of the column coordinates of the dividing seams with the same serial number across all rows to obtain the set of column coordinates of the character dividing seams.

[0093] Specifically, for each valid pair, the arithmetic mean of the two unbiased boundary positions is taken as the column coordinate of the character split seam. This is because the unbiased boundary positions correspond to the geometric boundaries of the adjacent strokes and background, and their arithmetic mean gives the equidistant midline between the two boundaries, which can stably position the split seam at the center of the actual character interval without relying on thresholds or layout assumptions. Then, the split seams of all rows are uniformly assigned serial numbers from left to right, so that the same serial number corresponds one-to-one between different rows, thereby ensuring that the alignment relationship between rows is clear and traceable, and avoiding inconsistencies in the number of seams and position drift caused by cross-row mismatches. On this basis, the median of the column coordinates of the split seam with the same serial number on all rows is taken, which can effectively suppress the deviation caused by local reflection, stains or fluctuations of individual row boundaries, while maintaining the overall continuity and column stability of the split seam. Finally, a set of character split seam column coordinates is formed for subsequent cropping, improving the accuracy and robustness of character region determination.

[0094] Specifically, for each valid pair, the column coordinates of the left and right unbiased boundary positions are extracted. The arithmetic mean of these two column coordinates is then calculated, and the result is used as the column coordinate of the character split seam corresponding to that valid pair in the current row. After processing all valid pairs, the column coordinates of the character split seams in all rows are collected, and all split seams are globally sorted from left to right according to their column coordinate values. Each split seam is assigned a unique number based on the sorting result, with the numbers increasing sequentially from left to right to ensure that the same number corresponds to the same horizontal split seam on the license plate. For split seams with the same number, their column coordinates across all rows are collected, and the median of these column coordinates is calculated. This median is used as the final column coordinate of the split seam with that number. All final column coordinates are arranged in ascending order of their numbers to form a set of character split seam column coordinates.

[0095] S5. Extract character blocks from the flattened license plate image based on the character segmentation seam coordinate set;

[0096] In an embodiment of the present invention, the license plate flattened image is cropped according to the character segmentation seam coordinate set to obtain character blocks, including:

[0097] Based on the adjacent segmentation seams in the character segmentation seam column coordinate set and the position of the outermost unbiased boundary of the flattened license plate image, the closed interval of the column coordinate is determined.

[0098] Based on the closed interval of the column coordinates, the corresponding pixels are cropped row by row on the flattened license plate image to obtain character blocks;

[0099] Specifically, the closed interval of the column coordinates is determined by the position of the adjacent segmentation seams in the character segmentation seam column coordinate set and the outermost unbiased boundary position of the license plate flattened image. This is to close the effective range of each character in the column direction with the geometric midline and the real boundary, so that there is no gap between the first and last characters on the outside and no overlap between adjacent characters. Within the closed interval, the corresponding pixels of the license plate flattened image are cropped row by row to obtain character blocks. Without relying on layout assumptions and threshold settings, the background and adjacent stroke interference can be excluded from the interval. This ensures that the column range of each character block is unique, vertically continuous, and has clear left and right boundaries. This provides a consistent size, a definite position, and noise-controlled input for subsequent template appearance generation and normalized cross-correlation score calculation, reducing accumulated bias and improving comparison stability and repeatability.

[0100] Specifically, when determining the closed interval of column coordinates based on the set of column coordinates of character segmentation seams, it is first determined that the set of column coordinates of character segmentation seams is arranged in order from left to right. At the same time, the outermost unbiased boundary position of the flattened license plate image is determined as the leftmost unbiased boundary position and the rightmost unbiased boundary position within the entire image range. The leftmost unbiased boundary position is taken as the left boundary of the first closed interval, and the column coordinate of the first segmentation seam in the set of character segmentation seams is taken as the right boundary of this closed interval, thus forming the first column coordinate closed interval. For two adjacent segmentation seams in the set of character segmentation seams, the column coordinate of the left segmentation seam is taken as the left boundary, and the column coordinate of the right segmentation seam is taken as the right boundary, thus forming the middle column coordinate closed interval. The column coordinate of the last segmentation seam in the set of character segmentation seams is taken as the left boundary, and the rightmost unbiased boundary position is taken as the right boundary, thus forming the last column coordinate closed interval. When cropping character patches based on closed intervals of column coordinates, each row of the flattened license plate image is traversed sequentially by row coordinate. For each closed interval of column coordinates, the grayscale values ​​of all pixels in the current row whose column coordinates belong to that closed interval are extracted. These grayscale values ​​are arranged in order from left to right according to column coordinates to form the pixel sequence of the closed interval corresponding to that row. After traversing all rows, the pixel sequences of the same closed interval in each row are stacked in order from top to bottom according to row coordinates to form the character patch corresponding to that closed interval. All character patches are organized into a character patch set according to the order of closed intervals of column coordinates from left to right.

[0101] S6. Perform one-dimensional convolution on standard template characters based on bright half-width and dark half-width to generate template appearance. Based on the normalized cross-correlation score between character blocks and template appearance, confirm candidate characters and calculate the confidence level of the confirmed candidate characters.

[0102] In an embodiment of the present invention, a one-dimensional convolution is performed on standard template characters based on the bright-side half-width and dark-side half-width to generate a template appearance. Candidate characters are identified based on the normalized cross-correlation score between the character patch and the template appearance, and the confidence level of the identified candidate characters is calculated, including:

[0103] Set the height of all templates in the standard template character set to be consistent with the height of the character block, and scale or fill the character block in the column direction so that the width of the character block is consistent with the width of the standard template character;

[0104] Specifically, the standard template character set refers to a set of character image samples pre-established for comparison. The samples contain samples that fully cover the character types of the expected recognition objects, including at least numeric characters, English letters, and regional characters or separators configured according to application requirements. Each sample is stored as a grayscale image or binary image in a unified pixel coordinate domain, with clear upper, lower, left, and right boundaries of the character. The horizontal baseline and vertical center line of the character body relative to the coordinate domain are aligned, and the line direction is consistent with the vertical edge direction of the character.

[0105] Specifically, setting the height of all templates in the standard template character set to be consistent with the height of the character blocks establishes a one-to-one corresponding sampling grid in the row direction, allowing the row-by-row one-dimensional convolution kernel and the template appearance to operate at the same pixel scale, eliminating row alignment errors and interpolation distortions caused by height differences. At the same time, scaling or padding the character blocks in the column direction makes the width of the character blocks consistent with the width of the standard template characters, providing the same support range and energy normalization benchmark in the column direction, avoiding the bias of normalized cross-correlation scores caused by inconsistent widths, ensuring that similarity evaluation only reflects differences in stroke structure and is not affected by size differences, and ensuring that the template appearance generated based on the bright half-width and dark half-width completes the correlation calculation with the character blocks at the same column scale, thereby improving the reliability and repeatability of matching peaks.

[0106] Specifically, first, the height and width of the character tile are obtained, where the height is the number of rows of pixels contained in the character tile, and the width is the number of columns of pixels contained in the character tile. Simultaneously, the height and width of each template in the standard template character set are obtained, where the template height is the number of rows of pixels contained in the template, and the template width is the number of columns of pixels contained in the template. When adjusting the height of the standard template characters, the ratio of the character tile height to the template height is calculated as the height scaling ratio. Based on this ratio, the template is scaled in the row direction, and a bilinear interpolation method is used to adjust the row pixel distribution of the template so that the number of rows of pixels in the scaled template matches the height of the character tile, ensuring that the template height and the character tile height are the same. When adjusting the width of the character block, the ratio of the width of the standard template character to the width of the character block is calculated as the width scaling ratio. If the width of the character block is greater than the template width, the character block is shrunk in the column direction based on this ratio, and the number of column pixels is reduced using bilinear interpolation. If the width of the character block is less than the template width, the character block is enlarged in the column direction based on this ratio, and the number of column pixels is increased using bilinear interpolation. Alternatively, pixels with the same grayscale value as the edge pixels are filled on the left and right sides of the character block in the column direction until the number of column pixels of the character block is the same as the width of the standard template character, ultimately making the width of the character block the same as the width of the standard template character.

[0107] At each row coordinate, a one-sided exponential tailed convolution kernel is constructed in the column direction based on the bright half-width and the dark half-width.

[0108] The characters of the standard template are convolved row by row in the column direction using a one-sided exponential tail convolution kernel to generate the template appearance.

[0109] Specifically, a one-sided exponential trailing convolution kernel is constructed in the column direction based on the bright half-width and dark half-width of each row coordinate. This is to numerically synchronize the unidirectional trailing of the edges caused by lighting and shaping in the flattened license plate image to the template generation process, so that the transition width of the template appearance on the bright and dark sides of that row is consistent with the observation. This ensures that the subsequent normalized cross-correlation score mainly reflects the consistency of stroke shape rather than the difference in imaging transition. One-dimensional convolution is performed row by row on the standard template in the column direction to prevent the vertical structure of the characters from being mixed between rows and to avoid stroke misalignment caused by cross-line blurring. At the same time, the width of the convolution kernel is controlled by the bright half-width and dark half-width of each row as the only scale. This achieves the alignment of the template appearance and the character block on the same column scale without introducing new adjustable parameters, thereby improving the significance and repeatability of the matching peak and reducing the fluctuation of the correlation score caused by uneven brightness transition between rows.

[0110] Specifically, when constructing a single-sided exponential tail convolution kernel at each row coordinate, the bright half-width and dark half-width corresponding to that row and column are first determined. With the center of the convolution kernel as the origin, the left side of the column direction is the negative direction and the right side is the positive direction. The length of the convolution kernel is determined according to the bright half-width and dark half-width. It usually extends to the left to a preset multiple of the dark half-width and to the right to a preset multiple of the bright half-width to ensure coverage of the tail effect range. For each column position within the convolution kernel, if the position is to the right of the center (positive direction), its weight value is calculated using an exponential function. The independent variable of the exponential function is the distance between the position and the center, the base is a natural constant, and the exponent is the negative value of the ratio of the distance to the bright half-width. If the position is to the left of the center (negative direction), its weight value is also calculated using an exponential function. The independent variable is the absolute value of the distance between the position and the center, and the exponent is the negative value of the ratio of the absolute value to the dark half-width. After calculation, all weight values ​​of the convolution kernel are normalized so that the sum of the weight values ​​is 1, forming a single-sided exponential tail convolution kernel corresponding to that row and column. When generating the template appearance using a one-sided exponential tail convolution kernel, for each row of the standard template characters, a one-dimensional convolution operation is performed in the column direction using the corresponding one-sided exponential tail convolution kernel. Specifically, the convolution kernel is slid along the column direction. For each sliding position, the pixel grayscale value within the corresponding column range of the template row is multiplied one by one with the convolution kernel weight value, and then all the product results are summed to obtain the convolution output value at that position. After traversing all column positions of the row, the row pixel sequence after convolution is obtained. The above convolution operation is performed on each row of the standard template characters, and all the processed row pixel sequences are combined in order from top to bottom according to the row coordinates to form a template appearance consistent with the character tail feature in the flattened license plate image.

[0111] Calculate the normalized cross-correlation score between each character tile and each template appearance;

[0112] Within the same character block, the standard template character with the highest normalized cross-correlation score is selected as the candidate character;

[0113] Specifically, the normalized cross-correlation score between each character patch and each template appearance is calculated to measure the degree of shape matching between the two under a unified energy scale. By simultaneously eliminating brightness bias and contrast scaling, the obtained value reflects only the consistency of stroke geometry and boundary transition. Within the same character patch, the standard template character with the highest normalized cross-correlation score is selected as the candidate character. This is to obtain a unique and reproducible judgment result without the need for empirical thresholds or layout rules, and to ensure the fairness of comparison between different templates. It avoids selection bias caused by differences in template energy or local brightness and darkness changes in character patches, thereby improving the reliability of the matching peak.

[0114] Specifically, when calculating the normalized cross-correlation score between each character patch and each template appearance, the process first iterates through all character patches and all template appearances in the standard template character set. For the current character patch and the current template appearance, the pixel grayscale value matrices of both are obtained, where the pixel grayscale value matrix of the character patch and the pixel grayscale value matrix of the template appearance have the same number of rows and columns. The grayscale mean of the character patch is calculated by summing the grayscale values ​​of all pixels in the character patch and dividing by the total number of pixels; the grayscale mean of the template appearance is calculated by summing the grayscale values ​​of all pixels in the template appearance and dividing by the total number of pixels. The cross-correlation term is calculated by iterating through each corresponding pixel position of the character patch and the template appearance, subtracting the grayscale mean of the character patch at that position, multiplying this by the grayscale mean of the template appearance at that position, and summing all the product results. The grayscale standard deviation of the character patch is calculated by summing the squared differences between the grayscale value of each pixel in the character patch and its mean grayscale value, dividing by the total number of pixels, and taking the square root. Similarly, the grayscale standard deviation of the template appearance is calculated by summing the squared differences between the grayscale value of each pixel in the template appearance and its mean grayscale value, dividing by the total number of pixels, and taking the square root. The cross-correlation term is divided by the product of the grayscale standard deviations of the character patch and the template appearance to obtain the normalized cross-correlation score between the current character patch and the current template appearance. When selecting candidate characters within the same character patch, the normalized cross-correlation scores between that character patch and all template appearances are collected. These scores are compared, and the standard template character corresponding to the template appearance with the highest score is selected as the candidate character for the current character patch.

[0115] Calculate the pixel residual ratio between each character patch and the appearance of the corresponding candidate template;

[0116] The confidence level of each character patch is calculated based on the normalized cross-correlation score and the pixel residual ratio;

[0117] Specifically, calculating the pixel residual ratio between each character patch and its corresponding candidate template appearance is to measure the proportion of pixel differences not explained by the template appearance in the character patch energy, assuming that the size and rows and columns are already aligned. This provides supplementary discrimination for cases where the normalized cross-correlation score may still be too high due to local mismatches, subtle width differences, or reflection spots. When there are local tailing anomalies or small-scale contamination at the stroke boundaries of a character patch, the normalized cross-correlation score may remain at a high level, while the pixel residual ratio will increase significantly. This can distinguish between true matches and false peaks caused by brightness contrast or local accidental consistency. Based on this, the confidence level of each character patch is calculated according to the normalized cross-correlation score and the pixel residual ratio, so that high scores and low residuals correspond to high confidence, and low scores or high residuals correspond to low confidence. This ensures that the final judgment and observation consistency maintain a monotonic relationship, which is convenient for sorting and overall output. At the same time, it avoids reliance on empirical thresholds and layout rules, ensuring the repeatability and reviewability of the results.

[0118] Specifically, first, determine the one-to-one correspondence between the pixel positions of the character image block and the candidate template appearance. Then, iterate through each pixel of both and calculate the difference between the gray value of the corresponding pixel in the character image block and the gray value of the corresponding pixel in the candidate template appearance. Square each difference and sum them to obtain the sum of squared pixel residuals. At the same time, calculate the sum of squared gray values ​​of all pixels in the character image block as the gray energy of the character image block. Divide the sum of squared pixel residuals by the gray energy of the character image block to obtain the pixel residual ratio between the character image block and the corresponding candidate template appearance. The smaller the ratio, the higher the degree of pixel matching between the two. When calculating the confidence score of each character patch based on the normalized cross-correlation score and the pixel residual ratio, the normalized cross-correlation score is first linearly mapped so that its value range is consistent with the value range of the complementary value of the pixel residual ratio (i.e., 1 minus the pixel residual ratio). Then, preset weights are assigned to the normalized cross-correlation score and the complementary value of the pixel residual ratio, with the weight of the normalized cross-correlation score being higher than that of the complementary value of the pixel residual ratio. The normalized cross-correlation score is multiplied by its corresponding weight, and the complementary value of the pixel residual ratio is multiplied by its corresponding weight. The two products are summed, and the sum is the confidence score of the character patch. The confidence score ranges from 0 to 1, with a higher value indicating higher reliability of the candidate character corresponding to the character patch.

[0119] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for segmenting and comparing license plate characters, characterized in that, Includes the following steps: S1. Transform the target plane based on the vertex coordinates of the license plate image to generate a flattened license plate image; S2. Determine the position parameters in the flattened license plate image, and calculate the bright half-width and dark half-width based on the position parameters; S3. Generate candidate vertical edges in the flattened license plate image, and perform gradient direction marking on the candidate vertical edges based on the position parameters in the flattened license plate image; S4. Generate a set of character segmentation seam coordinates based on gradient direction markings; S5. Extract character blocks from the flattened license plate image based on the character segmentation seam coordinate set; S6. Perform one-dimensional convolution on standard template characters based on bright half-width and dark half-width to generate template appearance. Based on the normalized cross-correlation score between character blocks and template appearance, confirm candidate characters and calculate the confidence level of the confirmed candidate characters. Determine the positional parameters in the flattened license plate image, and calculate the bright half-width and dark half-width based on the positional parameters, including: For each row of the flattened license plate image, calculate the first-order difference along the column coordinate direction. The column coordinate corresponding to the local maximum value of the difference is used as the candidate vertical edge position of the corresponding row. Bilinear interpolation sampling is performed on the flattened license plate image along the normal direction of the column coordinate at each candidate vertical edge position to obtain the gray intensity sequence; The grayscale intensity sequence is linearly normalized to obtain a normalized sequence; Read the column coordinates of the normalized grayscale when the normalized grayscale is 10%, 50%, and 90% respectively to obtain the low grayscale position, the middle grayscale position, and the high grayscale position. The bright half-width is obtained by the difference between the high grayscale position and the mid grayscale position, and the dark half-width is obtained by the difference between the mid grayscale position and the low grayscale position.

2. The license plate character segmentation and comparison recognition method according to claim 1, characterized in that, The target plane is transformed based on the vertex coordinates of the license plate image to generate a flattened license plate image, including: The license plate image is detected and the circumscribed quadrilateral of the license plate region is determined. The coordinates of the four vertices of the circumscribed quadrilateral are extracted in clockwise order and used as the coordinates of the four corners of the source plane. Set the coordinates of the four corners of the target on the preset target plane, where the long side of the target plane is kept horizontal and the short side is kept vertical, and the row direction of the target plane is consistent with the vertical edge direction of the license plate characters. Calculate the perspective transformation matrix based on the four-corner coordinates of the source plane and the four-corner coordinates of the target plane; The license plate image is subjected to perspective transformation based on the perspective transformation matrix, and then a flattened license plate image is generated through bilinear interpolation.

3. The license plate character segmentation and comparison recognition method according to claim 1, characterized in that, Candidate vertical edges are generated in the flattened license plate image. Gradient direction labeling is performed on the candidate vertical edges based on the position parameters in the flattened license plate image, including: Read the grayscale low position, grayscale mid position and grayscale high position corresponding to each row of coordinates in the flattened license plate image, and assign a unique edge instance number to each set of position parameters; Calculate the arithmetic mean of the low-level and high-level grayscale positions of each edge instance, and use the average value as the unbiased boundary position corresponding to the edge instance. Calculate the average gray level on the left side of the gray level range from the low gray level position to the middle gray level position for each edge instance, and the average gray level on the right side of the gray level range from the middle gray level position to the high gray level position. Based on the comparison between the average gray levels on the left and right, the gradient direction is marked as either dark to light or light to dark.

4. The license plate character segmentation and comparison recognition method according to claim 1, characterized in that, Generate a set of character segmentation seam coordinates based on gradient direction markers, including: For each row of coordinates, read the unbiased boundary position and the gradient direction marker of the unbiased boundary, and arrange them in ascending order of column coordinates; Within the same row of coordinates, two adjacent unbiased boundary positions are considered as candidate pairs. When a candidate pair satisfies the following conditions: the gradient direction of the left boundary is from bright to dark and the gradient direction of the right boundary is from dark to bright, or the gradient direction of the left boundary is from dark to bright and the gradient direction of the right boundary is from bright to dark, the candidate pair is confirmed as a valid pair. For each valid pair, calculate the arithmetic mean of the two unbiased boundary positions in the valid pair, and use the arithmetic mean as the character segmentation column coordinates corresponding to the valid pair; Assign serial numbers to all row seams in a left-to-right order. Take the median of the column coordinates of the seams with the same serial number across all rows to obtain the set of column coordinates of the character seams.

5. The license plate character segmentation and comparison recognition method according to claim 1, characterized in that, The license plate image is cropped based on the character segmentation seam coordinate set to obtain character blocks, including: Based on the adjacent segmentation seams in the character segmentation seam column coordinate set and the position of the outermost unbiased boundary of the flattened license plate image, the closed interval of the column coordinate is determined. Based on the closed interval of the column coordinates, the corresponding pixels are cropped row by row on the flattened license plate image to obtain character blocks.

6. The license plate character segmentation and comparison recognition method according to claim 1, characterized in that, A one-dimensional convolution is performed on the standard template characters based on the bright half-width and dark half-width to generate the template appearance. Candidate characters are identified based on the normalized cross-correlation score between the character patch and the template appearance, including: Set the height of all templates in the standard template character set to be consistent with the height of the character block, and scale or fill the character block in the column direction so that the width of the character block is consistent with the width of the standard template character; At each row coordinate, a one-sided exponential tailed convolution kernel is constructed in the column direction based on the bright half-width and the dark half-width. The characters of the standard template are convolved row by row in the column direction using a one-sided exponential tail convolution kernel to generate the template appearance. Calculate the normalized cross-correlation score between each character tile and each template appearance; Within the same character block, the standard template character with the highest normalized cross-correlation score is selected as the candidate character.

7. The license plate character segmentation and comparison recognition method according to claim 1, characterized in that, Calculate the confidence level for confirming candidate characters, including: Calculate the pixel residual ratio between each character patch and the appearance of the corresponding candidate template; The confidence level of each character patch is calculated based on the normalized cross-correlation score and the pixel residual ratio.

Citation Information

Patent Citations

  • License plate recognition system and method based on image technology and medium

    CN120496044A

  • Robust cropping of license plate images

    US20130272579A1