A license plate recognition method based on image processing

By establishing a two-dimensional pixel coordinate system and an adaptive angle correction method in license plate recognition, the problem of license plate tilt correction in complex environments is solved, achieving high-accuracy and robust license plate recognition, adapting to different lighting and noise environments, and improving the stability and reliability of the recognition system.

CN121170775BActive Publication Date: 2026-05-26SOUTHWEST UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SOUTHWEST UNIV
Filing Date
2025-10-13
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing license plate recognition technologies struggle to achieve effective tilt correction in complex environments, leading to decreased character segmentation and recognition accuracy. This is especially true in scenarios such as road monitoring, mobile law enforcement, and parking lot entrances and exits, where traditional methods are sensitive to changes in lighting and noise, and are difficult to adapt to different environments and license plate styles.

Method used

By establishing a two-dimensional pixel coordinate system, performing grayscale and linear normalization processing, setting the maximum scanning angle range and angle step size, generating a symmetrical discrete angle sequence, performing rotation and inverse rotation mapping, calculating the longitudinal grayscale difference response, generating a binary response mask, accumulating the number of response pixels, selecting the optimal angle for correction, and generating the final corrected image through adaptive thresholding and inverse mapping.

Benefits of technology

It improves the robustness and accuracy of the license plate recognition system in complex scenarios, avoids interference caused by lighting and noise, ensures accurate extraction of character arrangement features and uniqueness of image correction, reduces blurring and jaggedness caused by multiple rotations, and achieves highly stable and efficient license plate recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121170775B_ABST
    Figure CN121170775B_ABST
Patent Text Reader

Abstract

This invention relates to the fields of image processing and intelligent vehicle recognition technology, and discloses a license plate recognition method based on image processing. The scheme establishes a unified pixel coordinate system, records width and height indices, performs grayscale and normalization, locates the center, and sets abnormal degradation output; it sets the maximum scanning angle and step size to generate a symmetrical angle sequence; it performs centering translation, inverse rotation, and bilinear interpolation on the output pixels angle by angle to obtain a rotated image; it calculates the vertical grayscale difference, and generates a binary mask based on the mean and standard deviation adaptive threshold; it accumulates the values ​​in the row direction and takes the peak value, first determining the angle by maximizing the peak value and then minimizing the absolute angle; based on this, it performs inverse mapping and interpolation to generate a correction image; it recalculates the ratio of the index to the original peak value, and if it improves, it outputs the angle, image, and index; otherwise, it backs down. The process covers input, preprocessing, scanning, mapping, statistics, filtering, and correction, avoiding missed detections, reducing subjective thresholds and interpolation artifacts, and using self-judgment backoff to suppress invalid corrections, improving stability and adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing and intelligent vehicle recognition technology, specifically to a license plate recognition method based on image processing. Background Technology

[0002] With the widespread application of intelligent transportation, urban security, and automated vehicle management systems, automatic license plate recognition (LPR / ALPR), as a crucial link in front-end information collection, has become a research and engineering hotspot in the field of image recognition. In practical applications, license plate images are easily affected by factors such as shooting angle, vehicle movement, and changes in lighting, resulting in varying degrees of tilt, rotation, or distortion, which in turn leads to a decrease in the accuracy of subsequent character segmentation and recognition. Especially in scenarios such as road monitoring, mobile law enforcement, and parking lot entrances and exits, the posture of the license plate is often uncontrollable, exhibiting everything from slight horizontal shifts to large-angle tilts or even vertical inversions. Therefore, how to effectively correct the tilt of license plate images in complex environments is a key foundation for improving the overall performance of license plate recognition systems.

[0003] In existing technologies, mainstream license plate tilt correction methods mostly rely on machine learning and deep learning models, or employ classic image processing techniques such as Hough transform, edge detection, and projection analysis. While deep learning-based algorithms exhibit good generalization ability under large-scale sample conditions and sufficient training, they have high requirements for training data scale, scene diversity, and device performance. Furthermore, the algorithm process is black-box, making it difficult to interpret and reproduce. In addition, deep models often perform poorly in recognizing extreme tilt angles or low-quality images that have never been seen before. Traditional methods based on projection, edge, or connected component analysis, such as horizontal histogram projection, character vertical projection peak detection, or Hough line detection to extract character line direction, while requiring no training, are sensitive to image noise, lighting changes, and edge blurring, easily leading to projection distortion, inflated responses, and misjudgments. Moreover, existing methods generally suffer from reliance on empirical parameters, manual thresholds, and difficulties in automatically calibrating edge positions. In practical scenarios, existing license plate tilt correction technologies struggle to balance engineering feasibility, algorithm interpretability, and system robustness. On the one hand, methods based on training models are complex to deploy and difficult to adapt to the diverse license plate styles in different environments, countries or regions; on the other hand, traditional algorithms based on pixel-level features or statistical analysis often fail to obtain stable and reliable correction angles when faced with problems such as uneven lighting, low image contrast, character breaks or severe occlusion, affecting the overall accuracy and system practicality of subsequent character segmentation and recognition.

[0004] Therefore, this case aims to propose a license plate recognition method based on image processing. Based on the prior that the character rows should be approximately horizontal under ideal conditions, a set of response evaluation indicators that are highly correlated with the direction of the character rows is constructed. By rotating, sampling, extracting responses and aggregating rows one by one on a finite and sufficiently covered set of angles, the angle that makes the character rows most concentrated and clearest is found. The original image is then corrected using this angle, and the result is re-evaluated and output using the same caliber indicators. Summary of the Invention

[0005] This invention provides a license plate recognition method based on image processing, which helps to solve the problems mentioned in the background art.

[0006] This invention provides the following technical solution: a license plate recognition method based on image processing, comprising:

[0007] Establish a two-dimensional pixel coordinate system, record the width, height and pixel index range of the original image, perform grayscale and linear normalization processing, determine the image center coordinates, establish abnormal input detection rules and set the default output strategy;

