AI-based intelligent recognition method and system for government documents

By adjusting the pixel window size and grayscale features, an adaptive binarization threshold is constructed, which solves the problems of background misclassification and character loss in the traditional Niblack algorithm for government document recognition, and achieves a clearer document recognition effect.

CN120747996BActive Publication Date: 2025-11-14SHAANXI RUILIAN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511172270.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-21
Publication Date
2025-11-14
Estimated Expiration
2045-08-21

AI Technical Summary

Technical Problem

When performing binarization processing on government document images, the traditional NiBlack algorithm is prone to misclassifying background areas as pseudo-characters or causing the loss of details in character areas, thus affecting the recognition effect of government documents.

Method used

By adjusting the window size and grayscale features of pixels, an adaptive binarization threshold is constructed to ensure that the neighborhood of each pixel contains both background and character pixels. The binarization process is then optimized by combining gradient features and standard deviation coefficients.

Benefits of technology

It effectively avoids the generation of pseudo-characters, preserves character edge details, and improves the recognition accuracy of government documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747996B_ABST
    Figure CN120747996B_ABST
Patent Text Reader

Abstract

This invention relates to the field of image processing technology, and more particularly to an intelligent recognition method and system for government documents based on artificial intelligence. The method includes the following steps: acquiring a grayscale image of the government document, and obtaining the maximum vertical and horizontal dimensions of the window; adjusting the maximum vertical and horizontal dimensions of the window based on the grayscale and gradient features of the pixels to obtain the horizontal and vertical dimensions of the window for each pixel, and constructing a window for each pixel; obtaining the standard deviation coefficient of each pixel based on the difference between the grayscale mean of the window and the grayscale mean of the image; obtaining a binarization threshold for each pixel in the grayscale image of the government document based on the standard deviation coefficient; segmenting each pixel according to the binarization threshold to obtain a binarized image; and recognizing the text in the government document based on the binarized image. This invention improves the accuracy of text recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method and system for intelligent recognition of government documents based on artificial intelligence. Background Technology

[0002] Government departments typically handle a large number of official documents, reports, and application materials, which contain a wealth of information and play an important role in the government's daily operations, decision-making process, and policy implementation. Therefore, in order to facilitate the retrieval of government documents and their long-term storage, they are usually processed in a digital manner. In the process of digitizing government documents, document identification is required.

[0003] To facilitate text recognition within document images, it is usually necessary to perform binarization processing on the document images. Image binarization can typically be performed using the NiBlack algorithm. When performing image binarization processing, the traditional NiBlack algorithm determines the binarization threshold of each pixel based on the mean and standard deviation of the grayscale value within the window of each pixel, and then segments each pixel based on the binarization threshold of each pixel.

[0004] If a pixel's window contains only the background region, the grayscale values ​​of the background region may be misclassified by the algorithm into two categories (background region or character region), resulting in a large number of speckled pseudo-characters in the background region of the image in the binarization result, interfering with the recognition of government documents. If a pixel's window contains only the character region, the grayscale values ​​of the character region may also be misclassified by the algorithm into two categories (background region or character region), resulting in the loss of details in the character region, interfering with the recognition of government documents. Summary of the Invention

[0005] To address the technical problem that the Niblack algorithm may result in pseudo-characters being segmented in the background area or details being lost in the character area when the pixel window only contains the background or character area during binarization, this invention provides an intelligent recognition method and system for government documents based on artificial intelligence.

[0006] In a first aspect, the present invention provides an intelligent recognition method for government documents based on artificial intelligence, employing the following technical solution:

[0007] An AI-based intelligent recognition method for government documents includes the following steps:

[0008] Acquire grayscale images of government documents; obtain the maximum vertical size of the window based on the average grayscale value of each row of pixels in the grayscale image of the government documents; obtain the maximum horizontal size of the window based on the average grayscale value of each column of pixels in the grayscale image of the government documents; adjust the maximum vertical and horizontal sizes of the window based on the grayscale and gradient features of the pixels to obtain the horizontal and vertical sizes of the window for each pixel in the grayscale image of the government documents.

[0009] A window is constructed for each pixel based on its horizontal and vertical dimensions; the standard deviation coefficient of each pixel in the grayscale image of the government document is obtained based on the difference between the mean grayscale value of the pixel's window and the mean grayscale value of the government document's grayscale image; and a binarization threshold is obtained for each pixel in the government document's grayscale image based on the standard deviation coefficient.

