A text recognition method and system based on language technology

Through fractal dimension screening, brightness gradient map structure and topological invariant removal of abnormal areas based on language technology, combined with adhesion detection and elastic separation, the problem of anti-counterfeiting pattern interference in bank notes is solved, and high-precision text recognition is achieved.

CN120126153BActive Publication Date: 2025-07-22BANK OF SHANGHAI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510604376.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-12
Publication Date
2025-07-22
Estimated Expiration
2045-05-12

AI Technical Summary

Technical Problem

The prior art is difficult to accurately segment and identify handwritten amount numbers in bank notes, and at the same time eliminate interference from anti-counterfeiting patterns, resulting in a decrease in recognition accuracy.

Method used

Using a language technology-based method, character recognition is achieved through fractal dimension screening, brightness gradient construction graph structure, topological invariant removal of abnormal areas, adhesion detection and elastic separation, combined with the OCR engine.

Benefits of technology

It realizes accurate text segmentation and recognition in anti-counterfeiting watermarks, miniature text and crease interference scenarios, improves recognition accuracy, avoids anti-counterfeiting pattern interference, and is adapted to multiple types of bills.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120126153B_ABST
    Figure CN120126153B_ABST
Patent Text Reader

Abstract

The present invention provides a character recognition method and system based on language technology, which relates to the field of financial bill recognition. The method includes: obtaining a bank bill image, dividing the bank bill image into grids, and screening according to the fractal dimension of each grid area to obtain a first character candidate area; taking the pixels of the first character candidate area as nodes and calculating topological invariants to eliminate abnormal areas according to the topological invariants to obtain a second character candidate area; generating a topographic map by brightness mapping according to the fractal dimension of the second character candidate area and performing dynamic segmentation path planning on the topographic map to obtain a third character candidate area; performing adhesion detection on the third character candidate area and elastically separating the adhesion points to obtain a target character area. The present invention can accurately distinguish adhesive characters, solve the problem of adhesion of microtext; and can retain the stroke continuity while separating the adhesive area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial bill recognition, and particularly to a text recognition method and system based on language technology. Background Art

[0002] Bank bills are the core vouchers in financial transactions, including but not limited to checks, drafts, promissory notes, etc., and are mainly used for payment, settlement or transfer of rights. Bills themselves have the following characteristics:

[0003] High security: Anti-counterfeiting technologies such as anti-counterfeiting watermarks, micro-printed texts, and security threads are used to prevent forgery.

[0004] Information density: It contains key fields such as amount, date, payee, etc., and some fields use micro-printed texts (such as tiny characters of check amounts).

[0005] Physical complexity: It is vulnerable to interference such as creases, stains, fading, etc., resulting in blurred or deformed handwritten or printed content.

[0006] Currently, for the text recognition of bank bills, text recognition technology (Optical Character Recognition, OCR) is usually used to convert the text information in the bill image into editable and retrievable text data. However, in scenarios such as non-uniform illumination, complex background interference, image blurring or low resolution, the accuracy of character segmentation and feature extraction of traditional OCR methods significantly decreases. The anti-counterfeiting patterns of bills (such as background patterns, micro-printed texts) are easily misjudged as valid characters, resulting in background noise contaminating the recognition results. Moreover, the fonts and strokes of handwritten contents such as signatures and annotations are significantly different from those of printed numbers / letters, and traditional OCR methods are prone to failure.

[0007] Therefore, in bank bills containing anti-counterfeiting watermarks, micro-printed texts, and crease interference, how to accurately segment and recognize overlapping, deformed, and low-contrast handwritten amount numbers while excluding the interference of anti-counterfeiting patterns is an urgent problem to be solved and optimized in financial bill recognition. Summary of the Invention

[0008] The technical problem to be solved by the present invention is to provide a text recognition method and system based on language technology to solve the problem of accurately segmenting and recognizing handwritten amount numbers in bank bills containing anti-counterfeiting watermarks, micro-printed texts, and crease interference while excluding the interference of anti-counterfeiting patterns.

[0009] To solve the above technical problem, the technical solution of the present invention is as follows:

[0010] In a first aspect, a text recognition method based on language technology, the method includes:

[0011] Obtain a bank bill image, divide the bank bill image into grids, and screen according to the fractal dimension of each grid area to obtain the first text candidate area;

[0012] Take the pixels of the first text candidate area as nodes, construct a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculate the topological invariant to eliminate abnormal areas according to the topological invariant to obtain the second text candidate area;

[0013] Generate a topographic map by performing brightness mapping according to the fractal dimension of the second text candidate area, and perform dynamic segmentation path planning on the topographic map to obtain the third text candidate area;

[0014] Perform adhesion detection on the third text candidate area, and elastically separate the adhesion areas to obtain the target text area;

