OCR (Optical Character Recognition) method and system for low-quality image

By constructing brightness level adjustment paths and grid division, combined with grayscale gradient and slope analysis, the problems of blurred character boundaries and adhesion in low-quality images are solved, and the accuracy of OCR recognition and semantic coherence are improved.

CN120656178AInactive Publication Date: 2025-09-16深圳牛图科技有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510737681.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-09-16
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional OCR recognition technology for low-quality images has difficulty adapting to abnormal changes in local grayscale distribution when processing low-quality images, resulting in blurred character boundary information, inaccurate elimination of non-character areas, rough character adhesion processing, and semantic confusion in recognition results.

Method used

By constructing the adjustment path relationship between brightness levels, dividing the image grid, analyzing the grayscale gradient and slope changes, identifying and eliminating non-character areas, segmenting the character adhesion boundaries, and combining semantic analysis to correct the recognition results.

Benefits of technology

The accuracy of eliminating non-character areas is improved, the refined segmentation of character adhesion is achieved, and the stability and semantic integrity of the recognition results are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120656178A_ABST
    Figure CN120656178A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of character recognition, in particular to an OCR (Optical Character Recognition) method and system for a low-quality image, and the method comprises the following steps: extracting a pixel brightness value and constructing a grade adjustment path, dividing grids and removing non-character regions after adjusting the brightness of the image, recognizing candidate region boundary detection structure conflicts, and segmenting character boundaries. Analyzing the character stability degree, adjusting the credibility, correcting the semantic structure, and outputting an identification information correction record. According to the method, through construction and dynamic adjustment of the brightness level transition relation, low-quality image brightness calibration and detail information enhancement are achieved, gray gradient uniformity analysis is combined, the non-character region elimination accuracy is improved, structural conflict points are recognized through boundary slope mutation, fine processing of character adhesion segmentation is achieved, and the accuracy of character adhesion segmentation is improved. The recognition credibility is adjusted by using structural features, the stability of abnormal character judgment is enhanced, and the semantic integrity and logic coherence of an output text are improved through a semantic sequence and fitting degree evaluation mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of character recognition, and in particular to an OCR recognition method and system for low-quality images. Background Art

[0002] The field of character recognition technology includes the automatic recognition and conversion process of character information contained in images. The core content of this technology includes image acquisition, character area positioning, character feature extraction, character classification and recognition, and structural reconstruction of the text after recognition. It aims to separate character information from static or dynamic images and convert it into text data that can be recognized and processed by computers. Application scenarios cover document digitization, bill recognition, license plate recognition, mobile device camera recognition, etc., including the use of image enhancement, image segmentation, pattern recognition, deep learning and other methods to complete character extraction and recognition, focusing on the stable acquisition of character structural features and the generalization ability of classification models.

[0003] Among them, an OCR recognition method for low-quality images focuses on character recognition processing under conditions of poor image quality, aiming to solve the problem of interference in the character recognition process caused by factors such as image blur, severe noise interference, low resolution or poor shooting lighting conditions. Specifically, it includes adjusting the image brightness distribution, combining contrast stretching to enhance the image grayscale details, highlighting the edge features of characters, extracting high-response character areas, detecting character candidate areas through regional connectivity and morphological structure feature analysis, filtering non-character areas based on the size of the connected domain, performing adhesion character segmentation and character category prediction, and combining the language model context probability and dictionary matching mechanism to correct the recognition result text.

[0004] When processing low-quality images, traditional OCR recognition technology relies on overall brightness contrast stretching and simple edge enhancement to adjust image quality. It lacks a detailed distinction between the changing characteristics of different brightness levels within the image, and is difficult to adapt to abnormal changes in local grayscale distribution, resulting in blurred character boundary information. In the non-character area elimination stage, it relies on regional connectivity and size filtering, and does not effectively consider the subtle differences in local area gradients, resulting in non-character areas with delicate structures being misjudged as character areas, increasing the difficulty of subsequent processing. For the problem of character adhesion, overall projection analysis is used for rough segmentation, which makes it difficult to handle complex morphological adhesion characters and accurately identify boundaries. Post-recognition semantic correction methods are usually based on fixed language models and dictionary matching for error correction, and lack the linkage evaluation of character stability and sentence logical relationship, resulting in semantic jumps or contextual logic confusion, affecting text recognition effects. Summary of the Invention

[0005] In order to solve the technical problems existing in the prior art, the embodiments of the present invention provide a method and system for OCR recognition of low-quality images. The technical solution is as follows:

[0006] To achieve the above objectives, the present invention adopts the following technical solution: a method for OCR recognition of low-quality images, comprising the following steps:

[0007] S1: Extract the brightness value of each pixel in the image, calculate the pixel distribution density and grayscale fluctuation amplitude of each brightness level, analyze the transition trend and transition intensity between adjacent brightness levels, construct the adjustment path relationship between brightness levels, and obtain the brightness adjustment parameters;

[0008] S2: Calling the brightness adjustment parameter, adjusting the image brightness and dividing it into multiple grids, extracting the change gradient and fluctuation amplitude of the pixel grayscale in each grid, analyzing the uniformity of the grayscale gradient in each grid, detecting and eliminating non-character areas based on the grayscale change trend and gradient amplitude, and obtaining character candidate areas;

[0009] S3: Based on the character candidate region, identify the region boundary and extract the coordinate position of each contour point on the boundary, extract the slope of the coordinates of adjacent boundary points, identify the character adhesion intersection points by analyzing the changing trend of continuous slope values, detect structural conflicts based on the angle between adjacent boundary lines, and obtain the coordinates of the conflict position;

[0010] S4: Based on the conflict position coordinates, segment the character recognition boundary, recognize the characters in the image, analyze the degree of closure of the character outline and the continuity of the strokes, calculate the stability of the character structure and adjust the credibility of the character recognition results, and output character recognition information.

[0011] As a further solution of the present invention, the brightness adjustment parameters include a brightness level mapping table, a pixel distribution density matrix, and a grayscale transition intensity value; the character candidate area includes a valid character grid number, a character grid grayscale distribution map, and a non-character area removal mark; the conflict position coordinates include a boundary continuity interruption point position, a character adhesion intersection point coordinates, and a structural conflict slope angle value; the character recognition information includes a character boundary closure index, a stroke continuity coefficient, and a character structure credibility level.

[0012] As a further solution of the present invention, the steps of extracting the brightness value of each pixel in the image, calculating the pixel distribution density and grayscale fluctuation amplitude of each brightness level, analyzing the transition trend and transition intensity between adjacent brightness levels, and constructing the adjustment path relationship between the brightness levels to obtain the brightness adjustment parameters are as follows:

[0013] S101: extracting the brightness value of each pixel in the image, extracting the number of pixels and the grayscale value distribution range at each brightness level according to the brightness level of each pixel, calculating the pixel density and grayscale fluctuation amplitude within each brightness level, and generating brightness level density statistics;

[0014] S102: Based on the brightness level density statistics, extract the grayscale mean and pixel distribution difference between adjacent brightness levels, identify the transition intensity, perform direction identification on the difference sequence and extract the jump segment, identify the transition trend, and generate grayscale jump trend information;

[0015] S103: sorting the number value of each brightness level according to the grayscale jump trend information and the jump direction sequence, extracting the connection sequence between the brightness levels, identifying the path correspondence between the brightness levels, and obtaining the brightness adjustment parameter.

[0016] As a further solution of the present invention, the brightness adjustment parameter is called, the image brightness is adjusted and divided into multiple grids, the change gradient and fluctuation amplitude of the pixel grayscale in each grid are extracted, the uniformity of the grayscale gradient in each grid is analyzed, and non-character areas are detected and eliminated based on the grayscale change trend and gradient amplitude. The steps of obtaining character candidate areas are specifically as follows:

[0017] S201: calling the brightness adjustment parameter to adjust the brightness value of each pixel in the image, and dividing the image into multiple grid areas to obtain a grid division result;