[0010] Based on the binarization threshold of each pixel in the grayscale image of the government document, each pixel is segmented to obtain a binarized image, and the text in the government document is identified based on the binarized image.

[0011] The innovation of this invention lies in first determining the maximum horizontal and vertical dimensions of the window based on the blank areas in the image, ensuring that the neighborhood of each pixel simultaneously contains both background and character pixels. This avoids dividing background pixels into two categories, thus preventing the generation of speckled pseudo-characters and reducing the interference of speckled pseudo-characters on the recognition of government documents. Next, the maximum window is adjusted based on the grayscale and gradient features of the pixels to obtain the horizontal and vertical dimensions of the window for each pixel in the grayscale image of the government document. This facilitates the effective preservation of character edge details in the image and avoids character blurring caused by an excessively large window. Finally, the standard deviation coefficient is determined by the difference between the local grayscale distribution of the pixels and the overall grayscale distribution of the image, further improving the clarity of characters in the binarization result and avoiding the phenomenon of unrecognizable characters due to unclear characters in the image.

[0012] Preferably, obtaining the maximum vertical size of the window includes:

[0013] Sort the grayscale mean values ​​of each row of pixels in the grayscale image of the government document from top to bottom to form a first sequence. For any data in the first sequence, record the absolute value of the difference between the data and its left neighbor as the first difference, and the absolute value of the difference between the data and its right neighbor as the second difference. If either the first difference or the second difference is greater than the segmentation threshold T, the data is used as a segmentation point of the first sequence. Obtain each segmentation point of the first sequence. Obtain the number of data points between any two adjacent segmentation points in the first sequence, and use the maximum value among all the number of data points between adjacent segmentation points in the first sequence as the initial vertical dimension of the window. Obtain the maximum vertical dimension of the window. , This is the initial vertical dimension of the window; The rounding up symbol.

[0014] Preferably, obtaining the maximum horizontal size of the window includes:

[0015] Sort the grayscale mean values ​​of each column of pixels in the grayscale image of the government document from left to right to form a second sequence. For any data in the second sequence, record the absolute value of the difference between the data and its left neighbor as the first difference, and the absolute value of the difference between the data and its right neighbor as the second difference. If either the first difference or the second difference is greater than the segmentation threshold T, the data is used as a segmentation point of the second sequence, and each segmentation point of the second sequence is obtained. Obtain the number of data between every two adjacent segmentation points in the second sequence, and use the maximum value among all the number of data between adjacent segmentation points in the second sequence as the initial horizontal size of the window. Obtain the maximum horizontal size of the window. , Represents the initial horizontal size of the window; The rounding up symbol.

[0016] Ensure that the neighborhood of each pixel contains both background pixels and character pixels.

[0017] Preferably, the step of obtaining the horizontal and vertical dimensions of the window for each pixel in the grayscale image of the government document includes:

[0018] ;

[0019] ;

[0020] In the formula, The horizontal dimension of the window representing the i-th pixel in the grayscale image of the government document; This represents the maximum horizontal size of the window; This represents the grayscale value of the i-th pixel in the grayscale image of the government document. This represents the gradient value of the i-th pixel in the grayscale image of the government document. This represents the maximum vertical dimension of the window; The vertical dimension of the window representing the i-th pixel in the grayscale image of the government document; The symbol represents rounding up.

[0021] This facilitates the effective preservation of character edge details in the image and avoids character blurring caused by an excessively large window.

[0022] Preferably, obtaining the standard deviation coefficient of each pixel in the grayscale image of the government document includes:

[0023] Obtain the grayscale feature sequence of each pixel window; obtain the grayscale feature sequence of a grayscale image of a government document;

[0024] In the formula, The annotation difference coefficient represents the i-th pixel in the grayscale image of the government document; The grayscale mean of all pixels in the window representing the i-th pixel in the grayscale image of the government document; This represents the average grayscale value of all pixels in a grayscale image of a government document. The cosine similarity between the grayscale feature sequence of the i-th pixel window and the grayscale feature sequence of the government document grayscale image.

[0025] Adaptively obtaining the standard deviation coefficient of each pixel can make the subsequent binarization threshold more accurate.