[0015] Perform character recognition on the target text area according to language technology, and convert the character recognition result into a standardized text format.

[0016] Further, obtain a bill image, divide the bill image into grids, and screen according to the fractal dimension of each grid area to obtain the first text candidate area, including:

[0017] Convert the bank bill image into a grayscale image using the weighted average method, and divide the grayscale image into grids;

[0018] Gradually reduce the sub-region size for each grid, count the number of the smallest boxes covering the stroke pixels, and calculate the fractal dimension of each grid;

[0019] Calculate the mean and standard deviation of the fractal dimensions of all grids to determine the fractal dimension threshold;

[0020] Screen the fractal dimension of each grid according to the fractal dimension threshold, mark the grids that meet the screening conditions as 1, and the rest as 0 to obtain the first text candidate area.

[0021] Further, take the pixels of the first text candidate area as nodes, construct a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculate the topological invariant to eliminate abnormal areas according to the topological invariant to obtain the second text candidate area, including:

[0022] Regard each pixel of the first text candidate area as a graph node, only connect the 4-neighborhood pixels of up, down, left, and right, take the gradient amplitude as the edge weight between adjacent pixels to obtain the graph structure, and use the adjacency matrix to store the weight relationship between nodes and edges;

[0023] Count the number of connected areas in the graph structure through breadth-first search to obtain the number of connected components;

[0024] Detect closed loops in the graph structure through the matrix tree theorem to obtain the number of circular structures;

[0025] Retain the regions with the number of connected components being 1 and the number of circular structures being 0 to obtain the second text candidate regions.

[0026] Furthermore, map the fractal dimension of each second text candidate region to a brightness value and generate a grayscale matrix, where each pixel value corresponds to a brightness value;

[0027] Construct a pheromone concentration matrix based on the grayscale matrix, set a brightness threshold, assign a brightness level to each region, and initialize the pheromone concentration matrix according to the brightness level to obtain an initialized pheromone matrix;

[0028] Update the pheromone of the initialized pheromone matrix according to the brightness gradient, move along the pheromone gradient, and generate a preliminary segmentation path;

[0029] Calculate the path energy and update the preliminary segmentation path according to the path energy to obtain the target segmentation path;

[0030] Convert to a binary mask according to the target segmentation path to obtain the third text candidate region.

[0031] Furthermore, update the pheromone of the initialized pheromone matrix according to the brightness gradient, move along the pheromone gradient, and generate a preliminary segmentation path, including:

[0032] Calculate the dynamic evaporation factor and the dynamic diffusion factor, and obtain the updated pheromone matrix according to the dynamic evaporation factor and the dynamic diffusion factor;

[0033] Calculate the brightness gradient direction of each pixel, move along the gradient direction, and if moving into a low-brightness region, perform backtracking and re-plan the path to an adjacent high-brightness region; among them, when moving along the gradient direction, the step size is positively correlated with the pheromone concentration.

[0034] Furthermore, perform adhesion detection on the third text candidate region and elastically separate the adhesion points to obtain the target text region, including:

[0035] Use 8-neighborhood connectivity analysis on the third text candidate region to label all connected regions. If the similarity of the boundary pixels of two adjacent connected regions is less than the similarity threshold, it is determined as adhesion to obtain an adhesion region marking matrix, and the adhesion pixel positions are marked as 1;

[0036] Calculate the repulsive force magnitude of the adhesion pixel pairs and calculate the attractive force for non-adhesion pixel pairs within the same grid. Among them, the repulsive force magnitude is inversely proportional to the pixel distance, and the attractive force magnitude is inversely proportional to the pixel distance;

[0037] For each adhesive pixel, calculate the vector sum of the repulsive force and the attractive force, and adjust the pixel position according to the vector sum. If the pixel moves beyond the image boundary, pull it back inside the boundary;

[0038] If the energy change of the adhesive region is less than the threshold after 5 consecutive iterations, or the maximum number of iterations is reached, stop the iteration to obtain the separated mask;

[0039] Perform an opening operation on the separated mask and conduct a connectivity verification. If the regional connectivity is insufficient, re-combine adjacent high-brightness regions to obtain the target text region mask.

[0040] Furthermore, perform character recognition on the target text region according to language technology, and convert the character recognition result into a standardized text format, including:

[0041] Apply a morphological closing operation to the target text region mask, extract the brightness gradient features of the text region, and divide the text region into independent characters;

[0042] Input the segmented characters into the OCR engine, binarize the character images, and adjust the character size to the standard size to obtain a preliminary recognized character sequence;

[0043] Load a predefined format template according to the bill type, replace similar characters in the OCR recognition with the standard form, add thousand-separator symbols according to the format template, and unify the letter case;

[0044] Verify whether the text conforms to the format rules through regular expression matching, classify and store the text by fields, and generate a standardized text format.