[0018] S202: Based on the grid division result, extract the grayscale value of each pixel in the grid, identify the direction of grayscale change in each grid, and extract the average fluctuation amplitude of the grayscale change gradient to obtain the grid grayscale fluctuation index value;

[0019] S203: According to the grid grayscale fluctuation index value, according to the grayscale change trend and gradient amplitude, identify and eliminate non-character areas in the image to obtain character candidate areas.

[0020] As a further solution of the present invention, based on the character candidate area, the area boundary is identified and the coordinate position of each contour point of the boundary is extracted, the slope of the coordinates of adjacent boundary points is extracted, and the character adhesion intersection point is identified by analyzing the changing trend of the continuous slope value. The structural conflict is detected according to the angle between adjacent boundary lines. The steps of obtaining the coordinates of the conflict position are specifically as follows:

[0021] S301: Based on the character candidate area, extract the pixel contour line of the boundary of each candidate area, collect the horizontal and vertical coordinate values ​​of consecutive pixel points on the contour line, and obtain a contour boundary coordinate set;

[0022] S302: Calculate the slope between each pair of adjacent boundary point coordinates based on the outline boundary coordinate set and record the sequential distribution, detect slope abnormal areas and identify intersection points of character adhesion, and obtain slope change trend interval values;

[0023] S303: Calculate the angle between adjacent boundary lines based on the slope change trend interval value and the intersection point coordinates, detect structural conflicts, and obtain conflict position coordinate values.

[0024] As a further solution of the present invention, based on the conflict position coordinates, the character recognition boundary is segmented, the characters in the image are recognized, the degree of closure of the character outline and the continuity of the strokes are analyzed, the stability of the character structure is calculated and the credibility of the character recognition result is adjusted, and the steps of outputting the character recognition information are specifically as follows:

[0025] S401: Based on the conflict position coordinate values, locate the boundary intersection point of the character adhesion area, segment the character recognition boundary, perform character recognition, and obtain a character image recognition result;

[0026] S402: extracting the coordinates of the starting and ending points of the contour corresponding to each character based on the character image recognition result, analyzing the degree of closure of the character contour, extracting the number of connections and breakpoints of each character stroke, and obtaining a character structure feature parameter value;

[0027] S403: calling the character structure feature parameter value, calculating the stability score value of each character structure according to the closure degree of the character outline and the stroke continuity, and adjusting the recognition confidence level of the corresponding character to generate character recognition information.

[0028] As a further solution of the present invention, the specific formula for calculating the stability score of each character structure is:

[0029]

[0030] Calculate the character structure stability score;

[0031] Among them, S i is the structural stability score of the i-th character, C i is the closed degree of the i-th character contour, is the average value of the closedness of all character contours, σ C is the standard deviation of the closedness of all character contours, L ij is the actual connected length of the jth stroke in the i-th character, M i is the median value of the connected length of the strokes in the i-th character, n i is the number of broken strokes in the i-th character, W i is the boundary confidence factor of the image region where the i-th character is located, i is the character index in the image, and j is the stroke segment index within the i-th character.

[0032] As a further embodiment of the present invention, the method further comprises:

[0033] S5: Based on the character recognition information, the sentence is divided into multiple semantic segments according to the character order, punctuation marks, spaces, and structural pauses. Semantic segments with order conflicts are detected through semantic analysis, and semantic breakpoints are extracted. In combination with the credibility of the character recognition results, the degree of fit of each sentence template to the current character combination structure is evaluated, the character recognition results are corrected, and a recognition information correction record is output;

[0034] The recognition information correction record includes a semantic breakpoint index, a sentence template matching score, and a character combination structure adjustment path.

[0035] As a further solution of the present invention, based on the character recognition information, the sentence is divided into multiple semantic segments according to the character order, combined with punctuation marks, spaces, and structural pauses, semantic segments with order conflicts are detected through semantic analysis, and semantic breakpoints are extracted. In combination with the credibility of the character recognition results, the degree of fit of each sentence template to the current character combination structure is evaluated, the character recognition results are corrected, and the steps of outputting the recognition information correction record are specifically as follows:

[0036] S501: Based on the character recognition information, according to the position order of each character in the image, combined with the position of punctuation marks, the width of the space between characters, and the pause marker character, the sentence is divided into multiple semantic segments to obtain semantic segment division information;

[0037] S502: performing character sorting analysis on the character combinations in each semantic segment based on the semantic segment division information, detecting segments and paragraphs with abnormal logical order and incoherent part-of-speech combinations, extracting semantic breakpoints, and obtaining semantic conflict break information;

[0038] S503: Invoking the semantic conflict and rupture information, combining the frequency of occurrence of each character sequence in the sentence template, the degree of word order standardization, and the character recognition reliability, evaluating the degree of fit of each sentence template to the current character combination structure, and correcting the character recognition results to obtain a recognition information correction record;

[0039] The specific formula for evaluating the degree of fit of each sentence template to the current character combination structure is:

[0040]

[0041] Calculate the sentence fitting deviation value;

[0042] Among them, F k is the fitting deviation value of the k-th sentence template, n k is the total number of characters in the k-th sentence template, m is the index variable of the character sequence in the current template, R km is the character confidence score of the mth character in the kth sentence template in the recognition result, Tkm is the standard confidence score of the mth character in the kth sentence template, S k is the number of semantic breakpoints detected in the k-th sentence template, Q k is the word order normalization coefficient of the k-th sentence template, K is the total number of candidate sentence templates, and k is the serial index of the candidate sentence template.

[0043] On the other hand, a low-quality image OCR recognition system is provided, which is applied to the low-quality image OCR recognition method, and the system includes:

[0044] The brightness control module extracts the brightness value of each pixel in the image, divides the brightness levels, and calculates the pixel distribution density and grayscale fluctuation amplitude within each level. It also evaluates the grayscale change trend and jump intensity between adjacent brightness levels, constructs the adjustment path relationship between brightness levels, and generates brightness adjustment parameters.

[0045] The region elimination module adjusts the brightness of the image based on the brightness adjustment parameter, divides the corrected image into multiple grid regions, calculates the gradient direction and fluctuation amplitude of the grayscale change of pixels in the grid, identifies and eliminates non-character regions based on the grayscale change trend and gradient amplitude, and obtains character candidate regions;

[0046] The boundary detection module extracts the coordinate positions of the boundary contour points of each region based on the character candidate region, calculates the slope values ​​between consecutive contour points on the boundary, and identifies the intersection area of ​​character adhesion based on the change trend in the slope sequence. It uses the angle between adjacent boundary line segments to detect the structural conflict area and obtain the coordinates of the conflict position;

[0047] The character evaluation module segments the character recognition boundary based on the conflict position coordinates, recognizes each segmented character, measures the spatial distance between the starting and ending points of each character contour line and performs normalized calculation on the contour perimeter, analyzes the continuity of the connection between the strokes within the character, calculates the stability of the character structure, adjusts the recognition reliability, and generates character recognition information;

[0048] The semantic correction module divides the recognition results into multiple semantic segments based on the character recognition information and according to the character arrangement order and punctuation, space, and pause marks, detects the segment positions of semantic sorting conflicts, extracts semantic breakpoints in the sorting conflict segments, and evaluates the degree of fit of each sentence template to the current character combination structure in combination with the character recognition credibility, corrects the character recognition results, and establishes a recognition information correction record.

[0049] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0050] By constructing and dynamically adjusting the relationship between brightness level transitions, the brightness of low-quality images can be calibrated and detail information can be enhanced. Combined with grayscale gradient uniformity analysis, the accuracy of non-character area elimination is improved. Boundary slope mutation is used to identify structural conflict points, and refined processing of character adhesion segmentation is achieved. Structural features are used to adjust recognition credibility, which enhances the stability of abnormal character judgment. Through the semantic order and fit evaluation mechanism, the semantic integrity and logical coherence of the output text are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0052] Figure 1 It is a schematic diagram of the workflow of the present invention;