[0008] Set the maximum scanning angle range and angle step size, generate a symmetrical discrete angle sequence covering the negative to positive directions, and fix the sequence index;

[0009] For each angle in the angle sequence, establish a coordinate mapping relationship between rotation and inverse rotation, perform centering translation, inverse rotation, and reverse translation on the output pixels to obtain real coordinates on the original image, and perform boundary clamping and bilinear interpolation to generate the corresponding rotated image;

[0010] Calculate the longitudinal gray-level difference response on each rotated image, calculate the mean and standard deviation of the response across the entire image, set an adaptive threshold, and generate a binary response mask.

[0011] For each rotated image, the number of response pixels is accumulated row by row in the binary response mask to obtain the peak value of the row response corresponding to each angle;

[0012] Construct a sequence of peak values ​​for the row response, select the angle with the largest peak as the candidate angle, and in the case of parallel angles, first select the angle with the smaller absolute angle value, then select the angle with the smaller numerical value to form a unique optimal angle;

[0013] A corrected image is generated by performing inverse mapping and bilinear interpolation based on the optimal angle;

[0014] Repeat the vertical gray-level difference and threshold segmentation process on the corrected image to obtain the peak value of the corrected line response. Compare this peak value with the maximum peak value before correction. If the improvement conditions are met, output the optimal angle, the corrected image and the index value. If not, output the zero angle, the uncorrected image and the original index value.

[0015] Optionally, the step of establishing a two-dimensional pixel coordinate system, recording the width, height, and pixel index range of the original image, performing grayscale and linear normalization processing, determining the image center coordinates, establishing abnormal input detection rules, and setting a default output strategy specifically includes:

[0016] Construct a two-dimensional coordinate system and fix the coordinate directions;

[0017] For a three-channel color image, grayscale values ​​are generated by equal weighting of the three channels. The minimum and maximum grayscale values ​​are obtained by scanning the entire image. The grayscale values ​​are then compressed to the range of 0 to 1 by linear interval mapping.

[0018] For single-channel grayscale images, linear normalization is performed using the same minimum and maximum grayscale values ​​as in the three-channel case;

[0019] Record the image width and height, and calculate the horizontal and vertical coordinates of the center pixel;

[0020] Perform a size validity check; if the image width is not less than 2 and the height is not less than 1, proceed to the next step.

[0021] When the image width is less than 2 or the height is less than 1, the uncorrected result is output directly. The rotation angle is set to zero, and the unnormalized grayscale image is output with the default values.

[0022] Optionally, the step of setting the maximum scanning angle range and angle step size, generating a symmetrical discrete angle sequence covering the negative to positive directions, and fixing the sequence index specifically includes:

[0023] Set the absolute value of the maximum scanning angle and the angle step size, both of which are positive values;

[0024] Generate an equally spaced list of angles from the negative maximum angle to the positive maximum angle by step size, with boundary angles included at both ends of the list;

[0025] Record the total number of angle samples and the index range, and establish a one-to-one correspondence between fixed angles and the index.

[0026] Optionally, for each angle in the angle sequence, a coordinate mapping relationship between rotation and inverse rotation is established. Centered translation, inverse rotation, and reverse translation are performed on the output pixels to obtain real coordinates on the original image. Boundary clamping and bilinear interpolation are then performed to generate the corresponding rotated image. Specifically, this includes:

[0027] For each angle in the angle sequence, construct the corresponding two-dimensional rotation matrix;

[0028] Perform a center translation on each pixel position of the output image, and then perform an inverse rotation to obtain the sampling position in the original image;

[0029] The pixel gray level is calculated from the gray levels of the four neighboring areas of the sampling location using bilinear interpolation.

[0030] For cases where the sampling location exceeds the boundary, perform boundary clamping to limit it to the effective range of the original image;

[0031] Generate a rotated grayscale image corresponding to that angle.

[0032] Optionally, the step of calculating the longitudinal gray-level difference response on each rotated image, statistically analyzing the mean and standard deviation of the overall image response, setting an adaptive threshold, and generating a binary response mask specifically includes:

[0033] On a rotated grayscale image, the absolute value of the grayscale difference between adjacent rows is calculated according to the row direction to obtain the vertical gradient response map.

[0034] The mean and standard deviation of the longitudinal gradient response plot are calculated for the entire plot.

[0035] Set the threshold to the sum of the mean and standard deviation of the entire graph;

[0036] Generate a binary response mask, marking positions with response values ​​greater than the threshold as one and other positions as zero.

[0037] Optionally, the binary response mask for each rotated image is accumulated row by row to obtain the peak value of the row response corresponding to each angle, specifically including:

[0038] For each angle, the number of response pixels is accumulated row by row in the binary response mask to obtain the row response count sequence;

[0039] Extract the maximum value from the row response count sequence and record it as the row response peak at that angle.

[0040] Optionally, the construction of the row response peak sequence, selecting the angle with the largest peak as the candidate angle, and in the case of parallel peaks, first selecting the angle with the smaller absolute angle value, and then selecting the angle with the smaller numerical value, to form a unique optimal angle, specifically includes:

[0041] Collect the peak values ​​of the row responses for each angle in angular index order to form a peak sequence;

[0042] The angle with the largest peak value is selected as the candidate angle set;

[0043] When there are multiple candidate angles, the angle with the smallest absolute angle value is selected first.

[0044] If multiple angles still exist, select the angle with the smaller value to obtain the unique optimal angle.

[0045] Optionally, the step of performing inverse mapping and bilinear interpolation based on the optimal angle to generate a corrected image specifically includes:

[0046] For the unique optimal angle, perform center translation and inverse rotation on each pixel position of the target output image to obtain the sampling position in the original image;

[0047] Pixel grayscale values ​​are obtained by sampling from the original image using bilinear interpolation.

[0048] For cases where the sampling location exceeds the boundary, perform boundary clamping;