[0045] In a second aspect, a text recognition system based on language technology includes:

[0046] An acquisition module for acquiring a bank bill image, dividing the bank bill image into grids, and screening according to the fractal dimension of each grid region to obtain a first text candidate region;

[0047] A generation module for using the pixels of the first text candidate region as nodes, constructing a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculating topological invariants to eliminate abnormal regions according to the topological invariants to obtain a second text candidate region;

[0048] A calculation module for generating a topographic map by brightness mapping according to the fractal dimension of the second text candidate region, and performing dynamic segmentation path planning on the topographic map to obtain a third text candidate region;

[0049] An encryption module for performing adhesion detection on the third text candidate region and elastically separating the adhesion points to obtain the target text region;

[0050] A transmission module, configured to perform character recognition on a target text area according to language technology and convert the character recognition result into a standardized text format.

[0051] In a third aspect, a computing device includes:

[0052] One or more processors;

[0053] A storage system for storing one or more programs, which when executed by the one or more processors cause the one or more processors to implement the above method.

[0054] In a fourth aspect, a computer-readable storage medium stores a program that, when executed by a processor, implements the above method.

[0055] The above solution of the present invention has at least the following beneficial effects:

[0056] In the above solution of the present invention, by screening text candidate regions using the fractal dimension and constructing a graph structure in combination with the brightness gradient, adhesive characters can be accurately distinguished, and the problem of adhesive microtext can be solved; and while separating the adhesive regions, the stroke continuity can be retained, avoiding over-segmentation caused by the morphological watershed algorithm; the high-brightness interference regions of anti-counterfeiting watermarks can be avoided, realizing semantic-level separation of anti-counterfeiting patterns and text; the brightness threshold can be dynamically adjusted according to the type of bill to adapt to multiple types of bills, and the problem of insufficient text recognition accuracy in complex scenarios such as anti-counterfeiting watermarks, creases, and low contrast can be solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 is a schematic flowchart of a text recognition method based on language technology provided by an embodiment of the present invention.

[0058] Figure 2 is a schematic diagram of a text recognition system based on language technology provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0059] Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be completely conveyed to those skilled in the art.

[0060] As Figure 1 shown, an embodiment of the present invention provides a text recognition method based on language technology, and the method includes:

[0061] Step 1: Obtain a bank bill image, divide the bank bill image into grids, and filter according to the fractal dimension of each grid area to obtain the first text candidate area;

[0062] Step 2: Use the pixels of the first text candidate area as nodes, construct a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculate the topological invariant to eliminate abnormal areas according to the topological invariant to obtain the second text candidate area;

[0063] Step 3: Generate a topographic map through brightness mapping according to the fractal dimension of the second text candidate area, and perform dynamic segmentation path planning on the topographic map to obtain the third text candidate area;

[0064] Step 4: Perform adhesion detection on the third text candidate area, and elastically separate the adhesion points to obtain the target text area;

[0065] Step 5: Perform character recognition on the target text area according to language technology, and convert the character recognition result into a standardized text format.

[0066] In the text recognition method based on language technology described in the embodiments of the present invention, the image is decomposed into local areas through grid division. Combining with fractal dimension screening can quickly locate the candidate text area, reduce background interference, and the fractal dimension is sensitive to complex textures, which can effectively distinguish text from anti-counterfeiting watermarks, wrinkles and other low-complexity noise areas; through topological invariants, abnormal structures such as isolated points and broken areas can be identified, non-text interferences (such as stains and creases) can be eliminated, and highly connected text areas can be retained; the topographic map generated by the fractal dimension reflects the regional complexity, and then dynamic path planning can preferentially cover high-complexity areas (such as dense text areas), improving the segmentation accuracy, and the fractal topographic map has tolerance to uneven illumination and perspective distortion, which is applicable to complex bank bills; through adhesion detection and elastic separation, the stroke adhesion area (such as the connected stroke of "1" and "2") can be separated, and independent characters can be retained, and complex adhesions can be processed without manual intervention; furthermore, through language technology, the character recognition result can be converted into a standardized text format for storage.

[0067] In another optional embodiment of the present invention, the above step 1, obtaining a bill image, dividing the bill image into grids, and filtering according to the fractal dimension of each grid area to obtain the first text candidate area, includes:

[0068] Step 11: Convert the bank bill image into a grayscale image using the weighted average method, and divide the grayscale image into grids;

[0069] Step 12: Gradually reduce the size of the sub-region for each grid, count the minimum number of boxes covering the stroke pixels, and calculate the fractal dimension of each grid;

[0070] Step 13: Calculate the mean and standard deviation of the fractal dimensions of all grids, and determine the fractal dimension threshold.