[0053] Figure 2 This is a detailed flow chart of S1 of the present invention;

[0054] Figure 3 This is a detailed flow chart of S2 of the present invention;

[0055] Figure 4 This is a detailed flow chart of S3 of the present invention;

[0056] Figure 5 This is a detailed flow chart of S4 of the present invention;

[0057] Figure 6 This is a detailed flow chart of S5 of the present invention;

[0058] Figure 7 It is a system flow chart of the present invention. DETAILED DESCRIPTION

[0059] The technical solution of the present invention is described below in conjunction with the accompanying drawings.

[0060] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as an "exemplary" in the present invention should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner. Furthermore, in the embodiments of the present invention, "and / or" can mean both or either of the two.

[0061] In the embodiments of the present invention, the terms "image" and "picture" may be used interchangeably. It should be noted that, when the distinction between them is not emphasized, their intended meanings are the same. The terms "of," "corresponding," and "corresponding" may be used interchangeably. It should be noted that, when the distinction between them is not emphasized, their intended meanings are the same.

[0062] In the embodiments of the present invention, sometimes a subscript such as W1 may be written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are the same.

[0063] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0064] See also Figure 1 The present invention provides a technical solution, a method for OCR recognition of low-quality images, comprising the following steps:

[0065] S1: Extract the brightness value of each pixel in the image, calculate the pixel distribution density and grayscale fluctuation amplitude of each brightness level, analyze the transition trend and transition intensity between adjacent brightness levels, construct the adjustment path relationship between brightness levels, and obtain the brightness adjustment parameters;

[0066] S2: Call the brightness adjustment parameter, adjust the image brightness and divide it into multiple grids, extract the change gradient and fluctuation amplitude of the pixel grayscale in each grid, analyze the uniformity of the grayscale gradient in each grid, detect and eliminate non-character areas based on the grayscale change trend and gradient amplitude, and obtain character candidate areas;

[0067] S3: Based on the character candidate region, identify the region boundary and extract the coordinate position of each boundary contour point. Extract the slope of the coordinates of adjacent boundary points. By analyzing the changing trend of the continuous slope value, identify the intersection of character adhesion. Detect structural conflicts based on the angle between adjacent boundary lines and obtain the coordinates of the conflict position.

[0068] S4: Based on the conflicting position coordinates, the character recognition boundary is segmented, the characters in the image are recognized, the degree of closure of the character contour and the continuity of the strokes are analyzed, the stability of the character structure is calculated, the reliability of the character recognition results is adjusted, and the character recognition information is output;

[0069] S5: Based on the character recognition information, the sentence is divided into multiple semantic segments according to the character order, punctuation marks, spaces, and structural pauses. Semantic segments with order conflicts are detected through semantic analysis, and semantic breakpoints are extracted. Combined with the credibility of the character recognition results, the degree of fit of each sentence template to the current character combination structure is evaluated. The character recognition results are corrected and the recognition information correction record is output.

[0070] Brightness adjustment parameters include brightness level mapping table, pixel distribution density matrix, grayscale transition intensity value; character candidate area includes valid character grid number, character grid grayscale distribution map, non-character area removal mark; conflict position coordinates include boundary continuity interruption point position, character adhesion intersection coordinates, structural conflict slope angle value; character recognition information includes character boundary closure index, stroke coherence coefficient, character structure credibility level; recognition information correction record includes semantic breakpoint index, sentence template matching score, and character combination structure adjustment path.

[0071] See also Figure 2 , extract the brightness value of each pixel in the image, calculate the pixel distribution density and grayscale fluctuation amplitude of each brightness level, analyze the transition trend and transition intensity between adjacent brightness levels, and construct the adjustment path relationship between brightness levels. The specific steps to obtain the brightness adjustment parameters are as follows:

[0072] S101: extracting the brightness value of each pixel in the image, extracting the number of pixels and the grayscale value distribution range at each brightness level according to the brightness level of each pixel, calculating the pixel density and grayscale fluctuation amplitude within each brightness level, and generating brightness level density statistics;

[0073] Extract the brightness value of each pixel in the image, scan the image pixel by pixel and record the grayscale value of each pixel. Take a 256-level grayscale image as an example, divide the pixel grayscale values ​​from 0 to 255 step by step, and the brightness level of each pixel is the level corresponding to its grayscale value. Count the specific number of pixels in each brightness level. For example, in an image with a size of 512×512, the number of pixels at grayscale level 120 is 2500. At the same time, record the distribution range of the grayscale values ​​of all pixels in each brightness level in detail. For example, at brightness level 120, the pixel grayscale values ​​may actually be concentrated between the grayscale range of 118 and 122. Get the minimum value of the brightness level grayscale distribution of 118 and the maximum value 122. According to the above statistics, the pixel density of each brightness level is obtained, which is specifically the number of pixels in each level divided by the total number of pixels in the image. For example, the pixel density of brightness level 120 is 2500 divided by 262144, which is calculated to be approximately 0.0095. Next, the grayscale value distribution range in each brightness level is analyzed, and the above-mentioned grayscale minimum value 118 and maximum value 122 are called to calculate the grayscale fluctuation amplitude, that is, the grayscale maximum value is subtracted from the minimum value, which is actually calculated as 122 minus 118 to obtain 4. The pixel density and grayscale fluctuation amplitude calculations in all 256 brightness levels are completed in sequence, and the data statistics and analysis of all brightness levels are completed, and finally the brightness level density statistics are generated.

[0074] S102: Based on the brightness level density statistics, extract the grayscale mean and pixel distribution difference between adjacent brightness levels, identify the transition intensity, identify the direction of the difference sequence and extract the jump segment, identify the transition trend, and generate grayscale jump trend information;

[0075] Based on the above brightness level density statistics, a specific analysis is performed on adjacent brightness levels. For example, between brightness levels 120 and 121, the grayscale values ​​of the pixels in the two levels are called respectively, and the grayscale mean of the two levels is calculated respectively. The calculation method is to sum the grayscale values ​​of all pixels in each level and divide it by the number of pixels. For example, the total grayscale value of level 120 is 301000 and the number of pixels is 2500. The grayscale mean is calculated as 301000 divided by 2500, which is 120.4; the total grayscale value of level 121 is 304920 and the number of pixels is 2520. The grayscale mean is calculated as 304920 divided by 2520, which is 121.0. After calculating the grayscale mean, the grayscale mean of the two adjacent brightness levels is calculated by subtracting the grayscale mean of level 120, 120.4, from the grayscale mean of level 121, to obtain a difference of 0.6. The difference between the number of pixel distributions of the two levels is calculated, that is, 2520 minus 2500 to obtain 20 pixel difference values. The above-mentioned grayscale mean difference of 0.6 and the pixel distribution difference of 20 are used to perform transition intensity identification. That is, if the grayscale mean difference is between 0.5 and 1.5, and the pixel distribution difference is between 10 and 30, the transition intensity is determined to be medium. In this way, the transition intensity between all levels is identified, and the difference sequence is further analyzed. The numerical direction analysis of the grayscale mean difference sequence of adjacent levels is performed. For example, the difference values ​​from brightness level 120 to 125 are 0.6, 0.7, 0.5, 0.4, and 0.8, respectively, that is, each difference value is positive and shows an upward trend. The above-mentioned segment with a positive jump trend, that is, the brightness level 120 to 125 segment, is extracted to complete the jump trend segment identification of all brightness levels, and finally generate the grayscale jump trend information.

[0076] S103: sorting the number values ​​of each brightness level according to the grayscale transition trend information and the transition direction, extracting the connection sequence between the brightness levels, identifying the path correspondence between the brightness levels, and obtaining the brightness adjustment parameter;