[0026] Preferably, the step of obtaining the grayscale feature sequence of the grayscale image of the government document includes:

[0027] The number of pixels corresponding to each gray level in the grayscale image of the government document is counted. The number of pixels corresponding to each gray level is sorted in ascending order of gray level. All data in the sequence is linearly normalized to obtain the grayscale feature sequence of the grayscale image of the government document.

[0028] Preferably, obtaining the grayscale feature sequence of each pixel window includes:

[0029] The number of pixels corresponding to each gray level in the window of each pixel is counted. The number of pixels corresponding to each gray level in the window of each pixel is sorted in ascending order of gray level. All data in the sequence is linearly normalized to obtain the gray-level feature sequence of each pixel window.

[0030] Preferably, obtaining the binarization threshold for each pixel in the grayscale image of the government document includes:

[0031] ;

[0032] In the formula, The binarization threshold represents the i-th pixel in the grayscale image of a government document; The grayscale mean of all pixels in the window representing the i-th pixel in the grayscale image of the government document; The annotation difference coefficient represents the i-th pixel in the grayscale image of the government document; This represents the standard deviation of all pixels in the window representing the i-th pixel in a grayscale image of a government document.

[0033] Preferably, the step of segmenting each pixel in the grayscale image of the government document to obtain a binary image based on the binarization threshold of each pixel includes:

[0034] If the gray value of any pixel in the grayscale image of a government document is greater than or equal to the binarization threshold of that pixel, then the gray value of that pixel is marked as 1; otherwise, it is marked as 0, thus obtaining a binarized image.

[0035] It can accurately identify characters in government documents.

[0036] Secondly, this invention provides an intelligent recognition system for government documents based on artificial intelligence, employing the following technical solution:

[0037] The AI-based intelligent recognition system for government documents includes a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the aforementioned AI-based intelligent recognition method for government documents.

[0038] By adopting the above technical solution, the above-mentioned AI-based intelligent recognition method for government documents is generated into a computer program and stored in a memory for loading and execution by a processor. This allows for the creation of a terminal device based on the memory and processor, making it convenient to use.

[0039] This invention has the following technical effects: By determining the maximum window size, this invention ensures that the neighborhood of each pixel simultaneously contains both background pixels and character pixels, avoiding the phenomenon of dividing background pixels into two categories and thus producing speckled pseudo-characters. Then, based on the grayscale and gradient features of the pixels, the maximum window size is adjusted to obtain the horizontal and vertical dimensions of the window for each pixel in the grayscale image of the government document. This facilitates the effective preservation of character edge details in the image and avoids character blurring caused by an excessively large window. Finally, the standard deviation coefficient is determined based on the difference between the grayscale distribution within the pixel window and the overall grayscale distribution of the image, further improving the clarity of characters in the binarization result and preventing the inability to recognize characters in the document due to unclear characters in the image. Attached Figure Description

[0040] Figure 1 This is a flowchart of the intelligent recognition method for government documents based on artificial intelligence, according to an embodiment of the present invention. Detailed Implementation

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

[0042] This invention discloses an intelligent recognition method for government documents based on artificial intelligence, referring to... Figure 1 This includes steps S1-S4:

[0043] S1: Collect grayscale images of government documents.

[0044] In this embodiment of the invention, a camera is used to capture images of government documents to obtain government document images. To facilitate subsequent analysis, these images are converted to grayscale to obtain grayscale images of government documents.

[0045] S2: Based on the grayscale image of the government document, obtain the maximum vertical and horizontal dimensions of the window. Adjust the maximum vertical and horizontal dimensions of the window according to the grayscale and gradient features of each pixel, and adaptively obtain the horizontal and vertical dimensions of the window for each pixel.

[0046] It should be noted that when performing image binarization using the Niblack algorithm, if a pixel's window contains only a background region or a character region, the algorithm will divide the pixels in the background region into background pixels and character matching points, and the pixels in the character region into background pixels and character matching points. This can lead to a large number of speckled pseudo-characters in the background region of the image in the binarization result, as well as the loss of details in the character region, interfering with the recognition of government documents. To avoid this, this invention needs to determine a maximum window size to ensure that each pixel's window contains both a background region and a character region. At this time, when the algorithm judges each pixel, it can simultaneously consider the grayscale values ​​of the background region and the character region in its window, reducing the possibility that the background region is incorrectly binarized into pseudo-characters.