[0071] Step 14: Screen the fractal dimension of each grid according to the fractal dimension threshold, mark the grids that meet the screening conditions as 1, and the rest as 0 to obtain the first text candidate region.

[0072] In this embodiment, in Step 11, after the banknote image is converted into a grayscale image, Gaussian filtering (kernel size 3×3) needs to be applied to eliminate noise, and then the number of grids can be adjusted according to the complexity of the bill. For example, for an image of 1024×768, 128×96 grids are obtained after division.

[0073] In Step 12, through the formula , calculate the fractal dimension D of each grid, where is the reduced pixel, is the minimum number of boxes covering the stroke pixels. Preferably, pixels.

[0074] In Step 14, the fractal dimension threshold can be set to a fixed value by experience. Since the complexity of banknotes for different bank operations is different, in this embodiment, it is preferably determined according to the mean and standard deviation of the fractal dimensions of all current grids, so as to mark the grids with fractal dimensions less than the fractal dimension threshold as text candidates, denoted as 1, to obtain the first text candidate region.

[0075] In the text recognition method based on language technology described in the embodiment of the present invention, since the text area in banknotes usually has dense and regular strokes and a low fractal dimension; the anti-counterfeiting patterns (such as microtext) are randomly distributed and have a high fractal dimension; therefore, retaining the region with a low fractal dimension as a text candidate and removing the high-dimensional region can preliminarily screen the text region in the bill. And in Step 11, the Sobel operator can be used to detect the edges of the image, calculate the gradient intensity of each pixel point, and refine the edges through non-maximum suppression to remove messy texture noise and suppress the refined edges.

[0076] In another optional embodiment of the present invention, in Step 2 above, taking the pixels of the first text candidate region as nodes, constructing a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculating the topological invariant to remove the abnormal region according to the topological invariant to obtain the second text candidate region, including:

[0077] Step 21: Consider each pixel in the first text candidate region as a graph node, only connect the 4-neighborhood pixels of up, down, left, and right, take the gradient amplitude as the edge weight between adjacent pixels to obtain a graph structure, and use the adjacency matrix to store the weight relationship between nodes and edges;

[0078] Step 22, statistically analyze the number of connected regions in the graph structure through breadth-first search to obtain the number of connected components.

[0079] Step 23, detect closed loops in the graph structure through the matrix tree theorem to obtain the number of loop structures.

[0080] Step 24, retain the regions where the number of connected components is 1 and the number of loop structures is 0 to obtain the second text candidate regions.

[0081] In this embodiment, normal handwritten amounts should be single connected regions. If they are split into multiple isolated parts, they may be noise or anti-counterfeiting patterns. Normal text regions should have no closed loops. If there are closed loops, it indicates the existence of adhesion or redundant links, and they are marked as abnormal regions for removal. Further, when removing abnormal regions, morphological closing (first dilating and then eroding with a kernel size of 3×3) can be used to merge slightly adhered strokes, and then morphological opening (first eroding and then dilating with a kernel size of 5×5) can be used to remove isolated noise (such as paper creases), so as to retain the regions that are not marked as abnormal and have been morphologically optimized, which are the second text candidate regions.

[0082] In the text recognition method based on language technology described in the embodiments of the present invention, by constructing the pixels of the text candidate regions into a 4-neighborhood connected graph structure, using the gradient magnitude as the edge weight, and storing the node relationship with an adjacency matrix, the efficient modeling of text region features is realized. By quickly statistically analyzing the number of connected components through breadth-first search and accurately detecting the closed loop structure in combination with the matrix tree theorem, an abnormal region removal mechanism based on topological invariants is formed. Moreover, the graph structure simplifies the adjacency relationship of complex textures (only retaining the 4-neighborhood of up, down, left, and right), the gradient weight strengthens the edge information representation ability, and the breadth-first search ensures the linear time complexity of connectivity analysis, so that pure text regions without adhesion and isolated loops can be screened out. While retaining the continuity of text strokes, it can effectively remove the loop interference of anti-counterfeiting watermarks (such as the closed structure of "VOID") and isolated points of background noise, and significantly improve the extraction accuracy of text candidate regions for high-density printed bills (such as invoice details) compared with traditional morphological methods.

[0083] In another alternative embodiment of the present invention, in step 3 above, generating a topographic map through brightness mapping according to the fractal dimension of the second text candidate regions and performing dynamic segmentation path planning on the topographic map to obtain the third text candidate regions, including:

[0084] Step 31, map the fractal dimension of each second text candidate region to a brightness value and generate a grayscale matrix, where each pixel value corresponds to a brightness value.

[0085] Step 32: Construct a pheromone concentration matrix based on the grayscale matrix, set a brightness threshold, assign a brightness level to each region, and initialize the pheromone concentration matrix according to the brightness level to obtain an initialized pheromone matrix;