[0049] Combine all pixels to generate a tilt-corrected grayscale image.

[0050] Optionally, the step of repeating the vertical gray-level difference and threshold segmentation process on the corrected image to obtain the corrected line response peak value, comparing this peak value with the maximum peak value before correction, and outputting the optimal angle, corrected image, and index value when the improvement conditions are met, and outputting zero angle, uncorrected image, and original index value when the conditions are not met, specifically includes:

[0051] Calculate the absolute value of the vertical gray level difference on the tilt-corrected grayscale image, calculate the mean and standard deviation of the entire image, and set an adaptive threshold to the sum of the two.

[0052] Generate the corrected binary response mask, and accumulate the number of pixels marked as one by row to obtain the corrected row density sequence and row density peak;

[0053] The correction is deemed effective if the corrected row density peak value is not less than the maximum value when the correction ...

[0054] When the correction is effective, the output is the unique optimal angle, the corrected image, and the corresponding peak line density. When the correction has no gain, the output is the angle zero, the normalized grayscale image, and the peak line density when it is not corrected.

[0055] The present invention has the following beneficial effects:

[0056] 1. Traditional methods often directly apply fixed weights to three-channel images or ignore single-channel processing, lacking handling for abnormal inputs (such as extremely small or non-color images). This scheme integrates multi-channel and single-channel images into a unified grayscale and linear normalization process, dynamically calculating normalization parameters based on the minimum and maximum grayscale values ​​of the image, eliminating grayscale deviations caused by different shooting conditions or devices. Simultaneously, by explicitly establishing a two-dimensional pixel coordinate system and calculating the image center, subsequent rotational coordinate transformations have a clear reference benchmark. Furthermore, the scheme adds size validity checks and abnormal input detection rules in the preprocessing stage, directly backing up the output for inputs exceeding the specified size, avoiding invalid calculations and erroneous results. This preprocessing sub-algorithm improves the robustness and versatility of the method, providing a stable and reproducible basic data environment for subsequent angle scanning and gradient analysis.

[0057] 2. Unlike traditional methods that select only a limited number of angles or rely on Hough transform to estimate the tilt angle, the proposed scanning angle sequence construction sub-algorithm first sets the maximum scanning angle and angle step size, and automatically calculates the total number of angle samples to ensure coverage of the discrete sequence from the negative maximum angle to the positive maximum angle. Secondly, it generates and retains sequence indices through positive and negative symmetry, providing a basis for subsequent uniqueness decisions. This ensures complete coverage of the angle search space and avoids missed detections or excessive bias caused by unreasonable angle step sizes. The retention of the index allows for accurate differentiation when peak values ​​are parallel, and in the case of equal peak values, the angle with smaller deviation is prioritized, avoiding ambiguity in decision-making situations.

[0058] 3. This scheme employs inverse mapping combined with bilinear interpolation for precise image rotation and resampling at each candidate angle, while performing boundary clamping when sampling coordinates exceed limits. Compared to the pixel holes caused by general forward mapping or the jagged edges caused by nearest-neighbor interpolation, inverse mapping ensures that each pixel in the output image can find a corresponding value in the original image, while bilinear interpolation provides a smooth transition effect with controllable computational complexity, reducing interpolation artifacts. Furthermore, the boundary clamping strategy avoids blank areas or out-of-bounds anomalies caused by rotation, providing complete numerical support for subsequent grayscale difference analysis. By maximizing the accuracy and integrity of image rotation, the scheme ensures the reliability of grayscale information at each candidate angle, thereby improving the accuracy of tilt angle determination.

[0059] 4. To address the grayscale difference between character edges and the background in rotated images, this scheme dynamically calculates the mean and standard deviation of the gradient response across the entire image on the vertical grayscale gradient response map, and uses their sum as a binarization threshold to automatically segment character response regions. Compared to fixed thresholds or manual parameter tuning, this adaptive method can automatically determine the segmentation criteria based on image content without prior knowledge, adapting to differences in lighting, license plate colors, and shooting environments. Furthermore, by using absolute grayscale differences between adjacent rows rather than full pixel differences, it highlights the horizontal arrangement characteristics of characters and suppresses noise and background interference. This innovation improves the recognition accuracy of binary masks for character regions, provides a clearer response structure for row density statistics, and effectively avoids the segmentation failure of traditional methods in high-noise or complex backgrounds.

[0060] 5. After obtaining the binary mask of the character response, this scheme accumulates the number of response pixels along the row direction, and then extracts the row density peaks to reflect the pattern of the horizontal arrangement of characters. Unlike conventional methods that use Hough transform to detect lines or connected components, the row density statistical method has low computational cost and high structure, and can quickly capture the pixel-dense region of the row where the character is located. Transforming the gradient response into row-level density features preserves the horizontal distribution information of the characters while discarding the influence of individual pixel noise, making subsequent peak comparisons more stable and reliable. It improves the discriminative power of tilt angle evaluation and reduces insensitivity to character styles and text spacing in complex scenes.

[0061] 6. When multiple scanning angles yield the same line density peak, traditional methods often struggle to make a decision or rely on random selection, easily introducing instability. To address this, this solution proposes a two-level priority selection mechanism: First, it prioritizes candidate angles with smaller absolute angle values ​​to ensure minimal correction amplitude; second, when absolute angles are the same, it prioritizes angles with smaller sequence numbers to guarantee the reproducibility and consistency of the decision-making process. This innovation ensures that a unique optimal angle is always obtained even with multiple peaks, avoiding ambiguity or fluctuations in correction results; simultaneously, by adhering to the minimum angle principle, it also minimizes unnecessary distortion of image details, achieving smoother tilt correction.