[0047] It should be further explained that, in order to ensure that the maximum window size includes both the background area and the character area, the present invention first needs to analyze the width of the blank area in the top-to-bottom direction of the image (the width of the blank part in the image without characters) based on the characteristics of the image to determine the maximum vertical size of the window. Then, it analyzes the width of the blank area in the left-to-right direction of the image to obtain the maximum horizontal size of the window. In this way, it can be ensured that the maximum window size includes both the background area and the character area.

[0048] In this embodiment of the invention, the average grayscale value of each row of pixels and the average grayscale value of each column of pixels in the grayscale image of a government document are obtained.

[0049] The grayscale average values ​​of each row of pixels in the grayscale image of the government document are sorted from top to bottom to form a first sequence. For any data in the first sequence, the absolute value of the difference between the data and its left neighbor is recorded as the first difference, and the absolute value of the difference between the data and its right neighbor is recorded as the second difference. If the first difference is greater than the segmentation threshold T or the second difference is greater than the segmentation threshold T, the data in the first sequence is taken as a segmentation point of the first sequence. Similarly, each segmentation point of the first sequence is obtained. In this embodiment of the invention, the preset segmentation threshold T=20. In other embodiments, the implementer can preset the value of the segmentation threshold T according to the specific implementation situation.

[0050] The number of data points between any two adjacent segment points in the first sequence is used as the distance between any two adjacent segment points in the first sequence. The maximum value among all distances between adjacent segment points in the first sequence is used as the initial vertical dimension of the window; the maximum vertical dimension of the window is then obtained. ,in, Represents the initial vertical dimension of the window;

[0051] It should be noted that blank areas in a document generally appear at the edges of the document. Therefore, if a pixel is located on the edge of an image, the initial vertical size of the window may not be able to completely cover the background and character areas. This is because the initial vertical size of the window needs to be multiplied by 2 and added by 1 to ensure that the window size is an odd number.

[0052] Sort the grayscale average values ​​of each column of pixels in the grayscale image of the government document from left to right to form a second sequence. For any data in the second sequence, the absolute value of the difference between the data and its left neighbor is recorded as the first difference, and the absolute value of the difference between the data and its right neighbor is recorded as the second difference. If the first difference is greater than the segmentation threshold T or the second difference is greater than the segmentation threshold T, the data in the second sequence is taken as a segmentation point of the second sequence. Similarly, each segmentation point of the second sequence is obtained.

[0053] The number of data points between any two adjacent segment points in the second sequence is used as the distance between any two adjacent segment points in the second sequence. The maximum value among all distances between adjacent segment points in the second sequence is used as the initial horizontal size of the window; the maximum horizontal size of the window is then obtained. ,in, Represents the initial horizontal size of the window.

[0054] It should be noted that constructing the window for each pixel based on the maximum window size ensures that each pixel's window contains both the background and character regions, thereby reducing the detection of pseudo-characters resembling spots in the background region. However, in government document images, the character regions are relatively dense or contain areas with small font sizes. Therefore, if any pixel is a character pixel, the window for the character pixel needs to be reduced slightly in order to preserve the edge details of the characters in the image. If any pixel is a background pixel, the adjustment of the background pixel's window is smaller, still ensuring that the pixel's window contains both character region pixels and background region pixels.

[0055] Next, we need to consider the gradient features of the pixels. If the gradient of a pixel is large, it means that the pixel is likely located on the edge of the character region. In order to preserve the details of the character edge in the image, the window of the pixel needs to be reduced. Conversely, if the gradient of a pixel is small, the pixel is more likely to be inside the character region or in the background of the image, and the adjustment of the window of the pixel is less. Therefore, by combining the grayscale features and gradient features of each pixel, the maximum window size is adjusted to adaptively obtain the window size of each pixel.

[0056] In this embodiment of the invention, the Sobel algorithm is used to obtain the gradient value of each pixel in the grayscale image of the government document; the horizontal and vertical dimensions of the window at the i-th pixel in the grayscale image of the government document are obtained:

[0057] ;

[0058] ;