[0086] Step 33: Update the pheromone of the initialized pheromone matrix according to the brightness gradient, move along the pheromone gradient, and generate a preliminary segmentation path;

[0087] Step 34: Calculate the path energy, and update the preliminary segmentation path according to the path energy to obtain the target segmentation path;

[0088] Step 35: Convert according to the target segmentation path into a binary mask to obtain the third text candidate region.

[0089] In this embodiment, in the above step 31, when mapping the brightness value according to the fractal dimension, the higher the fractal dimension, the lower the brightness value. Furthermore, in step 32, the brightness threshold can be preset according to experience, so as to divide different brightness values into three levels: high brightness, medium brightness, and low brightness. Among them, the high-brightness region is a low-fractal-dimension region (such as the main body of the text), the medium-brightness region is a transition region where the fractal dimension is close to the brightness threshold (such as the edge of the micro text), and the low-brightness region is a high-fractal-dimension region (such as the anti-counterfeiting pattern or noise); further, different brightness levels correspond to fixed pheromone concentrations, so as to initialize the pheromone concentration matrix to obtain an initialized pheromone matrix.

[0090] In the text recognition method based on language technology described in the embodiment of the present invention, the complexity of the region is quantified by the fractal dimension, the brightness gradient guides the path to fit the text edge, and the weight of the highlighted region is enhanced by dynamically adjusting the pheromone concentration, which can significantly improve the accuracy of extracting the text region of high-density printed bills (such as invoices, contracts); the gradient update mechanism can avoid stroke breakage caused by morphological operations, and the anti-noise ability of the energy optimization is enhanced, which can effectively suppress the interference of anti-counterfeiting watermarks (such as the closed-loop structure of "VOID") and background noise adhesion. Furthermore, the generated binary mask can be directly adapted to the OCR engine to realize the full-process automation processing from the candidate region to the structured text.

[0091] In another optional embodiment of the present invention, in the above step 33, updating the pheromone of the initialized pheromone matrix according to the brightness gradient, moving along the pheromone gradient, and generating a preliminary segmentation path includes:

[0092] Step 331: Calculate the dynamic evaporation factor and the dynamic diffusion factor, and obtain the updated pheromone matrix according to the dynamic evaporation factor and the dynamic diffusion factor;

[0093] Step 332: Calculate the brightness gradient direction of each pixel, move along the gradient direction. If the movement enters a low-brightness area, perform backtracking and re-plan the path to an adjacent high-brightness area. When moving along the gradient direction, the step size is positively correlated with the pheromone concentration.

[0094] In another alternative embodiment of the present invention, step 331 includes:

[0095] Step 3311: Through the formula: , calculate the updated pheromone matrix ; where is the balance coefficient of the evaporation term, is the balance coefficient of the diffusion term, and ; is the pixel value at the position in the image, is the brightness gradient amplitude vector, and ; is the dynamic evaporation factor; is the dynamic diffusion factor;

[0096] Step 3312: Through the formula: , calculate the dynamic diffusion factor , where is the medium brightness threshold, and K is the steepness of the Sigmoid function;

[0097] Step 3313: Through the formula: , calculate the dynamic evaporation factor , where is the standard evaporation rate of the high-brightness area, is the standard evaporation rate of the low-brightness area.

[0098] In this embodiment, the above parameters are preferably is 0.9, is 0.3, is 150, K is 5, is 0.6, is 0.4. Through the above formula calculation, for the high-brightness area, is approximately equal to , the evaporation is extremely slow, the pheromone accumulates, is approximately equal to 0, and the pheromone hardly diffuses, thus forming a high-concentration pheromone area to attract path coverage; for the medium-brightness area, smoothly transitions to a medium rate, the pheromone volatilizes moderately, is approximately equal to 1, and the pheromone diffuses to the surrounding areas to connect the high / low-brightness areas, thus serving as a transition area to balance the path extension between the text and the anti-counterfeiting area; for the low-brightness area, is approximately equal to , it volatilizes extremely fast and the pheromone decays rapidly. It is approximately equal to 0, and the pheromone hardly diffuses, thereby inhibiting the pheromone concentration and preventing the path from entering the anti-counterfeiting interference area.

[0099] In this embodiment, step 332 first calculates the luminance gradient direction angle through the luminance gray matrix to obtain the area where the luminance rises fastest. Then, starting from the current pixel position, according to the gradient direction, through the formula: , the step size is calculated, where is the basic step size coefficient, is the gradient amplitude; thus, the higher the pheromone concentration, the longer the step size, covering a wider stroke; furthermore, after moving, it is necessary to check whether the pixel position is within the image boundary; if the moved pixel is in the low-luminance area, it returns to the original position along the opposite direction of the original gradient, and selects the adjacent pixel with the largest gradient amplitude (i.e., the area closest to the text edge) among the adjacent pixels, and recalculates the gradient direction; in path planning, the termination conditions include three consecutive backtracks, indicating that the path cannot be extended and reaching the maximum number of iterations.