[0062] 7. After determining the optimal angle, the solution does not directly output the result. Instead, it applies inverse mapping and bilinear interpolation again to finely resample the sub-pixels, generating the final corrected image. Unlike the coarse correction achieved through a single rotation, the secondary correction avoids the accumulated errors caused by the first interpolation and ensures the visual coherence and detail integrity of the corrected image. This two-stage correction strategy utilizes the efficiency of the initial peak filtering and improves the correction quality through secondary fine interpolation, effectively suppressing image blurring and jagged edges caused by multiple rotations, thus providing a higher-quality input image for subsequent recognition.

[0063] 8. Even with fine correction, there is always the possibility of ineffective or over-correction. This scheme repeats gradient segmentation and row density peak extraction on the corrected image and compares it with the maximum peak value in the uncorrected state. The correction result is only confirmed if the corrected peak value is not lower than the original peak value; otherwise, it automatically reverts to the uncorrected state, outputting the angle zero and the original image. This design integrates gain detection and a back-off strategy, innovatively constructing a self-verification mechanism for correction effectiveness at the algorithm level, avoiding the negative impact of erroneous correction. This mechanism ensures the robustness and reliability of the method, enabling the license plate recognition system to maintain high stability and accuracy even under complex shooting angles and lighting conditions. Attached Figure Description

[0064] Figure 1This is a schematic diagram of the process of the present invention. Detailed Implementation

[0065] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0066] Example, refer to Figure 1 A license plate recognition method based on image processing, comprising:

[0067] Establish a two-dimensional pixel coordinate system, record the width, height and pixel index range of the original image, perform grayscale and linear normalization processing, determine the image center coordinates, establish abnormal input detection rules and set the default output strategy;

[0068] Set the maximum scanning angle range and angle step size, generate a symmetrical discrete angle sequence covering the negative to positive directions, and fix the sequence index;

[0069] For each angle in the angle sequence, establish a coordinate mapping relationship between rotation and inverse rotation, perform centering translation, inverse rotation, and reverse translation on the output pixels to obtain real coordinates on the original image, and perform boundary clamping and bilinear interpolation to generate the corresponding rotated image;

[0070] Calculate the longitudinal gray-level difference response on each rotated image, calculate the mean and standard deviation of the response across the entire image, set an adaptive threshold, and generate a binary response mask.

[0071] For each rotated image, the number of response pixels is accumulated row by row in the binary response mask to obtain the peak value of the row response corresponding to each angle;

[0072] Construct a sequence of peak values ​​for the row response, select the angle with the largest peak as the candidate angle, and in the case of parallel angles, first select the angle with the smaller absolute angle value, then select the angle with the smaller numerical value to form a unique optimal angle;

[0073] A corrected image is generated by performing inverse mapping and bilinear interpolation based on the optimal angle;

[0074] Repeat the vertical gray-level difference and threshold segmentation process on the corrected image to obtain the peak value of the corrected line response. Compare this peak value with the maximum peak value before correction. If the improvement conditions are met, output the optimal angle, the corrected image and the index value. If not, output the zero angle, the uncorrected image and the original index value.

[0075] This paper proposes a complete license plate recognition method, covering the entire process from image input, preprocessing, angle scanning, rotation mapping, gradient analysis, response statistics, angle selection, image correction to output results. First, by establishing a standardized two-dimensional pixel coordinate system and performing preprocessing such as grayscale conversion and normalization, the differences in color channels, size, and pixel range of the input image are addressed, improving input adaptability and subsequent processing stability. Next, by setting the scanning angle range and step size, all possible license plate tilt angles are covered, ensuring no missed detections and overcoming the problem of some existing technologies only performing local estimations and being prone to correction failures. Rotation mapping and bilinear interpolation steps ensure pixel integrity and image smoothness during image correction, preventing interpolation loss and jagged edges. For each rotated image, a vertical grayscale difference response is used, combined with adaptive threshold setting based on mean and standard deviation, to automatically extract character features, avoiding the subjectivity and environmental dependence of manual thresholding. Then, the number of response pixels is accumulated row by row to form a peak response sequence, thereby achieving quantitative discrimination of the license plate text arrangement. A unique optimal angle selection method ensures that each correction is unique and stable. Finally, by comparing the indicators before and after correction and outputting triples, a self-judgment and backoff mechanism for the effectiveness of correction is constructed, effectively preventing the negative impact of over-correction or meaningless correction. Overall, this claim achieves highly accurate and adaptable license plate recognition image tilt correction through an automated, robust, and parameter-free complete process, improving the reliability and practicality of the recognition system in complex scenarios.

[0076] The process of establishing a two-dimensional pixel coordinate system, recording the width, height, and pixel index range of the original image, performing grayscale conversion and linear normalization processing, determining the image center coordinates, establishing abnormal input detection rules, and setting a default output strategy specifically includes:

[0077] Construct a two-dimensional coordinate system and fix the coordinate directions;

[0078] For a three-channel color image, grayscale values ​​are generated by equal weighting of the three channels. The minimum and maximum grayscale values ​​are obtained by scanning the entire image. The grayscale values ​​are then compressed to the range of 0 to 1 by linear interval mapping.

[0079] For single-channel grayscale images, linear normalization is performed using the same minimum and maximum grayscale values ​​as in the three-channel case;

[0080] Record the image width and height, and calculate the horizontal and vertical coordinates of the center pixel;

[0081] Perform a size validity check; if the image width is not less than 2 and the height is not less than 1, proceed to the next step.

[0082] When the image width is less than 2 or the height is less than 1, the uncorrected result is output directly. The rotation angle is set to zero, and the unnormalized grayscale image is output with the default values.

[0083] Further specific implementation steps include:

[0084] Establish a two-dimensional coordinate system, with the origin set at the top left corner of the image. The axis is horizontal to the right. The axis is vertically downward;

[0085] Number the original license plate image as The dimensions are recorded as ;in, Image width; Image height;

[0086] Will Convert to grayscale and linearly normalize to , recorded as :

[0087] S201, if For a three-channel image, set the color channels as follows: , , ;in, To normalize the grayscale image at the pixel level grayscale value; , , for Three channels at pixels Channel strength; ; ;

[0088] Set unnormalized grayscale:

[0089] ;in, The grayscale value is obtained by equal weighting of the three channels.

[0090] Calculate the minimum and maximum gray levels of the entire image:

[0091] , ;in, It is the smallest grayscale scalar value in the entire image; The maximum grayscale value for the entire image;

[0092] Normalized to: ;

[0093] S202, if Since it is already a single-channel grayscale, then use the same... , Perform normalization;

[0094] Calculate the coordinates of the image center point: , ;in, , The center of the image axis, Axis coordinates;

[0095] like and If so, then continue execution;

[0096] like or If it is set to not computable, then output directly:

[0097] , , ;in, This represents the final output rotation angle; For the final output in the image grayscale value; This represents the peak value of the final output row response.

[0098] It unifies the processing of multi-channel and single-channel images by explicitly defining the origin and axis directions of the coordinate system, achieving image grayscale conversion and linear normalization, and accurately recording the image center coordinates. Furthermore, it adds size validity checks and abnormal input detection rules. Through these specific steps, it effectively solves the recognition anomaly problems caused by inconsistent input image channel numbers, grayscale range fluctuations, and excessively small image sizes in existing technologies, ensuring the input standardization and stability of the entire algorithm flow. Simultaneously, by automatically outputting default results for abnormal cases (such as excessively small width or height), it avoids erroneous data from entering subsequent processing flows, effectively improving the system's robustness and error controllability. This rigorous preprocessing mechanism ensures that subsequent steps are performed under a unified pixel space and grayscale standard, providing a solid data foundation for high-precision license plate localization and rotation correction.

[0099] The process of setting the maximum scanning angle range and angle step size, generating a symmetrical discrete angle sequence covering the negative to positive directions, and fixing the sequence index specifically includes:

[0100] Set the absolute value of the maximum scanning angle and the angle step size, both of which are positive values;

[0101] Generate an equally spaced list of angles from the negative maximum angle to the positive maximum angle by step size, with boundary angles included at both ends of the list;

[0102] Record the total number of angle samples and the index range, and establish a one-to-one correspondence between fixed angles and the index.

[0103] Further specific implementation steps include:

[0104] Set the maximum scanning angle range to Set the scanning angle interval to Both conditions are met: , , ;in, The maximum absolute value of the scanning angle; It is the set of positive integers;

[0105] Constructing scanning angle sequence : ;in, For the first in the scan sequence One angle; For discrete angle indexes; The total number of scan angle samples. .

[0106] Detailed specifications were established for the setting and generation method of the scanning angle. By clearly defining the maximum scanning angle range and angle step size, the total number of angle samples was ensured to be precisely controllable, and an angle sequence was generated from the negative maximum angle to the positive maximum angle using a symmetrical discrete method. Each angle has a unique index, facilitating subsequent filtering. Unlike some existing technologies that only consider unidirectional or discontinuous angle sampling, this scheme can cover all reasonable tilt possibilities, reducing the risk of missed detections. Through such complete angle coverage and ordered numbering, the problems of multiple solutions, missed detections, or misjudgments that may occur in the traditional angle estimation process are solved, enabling the algorithm to accurately handle license plate rotation scenarios. At the same time, the flexible and adjustable step size and range design balances recognition accuracy and computational efficiency. Ultimately, the practical application of this step not only improves the correction accuracy but also provides a strong guarantee for the algorithm to adapt to real-world scenarios with different resolutions and different license plate tilt degrees.

[0107] For each angle in the angle sequence, a coordinate mapping relationship between rotation and inverse rotation is established. Centered translation, inverse rotation, and reverse translation are performed on the output pixels to obtain their real coordinates on the original image. Boundary clamping and bilinear interpolation are then performed to generate the corresponding rotated image. Specifically, this includes:

[0108] For each angle in the angle sequence, construct the corresponding two-dimensional rotation matrix;

[0109] Perform a center translation on each pixel position of the output image, and then perform an inverse rotation to obtain the sampling position in the original image;

[0110] The pixel gray level is calculated from the gray levels of the four neighboring areas of the sampling location using bilinear interpolation.

[0111] For cases where the sampling location exceeds the boundary, perform boundary clamping to limit it to the effective range of the original image;

[0112] Generate a rotated grayscale image corresponding to that angle.

[0113] Further specific implementation steps include:

[0114] For each scan angle Construct a two-dimensional rotation matrix:

[0115] , ;in, For size The matrix represents the rotation angle about the origin. Linear transformation; for The inverse matrix;

[0116] Index of each output pixel in the rotated image:

[0117] ; ;

[0118] First, translate each pixel position on the target rotated image to the center coordinates, and then use inverse rotation to obtain the real coordinates in the original image. : ;in, When the output pixel is The scanning angle is At that time, return to the original image. The real coordinates;

[0119] Subsequently exist upper sampling ;in, Rotation angle The grayscale of the rotated image obtained below;

[0120] Constructing a bilinear interpolation function specifically includes:

[0121] S301, Order , , , ;in, , They are respectively , Rounding down; , They are respectively , The difference between it and its integer part;

[0122] S302. Construct the boundary pinch function:

[0123] ,

[0124] ;in, for Axis boundary pinch function and for Axis boundary clamping function; , As the independent variable;

[0125] S303, then the four neighboring pixels are:

[0126] ,

[0127] ,

[0128] ,

[0129] ;in, , , , These represent the grayscale samples of the four neighboring regions of the interpolation, with the first subscript corresponding to... The axis neighborhood is defined as follows: 0 represents the left neighborhood, and 1 represents the right neighborhood; the second bit corresponds to... The axis domain is defined as follows: 0 represents the left domain, and 1 represents the right domain.

[0130] S304, The bilinear interpolation result is:

[0131] ;in, For bilinear interpolation operators, Continuous coordinates in Obtain grayscale values;

[0132] Based on this, we obtain .