[0059] In the formula, The horizontal dimension of the window representing the i-th pixel in the grayscale image of the government document; This represents the maximum horizontal size of the window; This represents the grayscale value of the i-th pixel in the grayscale image of the government document. This represents the gradient value of the i-th pixel in the grayscale image of the government document. This represents the maximum vertical dimension of the window; The vertical dimension of the window representing the i-th pixel in the grayscale image of the government document; Represents the rounding up symbol; 2 +1 means converting the value of x to an odd number;

[0060] Because the background area in a grayscale image of a government document is usually white with a large grayscale value, while the character area has a low grayscale value, therefore The smaller the value, the more likely the i-th pixel is to belong to the character region. In this case, the horizontal and vertical dimensions of the window for the i-th pixel should be reduced to avoid blurring the character details in the image. The larger the value and the closer it is to 1, the more likely the i-th pixel is to belong to the background region. In this case, the horizontal and vertical dimensions of the window for the i-th pixel should be reduced to a smaller extent, so that the window of the pixel can still contain both character region pixels and background region pixels, avoiding the situation where the window of the pixel only contains the background region of the image, resulting in blotchy pseudo-characters after segmentation.

[0061] The smaller the value, the more likely the i-th pixel is to be on the edge of the character region. In order to better preserve the edge details of the characters in the image in the binarization result, the i-th pixel should use a smaller window. The larger the value, the more likely the i-th pixel is to be inside the character area or in the background of the image. In this case, the horizontal and vertical dimensions of the window for the i-th pixel should be reduced less.

[0062] It should be noted that the window size of a pixel cannot be too small. When the window size of a pixel is smaller than the width of the character line, the window of the pixel may only contain character pixels, which will cause the character pixels in the window to be binarized into two categories (background or character), resulting in the loss of character details in the binarization result. Therefore, in this embodiment of the invention, if the horizontal or vertical window size of the i-th pixel in the grayscale image of the government document is less than 5, the horizontal or vertical window size of the i-th pixel can be set to 5.

[0063] S3: Construct a window for each pixel based on the horizontal or vertical dimensions of the window for each pixel; obtain the standard deviation coefficient for each pixel based on the difference between the average grayscale value of all pixels in the window of each pixel and the average grayscale value of all pixels in the grayscale image of the government document; obtain the binarization threshold for each pixel in the grayscale image of the government document based on the standard deviation coefficient.

[0064] It should be noted that the traditional NiBlack algorithm obtains the mean and standard deviation of grayscale values ​​of all pixels within the window of each pixel, and presets a fixed standard deviation coefficient. The product of the standard deviation and the standard deviation coefficient is added to the sum of the grayscale values ​​as the binarization threshold for each pixel. Since the surrounding pixels of different pixels in the grayscale image of government documents have different grayscale distributions, that is, the ratio of background pixels to character pixels in the window of different pixels is different, it may lead to the inability to effectively separate character pixels from background pixels in the binarization result, which affects the recognition of characters in government document images.

[0065] For example, if the number of background pixels in a window of any pixel in an image is large, resulting in a large mean gray value within that window, the standard deviation coefficient should be negative to appropriately reduce the mean gray value within that window and avoid classifying background pixels as character pixels. Conversely, if the number of character pixels in a window of any pixel in an image is large, resulting in a small mean gray value within that window, the standard deviation coefficient should be positive to appropriately increase the mean gray value within that window and avoid classifying character pixels as background pixels. Therefore, this invention first constructs a window for each pixel based on its horizontal or vertical window size, analyzes the gray value distribution characteristics of each pixel's window, and adaptively obtains the standard deviation coefficient for each pixel, making the subsequent binarization threshold more accurate.

[0066] In this embodiment of the invention, the number of pixels corresponding to each gray level in the grayscale image of the government document is counted, the number of pixels corresponding to each gray level is sorted according to the order of gray level from small to large, and all data in the sequence is linearly normalized to obtain the grayscale feature sequence of the grayscale image of the government document.

[0067] Based on the horizontal and vertical dimensions of the window for each pixel in the grayscale image of the government document, and with each pixel as the center, a window is constructed for each pixel to obtain the window for each pixel; the number of pixels corresponding to each gray level in the window of each pixel is counted, and the number of pixels corresponding to each gray level in the window of each pixel is sorted in ascending order of gray level, and all data in the sequence is linearly normalized to obtain the grayscale feature sequence of the window of each pixel;