[0100] In another optional embodiment of the present invention, in the above step 34, the path energy is calculated, and the preliminary segmentation path is updated according to the path energy to obtain the target segmentation path, including:

[0101] Step 341, through the formula: , the path energy H(P) is calculated, where P is the preliminary segmentation path, is the topological penalty weight, is the luminance penalty weight, is the pixel 's annular structure number, is the pixel 's luminance value, is the break penalty coefficient, and S(P) is the number of break points on the path P;

[0102] Step 342, summarize each preliminary segmentation path to generate a preliminary segmentation path set, calculate the path energy of each path, and fine-tune the step size of the current path to generate a new path;

[0103] Step 343, calculate the new path energy. If the new path energy is less than the current path energy, directly select the new path and update the current path; if the new path energy is not less than the current path energy, then through the formula: , calculate the selection probability, and decide whether to select the new path according to the selection probability. If the new path is selected, update the current path; where is the new path, is the current path, is the Boltzmann constant, is the temperature decay coefficient;

[0104] Step 344 is repeated to obtain the global optimal path, and the path energy is the minimum value.

[0105] In this embodiment, after calculating the selection probability, a uniformly distributed random number is generated , if the random number is greater than the selection probability, the new path is rejected and the current path is retained; otherwise, the new path is selected and the current path is updated.

[0106] In another optional embodiment of the present invention, in the above step 4, adhesion detection is performed on the third text candidate region, and the adhesion is elastically separated to obtain the target text region, including:

[0107] Step 41: Use 8-neighborhood connectivity analysis on the third text candidate region to mark all connected regions. If the similarity of the boundary pixels of two adjacent connected regions is less than the similarity threshold, it is determined as adhesion, and an adhesion region marking matrix is obtained, and the adhesion pixel positions are marked as 1;

[0108] Step 42: Calculate the repulsive force magnitude of the adhesion pixel pairs and calculate the attractive force for the non-adhesion pixel pairs within the same grid. Among them, the repulsive force magnitude is inversely proportional to the pixel distance, and the attractive force magnitude is inversely proportional to the pixel distance;

[0109] Step 43: For each adhesion pixel, calculate the vector sum of the repulsive force and the attractive force, and adjust the pixel position according to the vector sum. Among them, if the pixel moves beyond the image boundary, it is pulled back inside the boundary;

[0110] Step 44: If after 5 consecutive iterations, the energy change of the adhesion region is less than the threshold, or the maximum number of iterations is reached, stop the iteration to obtain the separated mask;

[0111] Step 45: Perform an opening operation on the separated mask and perform connectivity verification. If the region connectivity is insufficient, the adjacent high-brightness regions are re-merged to obtain the target text region mask.

[0112] In the text recognition method based on language technology described in the embodiments of the present invention, the adhesion region can be accurately identified through 8-neighborhood connectivity analysis, and the adhesion pixels can be dynamically separated by combining the repulsive force and attractive force models. High-efficiency segmentation can be achieved by using boundary constraints and iterative optimization, and the integrity of the text region can be ensured through morphological post-processing; it can prevent stroke breakage caused by pixel overflow and can adapt to scenarios where anti-counterfeiting watermarks interfere (such as the closed-loop structure of "VOID") and are adhered to the background noise.

[0113] In another alternative embodiment of the present invention, step 5, performing character recognition on the target text region according to language technology and converting the character recognition result into a standardized text format, includes:

[0114] Step 51, applying a morphological closing operation to the mask of the target text region, extracting the brightness gradient feature of the text region, and dividing the text region into independent characters;

[0115] Step 52, inputting the segmented characters into an OCR engine, binarizing the character images, and adjusting the character sizes to the standard size to obtain a preliminarily recognized character sequence;

[0116] Step 53, loading a predefined format template according to the bill type, replacing similar characters in the OCR recognition with the standard form, adding a thousands separator according to the format template, and unifying the case of letters;

[0117] Step 54, verifying whether the text conforms to the format rules through regular expression matching, classifying and storing the text by fields, and generating a standardized text format.

[0118] In the text recognition method based on language technology according to the embodiment of the present invention, independent characters are accurately segmented through morphological closing operation and gradient feature extraction, and combined with the standardized output of the OCR engine and format template, an efficient conversion from the text region to the structured text can be achieved.

[0119] As Figure 2 shown, the present application also provides a text recognition system based on language technology, and the system includes:

[0120] An acquisition module 10, configured to acquire a bank bill image, divide the bank bill image into grids, and screen according to the fractal dimension of each grid region to obtain a first text candidate region;