[0133] The specific steps for image rotation mapping and resampling for each scanning angle are refined. By establishing the coordinate relationship between rotation and inverse rotation, centering translation, inverse rotation, and reverse translation are performed on each output pixel to obtain the real coordinates of the original image. Grayscale value sampling is then completed by combining boundary clamping and bilinear interpolation. Compared to traditional methods that only use nearest neighbor interpolation or forward mapping, this scheme effectively avoids common problems such as holes, information loss, and jagged edges in rotated images. Especially in the detailed design of boundary processing and interpolation sampling, it ensures that even with a large rotation angle, a smooth and complete rotated image can still be obtained. This provides high-fidelity input for subsequent gradient response analysis and solves the problem of discontinuous character features and difficulty in accurate extraction caused by rotation distortion in some existing schemes. Overall, this claim significantly improves the accuracy and quality of license plate image rotation processing and enhances the adaptability of the entire system to complex real-world scenarios.

[0134] The process of calculating the longitudinal gray-level difference response on each rotated image, statistically analyzing the mean and standard deviation of the overall image response, setting an adaptive threshold, and generating a binary response mask specifically includes:

[0135] On a rotated grayscale image, the absolute value of the grayscale difference between adjacent rows is calculated according to the row direction to obtain the vertical gradient response map.

[0136] The mean and standard deviation of the longitudinal gradient response plot are calculated for the entire plot.

[0137] Set the threshold to the sum of the mean and standard deviation of the entire graph;

[0138] Generate a binary response mask, marking positions with response values ​​greater than the threshold as one and other positions as zero.

[0139] Further specific implementation steps include:

[0140] In each rotated image Above, construct the vertical gray-scale gradient response:

[0141] ;

[0142] in, For the first At an angle The longitudinal gray-scale gradient response;

[0143] Calculate the overall gradient mean and standard deviation of the image:

[0144] , ,

[0145] ;in, Number of pixels; For the first Mean gradient of the entire image at the angle; For the first Standard deviation of the gradient across the entire graph at the angle;

[0146] Set the adaptive binarization threshold: ;in, For the first Adaptive binarization thresholding at different angles;

[0147] Generate a binary response mask: , ;in, For the first At angles in pixels A binary character response mask.

[0148] This paper details the steps of performing vertical gray-level difference on rotated images, calculating the mean and standard deviation of the overall image response, setting an adaptive threshold, and generating a binary response mask. By dynamically calculating the global gradient features of each rotated image and combining this with an adaptive threshold to automatically segment the character response region, the robustness and adaptability of segmentation are greatly enhanced compared to the traditional fixed threshold method. This is particularly suitable for the actual situation where there are large fluctuations in ambient lighting, color, and sharpness in license plate images. This step can effectively extract the high-frequency structure of the license plate text arrangement and reduce the impact of background interference and noise. The final binary mask lays the foundation for accurate statistical analysis of character regions and subsequent row density analysis. Through automated threshold selection and pixel-level response segmentation, the problems of manual parameter tuning being difficult to adapt to multiple scenarios and unstable segmentation are effectively solved. In detail, this response analysis not only improves the expressive power of text features but also creates a more favorable data environment for subsequent peak selection.

[0149] The binary response mask for each rotated image is used to accumulate the number of response pixels row by row to obtain the peak value of the row response corresponding to each angle, specifically including:

[0150] For each angle, the number of response pixels is accumulated row by row in the binary response mask to obtain the row response count sequence;

[0151] Extract the maximum value from the row response count sequence and record it as the row response peak at that angle.

[0152] Further specific implementation steps include:

[0153] For each row Count the number of character responses:

[0154] ;in, For the first At the angle, the first The number of pixels in the character response of the line;

[0155] Get the Maximum response row density at angle: ;in, For the first Peak line response at the angle.

[0156] This paper details how to use binary masks to count the number of response pixels in each row and obtain the peak value of the row response. This method allows the algorithm to accurately extract dense regions along the direction of license plate character arrangement. Compared to commonly used complex or time-consuming methods such as connected component analysis and Hough line detection, row cumulative statistics have the advantages of simple implementation, low computational cost, and strong discriminative power. It effectively avoids interference from background noise, character breaks, and other factors, ensuring that the text arrangement features at each scanning angle are captured efficiently and accurately. This structured row peak value analysis method is particularly suitable for processing horizontally arranged license plate characters, improving the accuracy of angle selection and subsequent correction. Furthermore, it provides a robust data foundation for selecting the optimal correction angle, preventing local anomalies or false detections from affecting global judgment, and is a crucial step in improving the overall stability of the recognition system.

[0157] The construction of the row response peak sequence involves selecting the angle with the largest peak as a candidate angle. In the case of parallel peaks, the angle with the smaller absolute angle value is selected first, followed by the angle with the smaller numerical value, to form a unique optimal angle. Specifically, this includes:

[0158] Collect the peak values ​​of the row responses for each angle in angular index order to form a peak sequence;

[0159] The angle with the largest peak value is selected as the candidate angle set;

[0160] When there are multiple candidate angles, the angle with the smallest absolute angle value is selected first.

[0161] If multiple angles still exist, select the angle with the smaller value to obtain the unique optimal angle.

[0162] Further specific implementation steps include:

[0163] Constructing a character line response peak sequence ;

[0164] Extract the rotation angle corresponding to the maximum value, and use a two-step lexicographical ordering method to ensure uniqueness when values ​​are in the same order.

[0165] , ;in, For all The maximum value; The set of angle indices to reach the maximum value;

[0166] S601, take first , ;in, for The minimum value; for China satisfies A subset of the index;

[0167] S602, Take again , ;in, For the final and unique angle index; This is the final selected optimal correction angle.