[0068] Obtain the standard deviation coefficient of each pixel in the grayscale image of the government document:

[0069] ;

[0070] In the formula, The annotation difference coefficient represents the i-th pixel in the grayscale image of the government document; The grayscale mean of all pixels in the window representing the i-th pixel in the grayscale image of the government document; This represents the average grayscale value of all pixels in a grayscale image of a government document. The cosine similarity between the grayscale feature sequence of the i-th pixel window and the grayscale feature sequence of the government document grayscale image;

[0071] The greater the cosine similarity between the gray-level feature sequence of the i-th pixel window and the gray-level feature sequence of the government document gray-level image, the more approximate the gray-level distribution features of the pixels in the i-th pixel window are with the image. The closer the value is to 0, the more it makes... It also approaches 0, making the binarization threshold of the i-th pixel closer to the average gray level within the window of the i-th pixel;

[0072] When the gray-level distribution characteristics of the pixels in the i-th pixel window deviate from the gray-level distribution characteristics of the pixels in the image... The smaller the value, the better. The closer the value is to 1, the more it needs to be determined according to... right Get the value;

[0073] like When the value is greater than 0, it indicates that the grayscale distribution in the window of the i-th pixel is brighter than the overall image, meaning that the window of the i-th pixel contains fewer character pixels and more background pixels. In this case, the mean grayscale value within the window of the i-th pixel is relatively large, and the standard deviation coefficient should be negative to reduce the binarization threshold. The value is negative;

[0074] When the value is less than 0, it indicates that the grayscale distribution in the window of the i-th pixel is darker than the overall image, meaning that the window of the i-th pixel contains more character pixels and fewer background pixels. In this case, the mean grayscale value within the window of the i-th pixel is small, and the standard deviation coefficient should be positive to reduce the binarization threshold. The value is positive;

[0075] When the value is equal to 0, it means that the grayscale features of the window of the i-th pixel are similar to those of the image. At this time, the standard deviation coefficient is 0, which makes the binarization threshold of the i-th pixel the mean grayscale value within the window of the i-th pixel.

[0076] Obtain the binarization threshold for each pixel in a grayscale image of a government document:

[0077] ;

[0078] In the formula, The binarization threshold represents the i-th pixel in the grayscale image of a government document; The grayscale mean of all pixels in the window representing the i-th pixel in the grayscale image of the government document; The annotation difference coefficient represents the i-th pixel in the grayscale image of the government document; This represents the standard deviation of all pixels in the window representing the i-th pixel in a grayscale image of a government document.

[0079] S4: Based on the binarization threshold of each pixel in the grayscale image of the government document, segment each pixel to obtain a binarized image, and recognize the text in the government document based on the binarized image.

[0080] In this embodiment of the invention, if the gray value of any pixel in the grayscale image of a government document is greater than or equal to the binarization threshold of that pixel, then the gray value of that pixel is marked as 1; otherwise, it is marked as 0, thereby obtaining a binarized image; and the text in the government document is identified based on the binarized image.

[0081] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.

Claims