[0121] A generation module 20, configured to use the pixels of the first text candidate region as nodes, construct a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculate topological invariants to eliminate abnormal regions according to the topological invariants to obtain a second text candidate region;

[0122] A calculation module 30, configured to generate a topographic map through brightness mapping according to the fractal dimension of the second text candidate region, and perform dynamic segmentation path planning on the topographic map to obtain a third text candidate region;

[0123] An encryption module 40, configured to perform adhesion detection on the third text candidate region, and elastically separate the adhesion to obtain a target text region;

[0124] A transmission module 50, configured to perform character recognition on a target text area according to language technology and convert the character recognition result into a standardized text format.

[0125] It should be noted that this system corresponds to the above method, and all implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0126] An embodiment of the present invention further provides a computing device, including: a processor and a memory storing a computer program. When the computer program is run by the processor, the above-described method is executed. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0127] An embodiment of the present invention further provides a computer-readable storage medium storing instructions. When the instructions are run on a computer, the computer is caused to execute the above-described method. All implementation manners in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.

[0128] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0129] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described system, system, and unit can refer to the corresponding processes in the foregoing method embodiments and will not be described herein again.

[0130] In the embodiments provided by the present invention, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the systems or units can be in an electrical, mechanical, or other form.

[0131] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0132] In addition, in each embodiment of the present invention, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0133] If the above-mentioned function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0134] In addition, it should be noted that in the system and method of the present invention, obviously, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. And, the steps of performing the above series of processes can naturally be executed in chronological order according to the described order, but it is not necessary to execute them in chronological order. Some steps can be executed in parallel or independently of each other. For those of ordinary skill in the art, it is understandable that all or any steps or components of the method and system of the present invention can be implemented in any computing system (including processors, storage media, etc.) or in a network of computing systems in the form of hardware, firmware, software, or a combination thereof, which can be achieved by those of ordinary skill in the art using their basic programming skills after reading the description of the present invention.

[0135] Accordingly, the object of the present invention can also be achieved by running a program or a set of programs on any computing system. The computing system may be a well-known general-purpose system. Therefore, the object of the present invention can also be achieved merely by providing a program product containing program code for implementing the method or system. That is to say, such a program product also constitutes the present invention, and a storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium may be any well-known storage medium or any storage medium developed in the future. It should also be noted that in the system and method of the present invention, obviously, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. Moreover, the steps of performing the above series of processes can naturally be executed in chronological order according to the described order, but it is not necessary to execute them necessarily in chronological order. Some steps can be executed in parallel or independently of each other.

[0136] The above is the preferred embodiment of the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. A text recognition method based on language technology, characterized in that The method includes: Obtain a bank bill image, divide the bank bill image into grids, and perform screening based on the fractal dimension of each grid area to obtain a first text candidate area; wherein, performing screening based on the fractal dimension of each grid area includes: gradually reducing the sub-region size of each grid, counting the number of minimum boxes covering stroke pixels, and calculating the fractal dimension of each grid; calculating the mean and standard deviation of the fractal dimensions of all grids, determining a fractal dimension threshold; screening the fractal dimension of each grid according to the fractal dimension threshold; Use the pixels of the first text candidate area as nodes, construct a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculate topological invariants to eliminate abnormal areas according to the topological invariants to obtain a second text candidate area; Generate a topographic map by performing brightness mapping according to the fractal dimension of the second text candidate area, and perform dynamic segmentation path planning on the topographic map to obtain a third text candidate area; Perform adhesion detection on the third text candidate area, and elastically separate the adhesion to obtain a target text area; Perform character recognition on the target text area according to language technology, and convert the character recognition result into a standardized text format.

2. The text recognition method based on language technology according to claim 1, wherein Obtain a bill image, divide the bill image into grids, and perform screening based on the fractal dimension of each grid area to obtain a first text candidate area, including: Convert the bank bill image into a grayscale image using the weighted average method, and divide the grayscale image into grids.

3. The text recognition method based on language technology according to claim 2, wherein Use the pixels of the first text candidate area as nodes, construct a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculate topological invariants to eliminate abnormal areas according to the topological invariants to obtain a second text candidate area, including: Regard each pixel of the first text candidate area as a graph node, only connect the 4-neighborhood pixels of up, down, left, and right, use the gradient amplitude as the edge weight between adjacent pixels to obtain a graph structure, and use an adjacency matrix to store the weight relationship between nodes and edges; Count the number of connected regions in the graph structure through breadth-first search to obtain the number of connected components; Detect closed loops in the graph structure through the matrix tree theorem to obtain the number of circular structures; Retain the regions with the number of connected components being 1 and the number of circular structures being 0 to obtain a second text candidate area.