[0077] According to the grayscale level jump trend information, for the identified jump segment, such as the level 120 to 125 segment, the number values ​​120, 121, 122, 123, 124, and 125 of all brightness levels in the segment are extracted and sorted in the order of the jump trend direction. Since the difference trend in the segment is a positive growth trend, the number values ​​are sorted as 120, 121, 122, 123, 124, and 125. At the same time, the sorted level number values ​​are called to establish a connection sequence relationship between levels, that is, level 120 is connected to level 121, level 121 is connected to level 122, and so on to level 125. The connection relationship of the brightness levels in all segments is identified. Assuming that the difference values ​​of numbers 150, 149, and 148 in another segment are negative, the level connection sequence is 150 to 149 and then to 148. The detailed establishment and recording of the brightness level connection sequence in all jump segments is completed, the complete path relationship between the levels is clarified, and the brightness adjustment parameters are finally obtained.

[0078] See also Figure 3 , call the brightness adjustment parameter, adjust the image brightness and divide it into multiple grids, extract the change gradient and fluctuation amplitude of the pixel grayscale in each grid, analyze the uniformity of the grayscale gradient in each grid, detect and eliminate non-character areas based on the grayscale change trend and gradient amplitude, and obtain the character candidate areas in the following steps:

[0079] S201: Calling brightness adjustment parameters to adjust the brightness value of each pixel in the image, and dividing the image into multiple grid areas to obtain grid division results;

[0080] Call the brightness adjustment parameters, and perform the brightness adjustment operation on each pixel according to the connection order relationship of each brightness level recorded in the brightness adjustment parameters, that is, perform level matching on the current grayscale value of each pixel, determine the original brightness level of the current pixel, and then calculate the adjusted target brightness level of the current pixel according to the path connection order specified in the adjustment parameters. For example, if the brightness level of a pixel in the original image is 120, its next level may be 122 according to the connection path of the adjustment parameters, then perform the brightness level update operation to adjust the brightness value of the pixel from the original level 120 to level 122, and then according to the grayscale corresponding value mapping relationship, for example, level 120 maps the original grayscale value to 120, and level 122 maps the target grayscale value to 124, then the image The original grayscale value 120 is updated to the target grayscale value 124. In this way, the brightness adjustment of each pixel in the image is completed. After the adjustment is completed, according to the image size and the predetermined division specifications, for example, for an image with a size of 512×512 pixels, 32 grid intervals are set in the horizontal and vertical coordinate directions for division, that is, a vertical division is performed every 16 pixels along the horizontal axis, and a horizontal division is performed every 16 pixels along the vertical axis. The size of each grid is 16×16 pixels, thereby dividing the image into a total of 1024 independent grids. Each grid is recorded in sequence from the upper left corner to the lower right corner. For example, the first grid in the upper left corner is numbered 1, and the number is increased in sequence to complete the division and numbering of all grid areas of the image, and finally obtain the grid division result.

[0081] S202: Based on the grid division result, extract the grayscale value of each pixel in the grid, identify the direction of grayscale change in each grid, and extract the average fluctuation amplitude of the grayscale change gradient to obtain the grid grayscale fluctuation index value;

[0082] Based on the above grid division results, all pixels in each grid unit are scanned one by one. For example, a grid area numbered 1 is selected, and the grayscale values ​​of a total of 256 pixels in the area are all extracted and recorded. Then, the grayscale change trend in the grid is directionally identified row by row and column by column. For example, along the horizontal axis of the grid area, the grayscale values ​​of the pixels in the first row are read sequentially. For example, the grayscale values ​​of the 16 pixels in the first row are 120, 121, 121, 122, 123, 122, 121, 122, 123, 124, 125, 125, 124, 123, 122, and 121. The grayscale values ​​of adjacent pixels are calculated in sequence. For example, the grayscale difference between the first pixel and the second pixel is 121-120=1. The grayscale difference sequence of all adjacent pixels is obtained by analogy, and the positive values ​​in the difference sequence are counted. , negative values ​​and zero values. For example, in the above sequence, the number of positive difference values ​​is 8, the number of negative values ​​is 5, and the number of zero values ​​is 2. Then, the statistical results of the pixel difference sequence of each row in the entire grid are summarized to determine the overall grayscale change direction. For example, when the number of positive values ​​accounts for more than 60% of the total number of differences, the overall grayscale change direction of the grid is defined as a positive trend. After that, the absolute values ​​of all differences in the grid are statistically calculated to obtain the average fluctuation amplitude. The calculation formula is the sum of the absolute values ​​of all differences in the grid divided by the number of differences. For example, the sum of the absolute values ​​of all grayscale differences in the above grid is 75, and the total number of differences is 240. The average fluctuation amplitude is 75÷240≈0.3125. The grayscale change trend identification and average fluctuation amplitude calculation of all 1024 grids are completed in sequence, and the grid grayscale fluctuation index value is finally obtained.

[0083] S203: According to the grid grayscale fluctuation index value, the grayscale change trend and the gradient amplitude, the non-character area in the image is identified and eliminated to obtain the character candidate area;

[0084] According to the above-mentioned grid grayscale fluctuation index value, a grayscale fluctuation index threshold is defined for each grid area. For example, the fluctuation index threshold is set to 0.25. If the grid grayscale fluctuation index value is greater than the threshold, it is marked as a possible character area; if it is less than or equal to the threshold, it is marked as a non-character area. For example, the grayscale fluctuation index value of grid number 1 is 0.3125. Since 0.3125 is greater than the set threshold value 0.25, it is marked as a character candidate area. The grayscale fluctuation index value of grid number 5 is 0.20. Since 0.20 is less than the threshold value 0.25, the grid area numbered 5 is determined to be a non-character area and eliminated. The above-mentioned judgment process is performed on all grids one by one, and the grids that meet the grayscale fluctuation index threshold conditions are marked as character candidate areas and the grid numbers are recorded. For example, the grids numbered 1, 2, 4, 6, etc. meet the conditions. The spatial positions and numbers of the above-mentioned grid areas are summarized, and the identification and screening of all grid areas are completed to finally obtain character candidate areas.

[0085] See also Figure 4 Based on the character candidate area, the region boundary is identified and the coordinate position of each contour point on the boundary is extracted. The slope of the coordinates of adjacent boundary points is extracted. By analyzing the changing trend of the continuous slope value, the character adhesion intersection point is identified. The structural conflict is detected according to the angle between adjacent boundary lines. The specific steps for obtaining the coordinates of the conflict position are as follows:

[0086] S301: Based on the character candidate regions, extract the pixel contour line of each candidate region boundary, collect the horizontal and vertical coordinate values ​​of consecutive pixel points on the contour line, and obtain the contour boundary coordinate set;

[0087] Based on the character candidate area, first select a character candidate area, such as the character candidate area with grid number 3, extract the position coordinates of all pixels in the candidate area, and compare the grayscale value difference of each pixel with its neighboring pixels in the eight directions one by one. When the grayscale difference is greater than the set boundary grayscale difference threshold, the current pixel is marked as a boundary contour point. The boundary grayscale difference threshold is set to 15. For example, the grayscale value of the current pixel is 120, and the grayscale values ​​of the pixels in the adjacent eight directions are 102, 130, 122, 110, 118, 121, 100, and 105 respectively. The absolute difference is calculated with the center point to obtain 18 , 10, 2, 10, 2, 1, 20, 15, of which 3 directions (102, 100, 105) are greater than the set grayscale difference threshold of 15, so the current pixel is marked as a boundary contour point, and all pixels in the area are scanned one by one to perform the above operation to obtain the initial boundary contour point set. Then, the horizontal and vertical coordinate values ​​of all pixels in the initial contour point set are spatially sorted, and the polar coordinate conversion operation is performed based on the center of the area. The polar distance and polar angle size of each contour point relative to the center are calculated. For example, the polar distance of the contour point with coordinates (25, 30) relative to the area center (20, 20) is √[(25-20) 2 +(30-20) 2 ]≈11.18, the polar angle is arctan[(30-20) / (25-20)]≈63.43°. After performing the above calculation, all contour points are sorted by polar angle, adjacent contour points are connected to form a continuous boundary contour line, and the horizontal and vertical coordinates of all pixel points on the connected contour line are recorded to obtain the contour boundary coordinate set.