1. A method for intelligent recognition of government documents based on artificial intelligence, characterized in that: include: Collect grayscale images of government documents; The maximum vertical size of the window is obtained based on the average grayscale value of each row of pixels in the grayscale image of the government document. This includes: sorting the average grayscale values ​​of each row of pixels in the grayscale image of the government document from top to bottom to form a first sequence; for any data in the first sequence, recording the absolute value of the difference between the data and its left neighbor as the first difference, and the absolute value of the difference between the data and its right neighbor as the second difference; if either the first difference or the second difference is greater than a segmentation threshold T, using the data as a segmentation point of the first sequence; obtaining each segmentation point of the first sequence; obtaining the number of data points between every two adjacent segmentation points in the first sequence, and using the maximum value among all the number of data points between adjacent segmentation points in the first sequence as the initial vertical size of the window; and obtaining the maximum vertical size of the window. , This is the initial vertical dimension of the window; The value is the floor sign; the maximum horizontal size of the window is obtained based on the average gray value of each column of pixels in the grayscale image of the government document, including: sorting the average gray values ​​of each column of pixels in the grayscale image of the government document from left to right to form a second sequence; for any data in the second sequence, the absolute value of the difference between the data and its left neighbor is recorded as the first difference, and the absolute value of the difference between the data and its right neighbor is recorded as the second difference; if the first difference or the second difference is greater than the segmentation threshold T, the data is used as the segmentation point of the second sequence, and each segmentation point of the second sequence is obtained; the number of data between every two adjacent segmentation points in the second sequence is obtained, and the maximum value among the number of data between all adjacent segmentation points in the second sequence is used as the initial horizontal size of the window; the maximum horizontal size of the window is obtained. , The initial horizontal dimension of the window is represented; based on the grayscale and gradient features of the pixels, the maximum vertical and horizontal dimensions of the window are adjusted to obtain the horizontal and vertical dimensions of the window for each pixel in the grayscale image of the government document, including: ; ; In the formula, The horizontal dimension of the window representing the i-th pixel in the grayscale image of the government document; This represents the maximum horizontal size of the window; This represents the grayscale value of the i-th pixel in the grayscale image of the government document. This represents the gradient value of the i-th pixel in the grayscale image of the government document. ; The vertical dimension of the window representing the i-th pixel in the grayscale image of the government document; A window is constructed for each pixel based on its horizontal and vertical dimensions. The standard deviation coefficient of each pixel in the grayscale image of the government document is obtained based on the difference between the mean grayscale value of the pixel's window and the mean grayscale value of the government document image. Obtain the grayscale feature sequence of each pixel window; obtain the grayscale feature sequence of a grayscale image of a government document; In the formula, The standard deviation coefficient represents the i-th pixel in the grayscale image of the government document; The grayscale mean of all pixels in the window representing the i-th pixel in the grayscale image of the government document; This represents the average grayscale value of all pixels in a grayscale image of a government document. The cosine similarity between the grayscale feature sequence of the i-th pixel window and the grayscale feature sequence of the government document grayscale image; based on the standard deviation coefficient, the binarization threshold of each pixel in the government document grayscale image is obtained; Based on the binarization threshold of each pixel in the grayscale image of the government document, each pixel is segmented to obtain a binarized image, and the text in the government document is identified based on the binarized image.

2. The intelligent recognition method for government documents based on artificial intelligence according to claim 1, characterized in that, The step of obtaining the grayscale feature sequence of the grayscale image of the government document includes: The number of pixels corresponding to each gray level in the grayscale image of the government document is counted. The number of pixels corresponding to each gray level is sorted in ascending order of gray level. All data in the sequence is linearly normalized to obtain the grayscale feature sequence of the grayscale image of the government document.

3. The intelligent recognition method for government documents based on artificial intelligence according to claim 1, characterized in that, The step of obtaining the grayscale feature sequence of each pixel window includes: The number of pixels corresponding to each gray level in the window of each pixel is counted. The number of pixels corresponding to each gray level in the window of each pixel is sorted in ascending order of gray level. All data in the sequence is linearly normalized to obtain the gray-level feature sequence of each pixel window.

4. The intelligent recognition method for government documents based on artificial intelligence according to claim 1, characterized in that, The step of obtaining the binarization threshold for each pixel in the grayscale image of a government document includes: ; In the formula, The binarization threshold represents the i-th pixel in the grayscale image of a government document; The grayscale mean of all pixels in the window representing the i-th pixel in the grayscale image of the government document; The standard deviation coefficient represents the i-th pixel in the grayscale image of the government document; This represents the standard deviation of all pixels in the window representing the i-th pixel in a grayscale image of a government document.

5. The intelligent recognition method for government documents based on artificial intelligence according to claim 1, characterized in that, The step of segmenting each pixel in the grayscale image of the government document according to the binarization threshold of each pixel to obtain a binarized image includes: If the gray value of any pixel in the grayscale image of a government document is greater than or equal to the binarization threshold of that pixel, then the gray value of that pixel is marked as 1; otherwise, it is marked as 0, thus obtaining a binarized image.

6. A government document intelligent recognition system based on artificial intelligence, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions that, when executed by the processor, implement the intelligent recognition method for government documents based on artificial intelligence according to any one of claims 1-5.

Citation Information

Patent Citations

  • Self-adaption binaryzation method for document images and equipment

    CN101727583A

  • LED lamp wick defect detection method

    WO2023134792A2