4. The method for text recognition based on language technology according to claim 3, wherein Map the fractal dimension of each second text candidate area to a brightness value and generate a grayscale matrix, where each pixel value corresponds to a brightness value; Construct a pheromone concentration matrix according to the grayscale matrix, set a brightness threshold, assign a brightness level to each region, and initialize the pheromone concentration matrix according to the brightness level to obtain an initialized pheromone matrix; Update the pheromone of the initialized pheromone matrix according to the brightness gradient, move along the pheromone gradient, and generate a preliminary segmentation path; Calculate the path energy, and update the preliminary segmentation path according to the path energy to obtain a target segmentation path; Convert to a binary mask according to the target segmentation path to obtain a third text candidate area.

5. The character recognition method based on language technology according to claim 4, wherein Update the pheromone of the initialized pheromone matrix according to the brightness gradient, move along the pheromone gradient, and generate a preliminary segmentation path, including: Calculate the dynamic evaporation factor and the dynamic diffusion factor, and obtain the updated pheromone matrix based on the dynamic evaporation factor and the dynamic diffusion factor; Calculate the brightness gradient direction of each pixel, move along the gradient direction. If moving into a low-brightness area, perform backtracking and re-plan the path to an adjacent high-brightness area; among them, when moving along the gradient direction, the step size is positively correlated with the pheromone concentration.

6. The text recognition method based on language technology according to claim 5, wherein, Perform adhesion detection on the third text candidate area and elastically separate the adhesion points to obtain the target text area, including: Use 8-neighborhood connectivity analysis on the third text candidate area to label all connected areas. If the similarity of the boundary pixels of two adjacent connected areas is less than the similarity threshold, it is determined as adhesion, and an adhesion area label matrix is obtained, and the adhesion pixel positions are labeled as 1; Calculate the repulsive force magnitude of the adhesion pixel pairs and calculate the attractive force for non-adhesion pixel pairs within the same grid. Among them, the repulsive force magnitude is inversely proportional to the distance between pixels, and the attractive force magnitude is inversely proportional to the distance between pixels; For each adhesion pixel, calculate the vector sum of the repulsive force and the attractive force, and adjust the pixel position according to the vector sum. Among them, if the pixel moves beyond the image boundary, pull it back inside the boundary; If after 5 consecutive iterations, the energy change of the adhesion area is less than the threshold, or the maximum number of iterations is reached, stop the iteration to obtain the separated mask; Perform an opening operation on the separated mask and perform connectivity verification. If the regional connectivity is insufficient, re-combine adjacent high-brightness areas to obtain the target text area mask.

7. The text recognition method based on language technology according to claim 6, wherein Perform character recognition on the target text area according to language technology and convert the character recognition result into a standardized text format, including: Apply a morphological closing operation to the target text area mask, extract the brightness gradient features of the text area, and divide the text area into independent characters; Input the segmented characters into the OCR engine, binarize the character images, and adjust the character size to the standard size to obtain a preliminary recognized character sequence; Load a predefined format template according to the bill type, replace similar characters in the OCR recognition with the standard form, add a thousands separator according to the format template, and unify the letter case; Verify whether the text conforms to the format rules through regular expression matching and classify and store the text by field to generate a standardized text format.

8. A text recognition system based on language technology, characterized in that Including: An acquisition module for acquiring a bank bill image, dividing the bank bill image into grids, and screening according to the fractal dimension of each grid area to obtain the first text candidate area; among them, screening according to the fractal dimension of each grid area includes: gradually reducing the sub-region size of each grid, counting the minimum number of boxes covering the stroke pixels, and calculating the fractal dimension of each grid; calculating the mean and standard deviation of the fractal dimensions of all grids, determining the fractal dimension threshold; screening the fractal dimension of each grid according to the fractal dimension threshold; A generation module for using the pixels of the first text candidate area as nodes, constructing a graph structure with the edge weight between adjacent pixels being the gradient amplitude, and calculating topological invariants to eliminate abnormal areas according to the topological invariants to obtain the second text candidate area; A calculation module, configured to generate a topographic map through brightness mapping based on the fractal dimension of the second text candidate region, and perform dynamic segmentation path planning on the topographic map to obtain a third text candidate region; An encryption module, configured to perform adhesion detection on the third text candidate region, and elastically separate the adhesion points to obtain a target text region; A transmission module, configured to perform character recognition on the target text region according to language technology, and convert the character recognition result into a standardized text format.

9. A computing device, characterized in that, Comprising: One or more processors; A storage system, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, A program is stored in the computer-readable storage medium, and when the program is executed by a processor, the method according to any one of claims 1-7 is implemented.

Citation Information

Patent Citations

  • Method for detecting surface defects of mechanical parts based on image texture and fractal dimension

    CN101710081A

  • Robot visual image segmentation method based on statistics and local fractal dimension

    CN102509274A