[0168] This paper proposes a method to select the optimal angle by constructing a sequence of peak values ​​in the row response and employing a two-level priority rule of "minimum absolute angle value" and "minimum sequence number." Compared to some existing technologies that handle multi-peak parallel situations unclearly or even randomly, this multi-level selection mechanism ensures a unique, definite, and reproducible corrected angle output for each round of recognition. Prioritizing the minimum absolute angle value reduces image correction distortion, ensures maximum preservation of original image details, and prevents excessive rotation. A smaller priority sequence number improves the stability and consistency of the algorithm's decision-making. Overall, this optimization strategy effectively avoids ambiguity in angle selection and back-and-forth shaking, improving the system's automatic correction capability for various license plate angles in actual shooting (especially when tilted or parallel), which is beneficial for the robust execution of subsequent deep recognition algorithms.

[0169] The step of performing inverse mapping and bilinear interpolation based on the optimal angle to generate a corrected image specifically includes:

[0170] For the unique optimal angle, perform center translation and inverse rotation on each pixel position of the target output image to obtain the sampling position in the original image;

[0171] Pixel grayscale values ​​are obtained by sampling from the original image using bilinear interpolation.

[0172] For cases where the sampling location exceeds the boundary, perform boundary clamping;

[0173] Combine all pixels to generate a tilt-corrected grayscale image.

[0174] Further specific implementation steps include:

[0175] Using reverse mapping pairs sampling:

[0176] S701. Index each output pixel of the corrected image:

[0177] , ;

[0178] S702. Calculate its sampling coordinates in the original image:

[0179] ;in, The final corrected image grayscale value; , For the corresponding output pixels In the original image The sampling real coordinates; Let be a rotation matrix, with angle . ;

[0180] Using bilinear interpolation and boundary pinch, we obtain: .

[0181] This paper clarifies the detailed steps involved in regenerating the corrected image through inverse mapping and bilinear interpolation after selecting the optimal angle. Unlike existing methods that perform only one coarse correction, this secondary fine mapping effectively reduces the accumulated error from the initial interpolation and improves the clarity and character coherence of the corrected image. By precisely inverse mapping each pixel and strictly correcting it according to the optimal angle, this claim effectively suppresses image blurring and jagged edges caused by multiple rotations. This not only improves image readability but also provides higher-quality input for subsequent license plate character segmentation and recognition algorithms. This detailed optimization enhances the robustness of the entire recognition chain under complex environments and different rotation amplitudes, which is a crucial guarantee for improving the system's final recognition rate.

[0182] The process of repeating the vertical gray-level difference and threshold segmentation on the corrected image to obtain the peak value of the corrected line response is described. This peak value is then compared with the maximum peak value before correction. If the enhancement conditions are met, the optimal angle, the corrected image, and the index value are output; otherwise, zero angle, the uncorrected image, and the original index value are output. Specifically, this includes:

[0183] Calculate the absolute value of the vertical gray level difference on the tilt-corrected grayscale image, calculate the mean and standard deviation of the entire image, and set an adaptive threshold to the sum of the two.

[0184] Generate the corrected binary response mask, and accumulate the number of pixels marked as one by row to obtain the corrected row density sequence and row density peak;

[0185] The correction is deemed effective if the corrected row density peak value is not less than the maximum value when the correction ...

[0186] When the correction is effective, the output is the unique optimal angle, the corrected image, and the corresponding peak line density. When the correction has no gain, the output is the angle zero, the normalized grayscale image, and the peak line density when it is not corrected.

[0187] Further specific implementation steps include:

[0188] In correcting the image Calculate and statistically analyze the vertical grayscale gradient:

[0189] ;

[0190] ;

[0191] ;

[0192] , ;

[0193] , ;in, For the corrected image in The longitudinal gradient response; , The mean and standard deviation of the gradient of the entire image after correction; The corrected adaptive threshold; A binary mask for the corrected image; This is an indicator function; it takes the value 1 when the condition is true and 0 when the condition is false. For the corrected first The character response count for the line; The peak value of the entire row response after correction;

[0194] like If the correction is successful, the angle will be output. ,image With indicators ;

[0195] like If the correction results in no gain, the system reverts to the uncorrected state, outputting an angle of 0 and an image. ,index ;

[0196] Final output triplet structure:

[0197] .

[0198] A self-verification mechanism for the corrected image effect is proposed. This involves repeatedly performing gradient segmentation and line response statistics on the corrected image and comparing it with the maximum peak value before correction. The corrected result is only output when there is an improvement; otherwise, it automatically reverts to the uncorrected state. This gain determination and back-off mechanism effectively avoids performance degradation caused by over-correction or incorrect correction, representing a significant innovation that many traditional solutions have not fully considered. It allows the method to dynamically decide whether to adopt the correction operation based on the actual image content, preventing unnecessary distortion of already upright license plates or optimal images, thus enhancing the algorithm's intelligence and practicality. In detail, this mechanism ensures that the system can make reasonable decisions even in edge scenarios, improving the reliability and stability of the output results.

[0199] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0200] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. An image processing-based license plate recognition method, characterized by, include: Establish a two-dimensional pixel coordinate system, record the width, height and pixel index range of the original image, perform grayscale and linear normalization processing, determine the image center coordinates, establish abnormal input detection rules and set the default output strategy; Set the maximum scanning angle range and angle step size, generate a symmetrical discrete angle sequence covering the negative to positive directions, and fix the sequence index; For each angle in the angle sequence, establish a coordinate mapping relationship between rotation and inverse rotation, perform centering translation, inverse rotation, and reverse translation on the output pixels to obtain real coordinates on the original image, and perform boundary clamping and bilinear interpolation to generate the corresponding rotated image; Calculate the longitudinal gray-level difference response on each rotated image, calculate the mean and standard deviation of the response across the entire image, set an adaptive threshold, and generate a binary response mask. For each rotated image, the number of response pixels is accumulated row by row in the binary response mask to obtain the peak value of the row response corresponding to each angle; Construct a sequence of peak values ​​for the row response, select the angle with the largest peak as the candidate angle, and in the case of parallel angles, first select the angle with the smaller absolute angle value, then select the angle with the smaller numerical value to form a unique optimal angle; A corrected image is generated by performing inverse mapping and bilinear interpolation based on the optimal angle; Repeat the vertical gray-level difference and threshold segmentation process on the corrected image to obtain the peak value of the corrected line response. Compare this peak value with the maximum peak value before correction. If the improvement conditions are met, output the optimal angle, the corrected image and the index value. If not, output the zero angle, the uncorrected image and the original index value.