[0088] S302: Calculate the slope between each pair of adjacent boundary point coordinates based on the contour boundary coordinate set and record the sequential distribution, detect slope abnormal areas and identify intersection points of character adhesion, and obtain slope change trend interval values;

[0089] According to the above-mentioned contour boundary coordinate set, the slope calculation operation is performed on the consecutive adjacent pixel points in the boundary coordinate set one by one. For example, the coordinates of the two adjacent contour points on the current boundary line are A(10,15) and B(11,18), and the slope is calculated by dividing the vertical coordinate difference by the horizontal coordinate difference, that is, k=(18-15) / (11-10)=3. The slope is calculated for each pair of adjacent pixel points on the boundary line in turn to obtain a slope sequence and record its sequential distribution. Then, the difference detection is performed on the slope sequence. For example, the five consecutive slope values ​​on the current contour line are 1.5, 1.6, 1.7, 5.8, and 1.6, and the differences between the adjacent slopes are calculated one by one to obtain the difference values ​​of 0.1, 0.0, and 0.1, respectively. .1, 4.1, -4.2, and compare the calculated difference sequence with the preset slope anomaly threshold of 2.0. If the absolute value of the difference is greater than the anomaly threshold, the slope segment is marked as an abnormal slope area. The difference values ​​of 4.1 and -4.2 in the above sequence are both greater than the anomaly threshold of 2.0, so the segment between the 3rd and 4th slopes is marked as a slope anomaly area, and the corresponding boundary contour point (for example, the corresponding coordinate here is point B (11, 18)) is marked as a character adhesion intersection point. The above detection process of all slope sequences on the boundary line is completed, and the start and end positions of all detected abnormal slope areas and the corresponding character adhesion intersection points are recorded to obtain the slope change trend interval value.

[0090] S303: Calculate the angle between adjacent boundary lines based on the slope change trend interval value and the intersection point coordinates, detect structural conflicts, and obtain the conflict position coordinates;

[0091] According to the above slope change trend interval value, the coordinate position of the marked character adhesion intersection point is called, and a certain distance is extended to the adjacent front and rear contour points of the intersection point. For example, the coordinate positions of the five front and rear contour points are taken for straight line fitting operation. The coordinates of the five front points are (9,13), (10,14), (11,15), (12,16), and (13,17). The coordinates of the five rear points are (11,19), (12,20), (13,21), (14,22), and (15,23). The least squares method is used to perform straight line fitting calculations on the front and rear point sets respectively to obtain the slopes k1 and k2 of the two fitting lines. For example, the slope of the front line is k1=1.0, and the slope of the rear line is k2=1.2. Then the slope conversion angle formula is used to calculate the angle, and the above k1 and k2 values ​​are substituted. Calculate the angle θ = arctan(|(1.2-1.0) / (1+1.2×1.0)|) = arctan(0.2 / 2.2)≈5.19°. Compare the calculated angle with the set angle structural conflict threshold of 10°. If the angle is less than or equal to the set threshold, it is determined that there is no structural conflict in the area. If the angle is greater than the set threshold, it is marked as a structural conflict area. In the current example, the calculated angle of 5.19° is less than the threshold of 10°, so the intersection point is determined to not constitute a structural conflict area. Perform the above calculation process on all intersection points one by one. If the calculated angle value at a certain intersection point exceeds the set threshold, the coordinates of the intersection point are recorded as a structural conflict area. Finally, after performing the above process on all intersection points on the boundary line, the coordinates of all intersection points that meet the conflict threshold are summarized to obtain the coordinate values ​​of the conflict positions.

[0092] See also Figure 5 Based on the conflict position coordinates, the character recognition boundary is segmented, the characters in the image are recognized, the degree of closure of the character contour and the continuity of the strokes are analyzed, the stability of the character structure is calculated and the credibility of the character recognition results is adjusted. The specific steps of outputting the character recognition information are as follows:

[0093] S401: Locating the boundary intersection of the character adhesion area based on the conflict position coordinate values, segmenting the character recognition boundary, and performing character recognition to obtain a character image recognition result;

[0094] Based on the coordinate value of the conflict position, for example, in the detection of the image character area, if the intersection point coordinate is detected to be (45,30), then with the coordinate position as the center, it is extended in the horizontal direction and vertical direction by 5 units of the set pixel distance respectively, and the boundaries of the rectangular area centered on (45,30) are determined to be the upper left corner (40,25) and the lower right corner (50,35). The coordinate values ​​of all the boundary contour points in the area are extracted, and the Euclidean distance between each boundary contour point and the intersection point center (45,30) is calculated. The distance calculation method is distance d = √[(x-45) 2+(y-30) 2 ], for example, the Euclidean distance of the boundary contour point (41,26) is √[(41-45) 2 +(26-30) 2 ]=5.66, sort the boundary contour points according to the calculated distance and filter out the points within 3 pixels of the set segmentation distance threshold. For example, the contour point (44,32) with a distance calculation of 2.5 meets the requirements, and the point is marked as the segmentation point position. Connect all marked segmentation points and delete the pixel data in the area inside the connecting line. For example, the pixel data inside the straight line connected by points (44,32) and (45,29) is deleted. The same operation is performed on all character adhesion areas respectively, and recognition is performed on each independent area after segmentation. According to the pixel grayscale distribution characteristics and the standard The character grayscale template is matched and calculated, and the absolute value of the difference between the pixel grayscale values ​​in the segmented character image and the pixel grayscale values ​​at the corresponding position of the standard character template is summed up. The calculation formula is: ΔG = Σ|G_standard(i,j)-G_target(i,j)|, where (i,j) is the pixel position. For example, the ΔG value calculated in the target character area is 180. It is compared with the character recognition threshold of 200. If the ΔG value is less than the threshold of 200, the character recognition is successful, and the character recognition result is recorded as "A". After executing the character recognition calculation for all areas, the character image recognition result is obtained.

[0095] S402: Extracting the coordinates of the starting and ending points of the contour corresponding to each character based on the character image recognition result, analyzing the degree of closure of the character contour, extracting the number of connections and breakpoints of each character stroke, and obtaining the character structure feature parameter value;

[0096] According to the above character image recognition results, for example, taking the character area where the character "A" is recognized as an example, the coordinates of all contour points in the character area are extracted, and the coordinates of the starting point and the ending point are identified by sorting the polar coordinates. The starting point is set to the point with the smallest polar angle, such as (12,5), and the ending point is set to the point with the largest polar angle, such as (18,9). The straight-line Euclidean distance between the starting point and the ending point is calculated as: Lstraight = √[(18-12) 2 +(9-5) 2]=7.21, calculate the sum of the Euclidean distances between all consecutive points of the character area boundary contour, and obtain the contour perimeter L wheel. For example, the distances between the consecutive contour points (12,5)-(13,5)-(14,6)-(15,7)-(16,8)-(17,9)-(18,9) are 1.00, 1.41, 1.41, 1.41, 1.00, respectively, and the contour perimeter L wheel is 7.64. The ratio calculation is R closed = L straight / L wheel = 7.21 / 7.64 = 0.94. Compare the ratio R closed with the character contour closure threshold of 0.9. If R closed is greater than the threshold, it is judged that the character wheel The degree of contour closure is good, and the degree of contour closure is recorded as high. According to the grayscale connected area analysis, the number of stroke connections is identified, and the pixel grayscale continuity detection operation is performed. For example, the pixel continuity break position coordinate (14,6) is detected, and the break position is recorded as the stroke breakpoint. Continuity detection is performed on all stroke areas of the character area one by one and recorded, and the number of all break positions is counted. For example, after detection, the number of stroke connections is recorded as 4 and the number of breakpoints is recorded as 1, and recorded as the structural information of the character. The analysis process is performed on all character areas one by one, and the contour closure degree and the number of stroke connections and breakpoints corresponding to each character are recorded, so as to obtain the character structure feature parameter value.

[0097] S403: Calling the character structure feature parameter value, calculating the stability score of each character structure according to the closedness of the character outline and the coherence of the strokes, and adjusting the recognition confidence level of the corresponding character to generate character recognition information;

[0098] The specific formula for calculating the stability score of each character structure is:

[0099]

[0100] Calculate the character structure stability score;

[0101] Among them, S i is the structural stability score of the i-th character, C i is the closed degree of the i-th character contour, is the average value of the closedness of all character contours, σ C is the standard deviation of the closedness of all character contours, L ij is the actual connected length of the jth stroke in the i-th character, M i is the median value of the connected length of the strokes in the i-th character, n i is the number of broken strokes in the i-th character, W i is the boundary confidence factor of the image region where the i-th character is located, i is the character index in the image, and j is the stroke segment index within the i-th character.

[0102] formula:

[0103]

[0104] Detailed explanation of the formula and the process of formula calculation and derivation:

[0105] The formula comprehensively evaluates the reliability of character morphology from three dimensions: contour closure anomalies, risk of stroke breakage, and imaging quality. If there are obvious gaps in the character contour, many broken strokes, or blurred boundaries, the score will increase, indicating that the reliability of the recognition result needs to be lowered. The formula is used to calculate the structural stability score of each character, which is used to measure the degree of standardization of the character contour and stroke structure. The resulting score is used to adjust the confidence of subsequent character recognition results.

[0106] Parameter meaning and setting value:

[0107] C i is the contour closure of the i-th character, which refers to the completeness of the closed loop formed by the edge path of the character, and the set value is 85.3;

[0108] is the average contour closure of all characters in the current image, and the set value is 91.5;

[0109] σ C is the standard deviation of the closedness of all character contours in the current image, and is set to 4.2;

[0110] L ij is the connected length of the jth stroke segment in the i-th character, which represents the maximum length of a line connecting consecutive pixels in the horizontal or vertical direction. Assume that the fifth character has three broken stroke segments with connected lengths of 12, 9, and 15 pixels respectively;

[0111] M i is the median length of the strokes of the i-th character, and is set to 12;

[0112] n i is the number of stroke segments in the i-th character, set to 3;

[0113] W i is the boundary confidence factor of the image region where the i-th character is located, reflecting the structural clarity of the region where the current character is located in the overall image, and the set value is 0.92;

[0114] Substitute the parameters into the formula for calculation:

[0115]

[0116] The structural stability score is used to determine the stability of a character's morphology. Higher scores indicate problems such as incomplete contour closure (such as gaps or deformations), broken strokes (such as ink smearing or image noise), or blurred boundaries (such as low-contrast areas), leading to a risk of misidentification. Lower scores indicate a complete character contour, coherent strokes, and clear boundaries, indicating a high degree of recognition confidence. The result of 1.51156 indicates that the structural stability score for the fifth character has been effectively quantified and is used to adjust the character's recognition confidence level. This revised confidence level is then used for subsequent text output optimization decisions.

[0117] See also Figure 6 Based on the character recognition information, the sentence is divided into multiple semantic segments according to the character order, punctuation, spaces, and structural pauses. Semantic segments with order conflicts are detected through semantic analysis, and semantic breakpoints are extracted. Combined with the credibility of the character recognition results, the degree of fit of each sentence template to the current character combination structure is evaluated. The character recognition results are corrected and the recognition information correction record is output. The specific steps are as follows:

[0118] S501: Based on the character recognition information, according to the position order of each character in the image, combined with the position of punctuation marks, the width of the space between characters, and the pause marker character, the sentence is divided into multiple semantic segments to obtain semantic segment division information;

[0119] Based on character recognition information, for example, for a recognized image, the recognized text is "The weather is sunny, suitable for traveling", the position information of each character is extracted, the character position coordinate value is called, and the horizontal position coordinate difference between each adjacent character is calculated. If the difference is greater than the character spacing threshold set to 5 pixels, the position is recorded as the space width area, and the punctuation mark coordinates are called at the same time. For example, the position of the character "," is (120,20), and the left and right characters of the punctuation mark are numbered in sequence, and the record number is 5. The pause mark character recognition standard is called to judge the position of each punctuation mark, space, and pause character in the image text one by one, and the boundary position of the semantic segment is determined by the coordinate difference and number sorting. For example, the coordinate difference between the left and right sides of the character "," exceeds If the threshold is 5 pixels and the number is 5, then the position is identified as the boundary of the semantic segment, and the text is divided into two semantic segments based on this segmentation point. The first segment is "the weather is clear" and the second segment is "suitable for travel". The above-mentioned character position information extraction and difference comparison operations are performed on all character sequences. According to the character spacing threshold, punctuation position and pause mark character, segment boundary recognition is performed on each sentence one by one, and the entire text is divided into several independent semantic segments in turn, such as "a year's plan lies in spring", "a year's plan lies in summer", "a year's plan lies in autumn", etc. After processing all the text information through the above operations, all the semantic segment division results are recorded in turn, and finally marked in the form of starting position character number and ending position character number to obtain semantic segment division information.

[0120] S502: Based on the semantic segment division information, character sorting analysis is performed on the character combinations in each semantic segment to detect segments and paragraphs with abnormal logical order and incoherent part-of-speech combinations, and semantic breakpoints are extracted to obtain semantic conflict break information.

[0121] Divide the information according to semantic segments. For example, take "A year's plan starts with spring" as a semantic segment, call the recognition results and position information of each character in this segment, and according to the semantic sequence standard, call the numbers of adjacent characters in the semantic segment one by one to compare the character sorting order. For example, judge the order of "one" numbered 1, "year" numbered 2, "of" numbered 3, etc., record that the order is normal, and then call the word nature of the characters. For example, "one" is a numeral classifier, "year" is a noun, "of" is a particle, and "plan" is a noun. According to the standard rules of word nature coherence, call the combination coherence coefficient between adjacent word natures. For example, the combination coherence coefficient between a noun and a particle is set to 0.9, and the combination coherence coefficient between a particle and a noun is set to 0.95. Call the coherence coefficients of adjacent character word natures one by one, and calculate the average value of the coherence coefficients of all adjacent character word natures in the segment. For example, calculate the average coefficient = (0.9 + 0.95 + 0.92 + 0.94) / 4 = 0.9275, and then compare this coefficient with the semantic logic order abnormal threshold of 0.85. If the coefficient is greater than the threshold, it is judged that the logical order of this segment is normal and there is no semantic break; if the coefficient is lower than 0.85, it is recognized that the logical order is abnormal, record the segment position as the semantic break point. For example, for the segment "A year's of lies in plan spring", recalculate the average coherence coefficient of adjacent character word natures to be 0.80, which is less than the threshold of 0.85, then mark that the logical order of this segment is abnormal, determine that the semantic break point position is the character "plan", and record the segment number and the broken character number. Perform sorting analysis and word nature coherence judgment on all semantic segments in turn according to the above steps, and record each recognized semantic break point one by one, and finally obtain all the semantic conflict break information.

[0122] S503: Call the semantic conflict break information, combine the appearance frequency, word order specification degree and character recognition credibility of each character sequence in the sentence pattern template, evaluate the fitting degree of each sentence pattern template to the current character combination structure, and correct the character recognition result to obtain the recognition information correction record;

[0123] The specific formula for evaluating the fitting degree of each sentence pattern template to the current character combination structure is:

[0124]

[0125] Calculate the sentence pattern fitting deviation value;