2. The image processing-based license plate recognition method of claim 1, wherein, The process of establishing a two-dimensional pixel coordinate system, recording the width, height, and pixel index range of the original image, performing grayscale conversion and linear normalization processing, determining the image center coordinates, establishing abnormal input detection rules, and setting a default output strategy specifically includes: Construct a two-dimensional coordinate system and fix the coordinate directions; For a three-channel color image, grayscale values ​​are generated by equal weighting of the three channels. The minimum and maximum grayscale values ​​are obtained by scanning the entire image. The grayscale values ​​are then compressed to the range of 0 to 1 by linear interval mapping. For single-channel grayscale images, linear normalization is performed using the same minimum and maximum grayscale values ​​as in the three-channel case; Record the image width and height, and calculate the horizontal and vertical coordinates of the center pixel; Perform a size validity check; if the image width is not less than 2 and the height is not less than 1, proceed to the next step. When the image width is less than 2 or the height is less than 1, the uncorrected result is output directly. The rotation angle is set to zero, and the unnormalized grayscale image is output with the default values.

3. The image processing based license plate recognition method of claim 2, wherein, The process of setting the maximum scanning angle range and angle step size, generating a symmetrical discrete angle sequence covering the negative to positive directions, and fixing the sequence index specifically includes: Set the absolute value of the maximum scanning angle and the angle step size, both of which are positive values; Generate an equally spaced list of angles from the negative maximum angle to the positive maximum angle by step size, with boundary angles included at both ends of the list; Record the total number of angle samples and the index range, and establish a one-to-one correspondence between fixed angles and the index.

4. The image processing-based license plate recognition method of claim 3, wherein, For each angle in the angle sequence, a coordinate mapping relationship between rotation and inverse rotation is established. Centered translation, inverse rotation, and reverse translation are performed on the output pixels to obtain their real coordinates on the original image. Boundary clamping and bilinear interpolation are then performed to generate the corresponding rotated image. Specifically, this includes: For each angle in the angle sequence, construct the corresponding two-dimensional rotation matrix; Perform a center translation on each pixel position of the output image, and then perform an inverse rotation to obtain the sampling position in the original image; The pixel gray level is calculated from the gray levels of the four neighboring areas of the sampling location using bilinear interpolation. For cases where the sampling location exceeds the boundary, perform boundary clamping to limit it to the effective range of the original image; Generate a rotated grayscale image corresponding to that angle.

5. The license plate recognition method based on image processing according to claim 4, characterized in that, The process of calculating the longitudinal gray-level difference response on each rotated image, statistically analyzing the mean and standard deviation of the overall image response, setting an adaptive threshold, and generating a binary response mask specifically includes: On a rotated grayscale image, the absolute value of the grayscale difference between adjacent rows is calculated according to the row direction to obtain the vertical gradient response map. The mean and standard deviation of the longitudinal gradient response plot are calculated for the entire plot. Set the threshold to the sum of the mean and standard deviation of the entire graph; Generate a binary response mask, marking positions with response values ​​greater than the threshold as one and other positions as zero.

6. The license plate recognition method based on image processing according to claim 5, characterized in that, The binary response mask for each rotated image is used to accumulate the number of response pixels row by row to obtain the peak value of the row response corresponding to each angle, specifically including: For each angle, the number of response pixels is accumulated row by row in the binary response mask to obtain the row response count sequence; Extract the maximum value from the row response count sequence and record it as the row response peak at that angle.

7. The license plate recognition method based on image processing according to claim 6, characterized in that, The construction of the row response peak sequence involves selecting the angle with the largest peak as a candidate angle. In the case of parallel peaks, the angle with the smaller absolute angle value is selected first, followed by the angle with the smaller numerical value, to form a unique optimal angle. Specifically, this includes: Collect the peak values ​​of the row responses for each angle in angular index order to form a peak sequence; The angle with the largest peak value is selected as the candidate angle set; When there are multiple candidate angles, the angle with the smallest absolute angle value is selected first. If multiple angles still exist, select the angle with the smaller value to obtain the unique optimal angle.

8. The license plate recognition method based on image processing according to claim 7, characterized in that, The step of performing inverse mapping and bilinear interpolation based on the optimal angle to generate a corrected image specifically includes: For the unique optimal angle, perform center translation and inverse rotation on each pixel position of the target output image to obtain the sampling position in the original image; Pixel grayscale values ​​are obtained by sampling from the original image using bilinear interpolation. For cases where the sampling location exceeds the boundary, perform boundary clamping; Combine all pixels to generate a tilt-corrected grayscale image.

9. A license plate recognition method based on image processing according to claim 8, characterized in that, The process of repeating the vertical gray-level difference and threshold segmentation on the corrected image to obtain the peak value of the corrected line response is described. This peak value is then compared with the maximum peak value before correction. If the enhancement conditions are met, the optimal angle, the corrected image, and the index value are output; otherwise, zero angle, the uncorrected image, and the original index value are output. Specifically, this includes: Calculate the absolute value of the vertical gray level difference on the tilt-corrected grayscale image, calculate the mean and standard deviation of the entire image, and set an adaptive threshold to the sum of the two. Generate the corrected binary response mask, and accumulate the number of pixels marked as one by row to obtain the corrected row density sequence and row density peak; The correction is deemed effective if the corrected row density peak value is not less than the maximum value when the correction ... When the correction is effective, the output is the unique optimal angle, the corrected image, and the corresponding peak line density. When the correction has no gain, the output is the angle zero, the normalized grayscale image, and the peak line density when it is not corrected.