[0126] Among them, F k is the fitting deviation value of the kth sentence pattern template, n k is the total number of characters in the kth sentence pattern template, m is the index variable of the character sequence in the current template, R km is the character confidence score of the mth character in the kth sentence pattern template in the recognition result, T km is the standard confidence score of the mth character in the kth sentence pattern template, Sk is the number of semantic breakpoints detected in the k-th sentence template, Q k is the word order normalization coefficient of the k-th sentence template, K is the total number of candidate sentence templates, and k is the serial index of the candidate sentence template.

[0127] formula:

[0128]

[0129] Detailed explanation of the formula and the process of formula calculation and derivation:

[0130] The formula evaluates the compatibility of the template and the recognized text from three levels: character matching accuracy, semantic logical coherence, and word order standardization. If there are serious character mismatches, many semantic breakpoints, or chaotic word order, the deviation value increases, indicating that the template is not suitable. The formula is used to calculate the fitting deviation value between each sentence template and the current character combination structure. The result is used to evaluate the matching ability of the candidate sentence template in terms of semantic structure, character confidence, and order standardization.

[0131] Parameter meaning and setting value:

[0132] n k is the number of matched characters in the k-th sentence template, set to 5;

[0133] R km is the confidence score of the mth character in the current character recognition result, and the set values ​​are 0.86, 0.90, 0.83, 0.88, and 0.85 respectively;

[0134] T km is the standard confidence score of the corresponding position character in the k-th sentence template, and the set values ​​are 0.90, 0.88, 0.85, 0.90, and 0.86 respectively;

[0135] S k The number of semantic breakpoints in the current sentence is set to 3;

[0136] The total number of semantic breakpoints in all sentence templates is set to 12;

[0137] Q k is the word order standardization coefficient of the k-th sentence template, and its set value is 0.94;

[0138] Substitute the parameters into the formula for calculation:

[0139]

[0140] F k =0.022×0.75×0.94=0.01551;

[0141] Among them, the fitting deviation value is used to screen the optimal sentence pattern template. The lower the deviation value, the higher the morphological coincidence between the recognized characters and the template standard characters, the more coherent the semantic logic, and the more conforming the word order to the specification, indicating the best template adaptability; the higher the deviation value, the more prominent the problems such as character mis-matching (such as recognizing "未" as "末"), semantic jump (such as illogical word order), or grammar error (such as missing auxiliary words), etc., and this template needs to be excluded. The result 0.01551 indicates that the k-th sentence pattern template has a relatively small overall deviation in the character recognition result, which represents that this template has a high matching degree in the combination with similar confidence, continuous structure, and regular word order. This value is used to sort the candidate templates and output the structure with the highest confidence priority for correcting the recognition result.

[0142] Please refer to Figure 7 , an OCR recognition system for low-quality images. The OCR recognition system for low-quality images is used to execute the above OCR recognition method for low-quality images. The system includes:

[0143] The brightness adjustment module extracts the brightness value of each pixel in the image, conducts brightness level division, and statistically calculates the pixel distribution density and gray-scale fluctuation amplitude within each level, evaluates the trend of gray-scale change and jump intensity between adjacent brightness levels, constructs the adjustment path relationship between brightness levels, and generates brightness adjustment parameters;

[0144] The region elimination module adjusts the brightness of the image based on the brightness adjustment parameters, divides the corrected image into multiple grid regions, calculates the gradient direction and fluctuation amplitude of pixel gray-scale change within the grid, and identifies and eliminates non-character regions according to the gray-scale change trend and gradient amplitude to obtain character candidate regions;

[0145] The boundary detection module extracts the coordinate positions of the boundary contour points of each region based on the character candidate regions, calculates the slope values between consecutive contour points on the boundary, and identifies the junction regions of character adhesion according to the change trend in the slope sequence, and detects the structural conflict regions using the included angle between adjacent boundary line segments to obtain the conflict position coordinates;

[0146] The character evaluation module divides the character recognition boundary based on the conflict position coordinates, recognizes each divided character, measures the spatial distance between the starting and ending points of each character contour line and normalizes the contour perimeter calculation, analyzes the continuity of the connection between internal strokes of the character, calculates the stability of the character structure, adjusts the recognition credibility, and generates character recognition information;

[0147] The semantic correction module is based on character recognition information. It divides the recognition results into multiple semantic segments according to the character arrangement order and punctuation, spaces, and pause marks. It detects the positions of segments with semantic sorting conflicts, extracts semantic breakpoints in the sorting conflict segments, and combines the character recognition credibility to evaluate the degree of fit of each sentence template to the current character combination structure. It corrects the character recognition results and establishes a recognition information correction record.

[0148] The above embodiments can be implemented in whole or in part through software, hardware (such as circuits), firmware, or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired method (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains a collection of one or more available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, or magnetic tape), an optical medium (such as a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.

[0149] It should be understood that the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. A and B can be singular or plural. Furthermore, the character " / " as used herein generally indicates an "or" relationship between the associated objects, but it may also indicate an "and / or" relationship. For specific understanding, please refer to the context.

[0150] In this disclosure, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, "at least one of a, b, or c" can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.

[0151] It should be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0152] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0153] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0154] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interface, indirect coupling or communication connection of the device or unit, which can be electrical, mechanical or other forms.

[0155] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0156] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0157] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0158] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A method for OCR recognition of low-quality images, characterized in that: The method comprises: S1: Extract the brightness value of each pixel in the image, calculate the pixel distribution density and grayscale fluctuation amplitude of each brightness level, analyze the transition trend and transition intensity between adjacent brightness levels, construct the adjustment path relationship between brightness levels, and obtain the brightness adjustment parameters; S2: Calling the brightness adjustment parameter, adjusting the image brightness and dividing it into multiple grids, extracting the change gradient and fluctuation amplitude of the pixel grayscale in each grid, analyzing the uniformity of the grayscale gradient in each grid, detecting and eliminating non-character areas based on the grayscale change trend and gradient amplitude, and obtaining character candidate areas; S3: Based on the character candidate region, identify the region boundary and extract the coordinate position of each contour point on the boundary, extract the slope of the coordinates of adjacent boundary points, identify the character adhesion intersection points by analyzing the changing trend of continuous slope values, detect structural conflicts based on the angle between adjacent boundary lines, and obtain the coordinates of the conflict position; S4: Based on the conflict position coordinates, segment the character recognition boundary, recognize the characters in the image, analyze the degree of closure of the character outline and the continuity of the strokes, calculate the stability of the character structure and adjust the credibility of the character recognition results, and output character recognition information.

2. The OCR recognition method for low-quality images according to claim 1, characterized in that: The brightness adjustment parameters include a brightness level mapping table, a pixel distribution density matrix, and a grayscale transition intensity value; the character candidate area includes a valid character grid number, a character grid grayscale distribution map, and a non-character area removal mark; the conflict position coordinates include a boundary continuity interruption point position, a character adhesion intersection point coordinates, and a structural conflict slope angle value; the character recognition information includes a character boundary closure index, a stroke continuity coefficient, and a character structure credibility level.

3. The OCR recognition method for low-quality images according to claim 1, characterized in that: The steps to extract the brightness value of each pixel in the image, calculate the pixel distribution density and grayscale fluctuation amplitude of each brightness level, analyze the transition trend and transition intensity between adjacent brightness levels, and construct the adjustment path relationship between brightness levels to obtain the brightness adjustment parameters are as follows: S101: extracting the brightness value of each pixel in the image, extracting the number of pixels and the grayscale value distribution range at each brightness level according to the brightness level of each pixel, calculating the pixel density and grayscale fluctuation amplitude within each brightness level, and generating brightness level density statistics; S102: Based on the brightness level density statistics, extract the grayscale mean and pixel distribution difference between adjacent brightness levels, identify the transition intensity, perform direction identification on the difference sequence and extract the jump segment, identify the transition trend, and generate grayscale jump trend information; S103: sorting the number value of each brightness level according to the grayscale jump trend information and the jump direction sequence, extracting the connection sequence between the brightness levels, identifying the path correspondence between the brightness levels, and obtaining the brightness adjustment parameter.

4. The OCR recognition method for low-quality images according to claim 3, characterized in that: The steps of calling the brightness adjustment parameter, adjusting the image brightness and dividing it into multiple grids, extracting the change gradient and fluctuation amplitude of the pixel grayscale in each grid, analyzing the uniformity of the grayscale gradient in each grid, detecting and eliminating non-character areas based on the grayscale change trend and gradient amplitude, and obtaining character candidate areas are as follows: S201: calling the brightness adjustment parameter to adjust the brightness value of each pixel in the image, and dividing the image into multiple grid areas to obtain a grid division result; S202: Based on the grid division result, extract the grayscale value of each pixel in the grid, identify the direction of grayscale change in each grid, and extract the average fluctuation amplitude of the grayscale change gradient to obtain the grid grayscale fluctuation index value; S203: According to the grid grayscale fluctuation index value, according to the grayscale change trend and gradient amplitude, identify and eliminate non-character areas in the image to obtain character candidate areas.

5. The OCR recognition method for low-quality images according to claim 4, characterized in that: Based on the character candidate area, the area boundary is identified and the coordinate position of each contour point of the boundary is extracted. The slope of the coordinates of adjacent boundary points is extracted. By analyzing the changing trend of the continuous slope value, the character adhesion intersection point is identified. The structural conflict is detected based on the angle between adjacent boundary lines. The steps of obtaining the coordinates of the conflict position are specifically as follows: S301: Based on the character candidate area, extract the pixel contour line of the boundary of each candidate area, collect the horizontal and vertical coordinate values ​​of consecutive pixel points on the contour line, and obtain a contour boundary coordinate set; S302: Calculate the slope between each pair of adjacent boundary point coordinates based on the outline boundary coordinate set and record the sequential distribution, detect slope abnormal areas and identify intersection points of character adhesion, and obtain slope change trend interval values; S303: Calculate the angle between adjacent boundary lines based on the slope change trend interval value and the intersection point coordinates, detect structural conflicts, and obtain conflict position coordinate values.

6. The OCR recognition method for low-quality images according to claim 5, characterized in that: Based on the conflicting position coordinates, the character recognition boundary is segmented, the characters in the image are recognized, the degree of closure of the character outline and the continuity of the strokes are analyzed, the stability of the character structure is calculated and the credibility of the character recognition result is adjusted, and the steps of outputting the character recognition information are specifically as follows: S401: Based on the conflict position coordinate values, locate the boundary intersection point of the character adhesion area, segment the character recognition boundary, perform character recognition, and obtain a character image recognition result; S402: extracting the coordinates of the starting and ending points of the contour corresponding to each character based on the character image recognition result, analyzing the degree of closure of the character contour, extracting the number of connections and breakpoints of each character stroke, and obtaining a character structure feature parameter value; S403: calling the character structure feature parameter value, calculating the stability score value of each character structure according to the closure degree of the character outline and the stroke continuity, and adjusting the recognition confidence level of the corresponding character to generate character recognition information.

7. The OCR recognition method for low-quality images according to claim 6, characterized in that: The specific formula for calculating the stability score of each character structure is: Calculate the character structure stability score; Among them, S i is the structural stability score of the i-th character, C i is the closed degree of the i-th character contour, is the average value of all character contour closures, σ C is the standard deviation of all character contour closures, L ij is the actual connected length of the jth stroke in the i-th character, M i is the median value of the connected length of the strokes in the i-th character, n i is the number of broken strokes in the i-th character, W i is the boundary confidence factor of the image region where the i-th character is located, i is the character index in the image, and j is the stroke segment index within the i-th character.

8. The OCR recognition method for low-quality images according to claim 1, characterized in that: The method further comprises: S5: Based on the character recognition information, the sentence is divided into multiple semantic segments according to the character order, punctuation marks, spaces, and structural pauses. Semantic segments with order conflicts are detected through semantic analysis, and semantic breakpoints are extracted. In combination with the credibility of the character recognition results, the degree of fit of each sentence template to the current character combination structure is evaluated, the character recognition results are corrected, and a recognition information correction record is output; The recognition information correction record includes a semantic breakpoint index, a sentence template matching score, and a character combination structure adjustment path.

9. The OCR recognition method for low-quality images according to claim 8, characterized in that: Based on the character recognition information, the sentence is divided into multiple semantic segments according to the character order, punctuation marks, spaces, and structural pauses. Semantic segments with order conflicts are detected through semantic analysis, and semantic breakpoints are extracted. In combination with the credibility of the character recognition results, the degree of fit of each sentence template to the current character combination structure is evaluated, and the character recognition results are corrected. The steps of outputting the recognition information correction record are specifically as follows: S501: Based on the character recognition information, according to the position order of each character in the image, combined with the position of punctuation marks, the width of the space between characters, and the pause marker character, the sentence is divided into multiple semantic segments to obtain semantic segment division information; S502: performing character sorting analysis on the character combinations in each semantic segment based on the semantic segment division information, detecting segments and paragraphs with abnormal logical order and incoherent part-of-speech combinations, extracting semantic breakpoints, and obtaining semantic conflict break information; S503: Invoking the semantic conflict and rupture information, combining the frequency of occurrence of each character sequence in the sentence template, the degree of word order standardization, and the character recognition reliability, evaluating the degree of fit of each sentence template to the current character combination structure, and correcting the character recognition results to obtain a recognition information correction record; The specific formula for evaluating the degree of fit of each sentence template to the current character combination structure is: Calculate the sentence fitting deviation value; Among them, F k is the fitting deviation value of the k-th sentence template, n k is the total number of characters in the k-th sentence template, m is the index variable of the character sequence in the current template, R km is the character confidence score of the mth character in the kth sentence template in the recognition result, T km is the standard confidence score of the mth character in the kth sentence template, S k is the number of semantic breakpoints detected in the k-th sentence template, Q k is the word order normalization coefficient of the k-th sentence template, K is the total number of candidate sentence templates, and k is the serial index of the candidate sentence template.

10. An OCR recognition system for low-quality images, characterized in that: The system is used to implement the OCR recognition method for low-quality images according to any one of claims 1 to 9, and the system includes: The brightness control module extracts the brightness value of each pixel in the image, divides the brightness levels, and calculates the pixel distribution density and grayscale fluctuation amplitude within each level. It also evaluates the grayscale change trend and jump intensity between adjacent brightness levels, constructs the adjustment path relationship between brightness levels, and generates brightness adjustment parameters. The region elimination module adjusts the brightness of the image based on the brightness adjustment parameter, divides the corrected image into multiple grid regions, calculates the gradient direction and fluctuation amplitude of the grayscale change of pixels in the grid, identifies and eliminates non-character regions based on the grayscale change trend and gradient amplitude, and obtains character candidate regions; The boundary detection module extracts the coordinate positions of the boundary contour points of each region based on the character candidate region, calculates the slope values ​​between consecutive contour points on the boundary, and identifies the intersection area of ​​character adhesion based on the change trend in the slope sequence. It uses the angle between adjacent boundary line segments to detect the structural conflict area and obtain the coordinates of the conflict position; The character evaluation module segments the character recognition boundary based on the conflict position coordinates, recognizes each segmented character, measures the spatial distance between the starting and ending points of each character contour line and performs normalized calculation on the contour perimeter, analyzes the continuity of the connection between the strokes within the character, calculates the stability of the character structure, adjusts the recognition reliability, and generates character recognition information; The semantic correction module divides the recognition results into multiple semantic segments based on the character recognition information and according to the character arrangement order and punctuation, space, and pause marks, detects the segment positions of semantic sorting conflicts, extracts semantic breakpoints in the sorting conflict segments, and evaluates the degree of fit of each sentence template to the current character combination structure in combination with the character recognition credibility, corrects the character recognition results, and establishes a recognition information correction record.

Citation Information

Cited By

  • OCR (Optical Character Recognition) image recognition method and system based on large model self-learning

    CN121459369A