Intelligent government affair document identification method and system based on artificial intelligence
By adjusting the pixel window size and grayscale features, the binarization processing of government documents is optimized, which solves the problems of pseudo-characters and blurred characters caused by traditional algorithms and achieves clearer government document recognition.
Patent Information
- Application Number
- CN202511172270.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-08-21
AI Technical Summary
When the traditional Niblack algorithm is used to binarize government documents, it may cause spotty pseudo-characters in the background area or loss of details in the character area, affecting the recognition effect of government documents.
By adjusting the window size and grayscale features of the pixels, an adaptive binarization threshold is constructed to ensure that the neighborhood of each pixel contains both the background and the character area. The binarization process is optimized by combining the gradient features and the standard deviation coefficient.
It effectively avoids pseudo-characters and blurred characters in the background area, and improves the clarity and accuracy of government document recognition.
Smart Images

Figure CN120747996A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to an artificial intelligence-based intelligent recognition method and system for government affairs documents. Background Art
[0002] Government departments typically handle a large number of government documents, including official documents, reports, and application materials. These documents contain a wealth of information and play an important role in the government's daily operations, decision-making processes, and policy implementation. Therefore, to facilitate the query and long-term storage of government documents, they are usually processed through digitization. During the digitization process, document identification is required. In order to facilitate the recognition of text in document images, it is usually necessary to binarize the document images. The image binarization can usually be performed using the Niblack algorithm. When the traditional Niblack algorithm binarizes the image, the binarization threshold of each pixel is determined based on the grayscale mean and standard deviation within the window of each pixel, and each pixel is subsequently segmented based on the binarization threshold of each pixel.
[0003] If the window of a certain pixel point only contains the background area, the grayscale value of the background area may be mistakenly divided into two categories (background area or character area) by the algorithm, resulting in a large number of spotted pseudo-characters in the background area of the image in the binarization result, interfering with the recognition of government documents. If the window of a certain pixel point only contains the character area, the grayscale value of the character area may also be mistakenly divided into two categories (background area or character area) by the algorithm, resulting in the loss of details in the character area, interfering with the recognition of government documents. Summary of the Invention
[0004] In order to solve the technical problem that when the Niblack algorithm performs binarization processing, if there is only background area or character area in the pixel window, pseudo characters may be segmented out in the background area or details of the character area may be lost, the present invention provides an artificial intelligence-based intelligent recognition method and system for government documents.
[0005] In a first aspect, the present invention provides an artificial intelligence-based intelligent recognition method for government documents, which adopts the following technical solutions: The method for intelligent recognition of government documents based on artificial intelligence includes the following steps: Collect a grayscale image of a government document; obtain the maximum vertical size of the window based on the grayscale mean of each row of pixels in the grayscale image of the government document; obtain the maximum horizontal size of the window based on the grayscale mean of each column of pixels in the grayscale image of the government document; adjust the maximum vertical size and the maximum horizontal size of the window based on the grayscale characteristics and gradient characteristics of the pixels, and obtain the horizontal size and vertical size of the window for each pixel in the grayscale image of the government document; Constructing a window for each pixel based on the horizontal and vertical dimensions of the window; obtaining a standard deviation coefficient for each pixel in the grayscale image of the government document based on the difference between the grayscale mean of the window of the pixel and the grayscale mean of the government document grayscale image; and obtaining a binarization threshold for each pixel in the grayscale image of the government document based on the standard deviation coefficient; According to the binarization threshold of each pixel in the grayscale image of the government document, each pixel is segmented to obtain a binary image, and the text in the government document is recognized based on the binary image.
[0006] The innovation of the present invention lies in first determining the maximum horizontal size and the maximum vertical size of the window based on the blank area in the image, ensuring that the neighborhood range of each pixel point contains both background pixels and character pixels, avoiding the classification of background pixels into two categories, thereby generating spotty pseudo-characters, and reducing the interference of spotty pseudo-characters on the recognition of government documents; then adjusting the maximum window according to the grayscale characteristics and gradient characteristics of the pixel points, obtaining the horizontal size and vertical size of the window for each pixel point in the grayscale image of the government document, facilitating the subsequent effective retention of the edge details of the characters in the image, and avoiding character blurring caused by an excessively large window; finally, determining the standard deviation coefficient by the difference between the local grayscale distribution of the pixel points and the overall grayscale distribution of the image, further improving the clarity of the characters in the binarization result, and avoiding the phenomenon of unrecognizable characters due to unclear characters in the image.
[0007] Preferably, the maximum vertical size of the acquisition window includes: Sort the grayscale means of pixels in each row of the grayscale image of the government document in order 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 adjacent data as the first difference, and record the absolute value of the difference between the data and its right adjacent data as the second difference. If the first difference or the second difference is greater than the segmentation threshold T, use the data as the segmentation point of the first sequence; obtain each segmentation point of the first sequence; obtain the number of data between every two adjacent segmentation points in the first sequence, and use the maximum value of the number of data between all adjacent segmentation points in the first sequence as the initial vertical size of the window; obtain the maximum vertical size of the window , is the initial vertical size of the window; The symbol for rounding up.
[0008] Preferably, the maximum horizontal size of the acquisition window includes: Sort the grayscale means of pixels in each column of 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 adjacent data as the first difference, and record the absolute value of the difference between the data and its right adjacent data as the second difference. If the first difference or the second difference is greater than the segmentation threshold T, use the data as the segmentation point of the second sequence, and obtain each segmentation point of the second sequence; obtain the number of data between every two adjacent segmentation points in the second sequence, and use the maximum value of the number of data between all 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 symbol for rounding up.
[0009] Make sure that the neighborhood of each pixel contains both background pixels and character pixels.
[0010] Preferably, the step of obtaining the horizontal size and vertical size of a window for each pixel in the grayscale image of the government document includes: ; ; Where, Represents the horizontal size of the window of the i-th pixel in the grayscale image of the government document; Represents the maximum horizontal size of the window; Represents the grayscale value of the i-th pixel in the grayscale image of the government document; Represents the gradient value of the i-th pixel in the grayscale image of the government document; Represents the maximum vertical size of the window; Represents the vertical size of the window of the i-th pixel in the grayscale image of the government document; Represents the ceiling symbol.
[0011] This facilitates the subsequent effective preservation of character edge details in the image and avoids character blurring caused by an overly large window.
[0012] Preferably, obtaining the standard deviation coefficient of each pixel in the grayscale image of the government document includes: Obtain the grayscale feature sequence of each pixel window; obtain the grayscale feature sequence of the grayscale image of the government document; , where Represents the standard deviation coefficient of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the window of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the grayscale image of the government document; Represents 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.
[0013] Adaptively obtaining the standard deviation coefficient of each pixel can make the subsequent binarization threshold more accurate.
[0014] Preferably, the step of obtaining the grayscale feature sequence of the grayscale image of the government document includes: The number of pixels corresponding to each grayscale level in the grayscale image of the government document is counted, the number of pixels corresponding to each grayscale level is sorted in ascending order, and all the data in the sequence are linearly normalized to obtain the grayscale feature sequence of the grayscale image of the government document.
[0015] Preferably, 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 point is counted, and the number of pixels corresponding to each gray level in the window of each pixel point is sorted in ascending order of gray level. All data in the sequence are linearly normalized to obtain the gray feature sequence of each pixel point window.
[0016] Preferably, the step of obtaining a binarization threshold value for each pixel in the grayscale image of the government document includes: ; Where, Represents the binarization threshold of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the window of the i-th pixel in the grayscale image of the government document; Represents the standard deviation coefficient of the i-th pixel in the grayscale image of the government document; Represents the standard deviation of all pixels in the window of the i-th pixel in the grayscale image of the government document.
[0017] Preferably, the step of segmenting each pixel according to a binarization threshold of each pixel in the grayscale image of the government document to obtain a binarized image includes: If the grayscale value of any pixel in the grayscale image of the government document is greater than or equal to the binarization threshold of the pixel, the grayscale value of the pixel is marked as 1, otherwise, it is marked as 0 to obtain a binary image.
[0018] Able to accurately recognize characters in government documents.
[0019] In a second aspect, the present invention provides an artificial intelligence-based intelligent recognition system for government documents, which adopts the following technical solutions: The artificial intelligence-based government affairs document intelligent recognition system includes: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned artificial intelligence-based government affairs document intelligent recognition method is implemented.
[0020] By adopting the above technical solution, the above-mentioned artificial intelligence-based intelligent recognition method for government affairs documents is generated into a computer program and stored in a memory to be loaded and executed by a processor, thereby making a terminal device based on the memory and processor for easy use.
[0021] The present invention has the following technical effects: the present invention ensures that the neighborhood range of each pixel point contains both background pixels and character pixels by determining the maximum window size, thereby avoiding dividing the pixels in the background area into two categories, thereby generating the phenomenon of spotty pseudo-characters; then the maximum window is adjusted according to the grayscale characteristics and gradient characteristics of the pixel points, and the horizontal and vertical window sizes of each pixel point in the grayscale image of the government document are obtained, so as to facilitate the subsequent effective retention of the edge details of the characters in the image and avoid character blurring caused by the window being too large; finally, the standard deviation coefficient is determined according to the difference between the grayscale distribution in the pixel point window and the overall grayscale distribution of the image, so as to further improve the clarity of the characters in the binarization result and avoid the inability to recognize the characters in the document due to unclear characters in the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a flow chart of the method for intelligently identifying government documents based on artificial intelligence in an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, but not all of the embodiments.
[0024] The embodiment of the present invention discloses a method for intelligent identification of government documents based on artificial intelligence, referring to Figure 1 , including steps S1 to S4: S1: Collect grayscale images of government documents.
[0025] In an embodiment of the present invention, a camera is used to shoot a government document to obtain a government document image, and in order to facilitate subsequent analysis, the image is grayscaled to obtain a government document grayscale image.
[0026] S2: Based on the grayscale image of the government document, the maximum vertical size and the maximum horizontal size of the window are obtained. According to the grayscale characteristics and gradient characteristics of each pixel, the maximum vertical size and the maximum horizontal size of the window are adjusted to adaptively obtain the horizontal size and vertical size of the window for each pixel.
[0027] It should be noted that when the image is binarized according to the Niblack algorithm, if the window of a certain pixel point only contains the background area or the character area, the algorithm will divide the pixels in the background area into background pixels and character matching points, and divide the pixels in the character area into background pixels and character matching points, which may cause the background area of the image in the binarization result to produce a large number of spotted pseudo-characters and the details of the character area to be lost, interfering with the recognition of government documents. In order to avoid the above situation, the present invention needs to confirm a maximum window size to ensure that the window of each pixel point contains the background area and the character area. At this time, when the algorithm judges each pixel point, it can simultaneously consider the grayscale values of the background area and the character area in its window, reducing the possibility of the background area being mistakenly binarized into pseudo-characters.
[0028] It should be further explained that in order to include the background area and the character area in the maximum window size, the present invention first needs to analyze the width of the blank area in the top-down direction of the image (the width of the blank part in the image where there are no characters) based on the characteristics of the image to determine the maximum vertical size of the window, and then analyze 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 background area and the character area can be included in the maximum window size.
[0029] In an embodiment of the present invention, the grayscale mean of each row of pixels and the grayscale mean of each column of pixels in the grayscale image of the government document are obtained; 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 adjacent data as the first difference, and record the absolute value of the difference between the data and its right adjacent data 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 used as a segmentation point of the first sequence; similarly, obtain each segmentation point of the first sequence; in the embodiment of the present invention, the segmentation threshold T is preset to 20, and in other embodiments, the implementer may preset the value of the segmentation threshold T according to the specific implementation situation; The number of data between each two adjacent segmentation points in the first sequence is used as the distance between each two adjacent segmentation points in the first sequence, and the maximum value of the distances between all adjacent segmentation points in the first sequence is used as the initial vertical size of the window; obtain the maximum vertical size of the window ,in, Represents the initial vertical size of the window; It should be noted that blank areas in known documents generally appear at the edges of the document. Therefore, if the pixel is located on the edge of the image, the initial vertical size of the window may not be able to completely cover the background area and the character area, because the initial vertical size of the window needs to be multiplied by 2, and 1 is added to ensure that the size of the window is an odd number.
[0030] 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 adjacent data as the first difference, and the absolute value of the difference between the data and its right adjacent data 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 used as a segmentation point of the second sequence. Similarly, obtain each segmentation point of the second sequence. The number of data between each two adjacent segmentation points in the second sequence is used as the distance between each two adjacent segmentation points in the second sequence, and the maximum value of the distances between all adjacent segmentation points in the second sequence is used as the initial horizontal size of the window; obtain the maximum horizontal size of the window ,in, Represents the initial horizontal size of the window.
[0031] It should be noted that, by constructing a window for each pixel according to the maximum window size, the window of each pixel can include both the background area and the character area, thereby reducing the detection of pseudo-characters such as spots in the background area. However, the character areas in the government document images are relatively dense or there are areas with small fonts. Therefore, if any pixel is a character pixel, in order to retain the edge details of the characters in the image, the window for the character pixel needs to be reduced. If any pixel is a background pixel, the degree of adjustment of the window for the background pixel is less, and the pixel window can still include both the character area pixels and the background area pixels. Next, we need to consider the gradient characteristics of the pixels. If the gradient of the pixel is large, it means that the pixel is likely to be on the edge of the character area. In order to retain the edge details of the characters in the image, the pixel window needs to be adjusted smaller. On the contrary, the smaller the gradient of the pixel, the more likely the pixel is to be inside the character area or in the background of the image, and the degree of adjustment of the pixel window is smaller. Therefore, the maximum window size is adjusted in combination with the grayscale characteristics and gradient characteristics of each pixel, and the window size of each pixel is adaptively obtained.
[0032] In an embodiment of the present invention, the Sobel algorithm is used to obtain the gradient value of each pixel in the grayscale image of the government document; the horizontal size and vertical size of the window of the i-th pixel in the grayscale image of the government document are obtained: ; ; Where, Represents the horizontal size of the window of the i-th pixel in the grayscale image of the government document; Represents the maximum horizontal size of the window; Represents the grayscale value of the i-th pixel in the grayscale image of the government document; Represents the gradient value of the i-th pixel in the grayscale image of the government document; Represents the maximum vertical size of the window; Represents the vertical size of the window of the i-th pixel in the grayscale image of the government document; Represents the rounding symbol; 2 +1 means converting the value of x into an odd number; Since the background area in the grayscale image of government documents is usually white and has a larger grayscale value, while the character area has a lower grayscale value, The smaller the value, the more likely the i-th pixel is to belong to the character area. In this case, the horizontal and vertical sizes of the window for the i-th pixel should be reduced to avoid blurring the character details in the image. The larger the value is and the closer it is to 1, the more likely the i-th pixel is to belong to the background area. In this case, the horizontal and vertical sizes of the i-th pixel window should be reduced to a lesser extent, so that the pixel window can still contain both the character area pixels and the background area pixels, avoiding the appearance of spotty pseudo characters after segmentation due to the pixel window only containing the background area in the image. The smaller the value of , the more likely the i-th pixel is to be on the edge of the character area. 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 of , 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 size and vertical size of the window of the i-th pixel should be reduced less.
[0033] It should be noted that the window size of the pixel point cannot be too small. When the window size of the pixel point is smaller than the width of the character line, this will result in the pixel point window containing only character pixels, which will cause the character pixels in the window to be binarized into two categories (background or characters), resulting in the loss of character details in the binarization result. Therefore, in an embodiment of the present invention, if the horizontal size or vertical size of the window of the i-th pixel point in the grayscale image of the government document is less than 5, the horizontal size or vertical size of the window of the i-th pixel point can be set to 5.
[0034] S3: Construct a window for each pixel based on the horizontal size or vertical size of the window for each pixel; obtain the standard deviation coefficient of each pixel based on the difference between the grayscale mean of all pixels in the window of each pixel and the grayscale mean of all pixels in the grayscale image of the government document; obtain the binarization threshold of each pixel in the grayscale image of the government document based on the standard deviation coefficient.
[0035] It should be noted that the traditional Niblack algorithm obtains the grayscale mean and standard deviation of all pixels in the window of each pixel, and presets a fixed standard deviation coefficient, and adds the product of the standard deviation and the standard deviation coefficient plus the sum of the grayscale mean as the binarization threshold of 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 the number of background pixels and character pixels in the windows of different pixels is different, it may lead to the inability to effectively separate the character pixels and background pixels in the binarization result, affecting the recognition of characters in the government document image; For example, if there are a large number of background pixels in the window of any pixel point in the image, resulting in a large grayscale mean in the pixel point window, the standard deviation coefficient should be made negative at this time, and the grayscale mean in the pixel point window should be appropriately reduced to avoid dividing the background pixels into character pixels; if there are a large number of character pixels in the window of any pixel point in the image, resulting in a small grayscale mean in the pixel point window, the standard deviation coefficient should be made positive at this time, and the grayscale mean in the pixel point window should be appropriately increased to avoid dividing the character pixels into background pixels; therefore, the present invention first constructs a window for each pixel point according to the horizontal size of the window or the vertical size of the window of each pixel point, analyzes the grayscale distribution characteristics of the window of each pixel point, and adaptively obtains the standard deviation coefficient of each pixel point, which can make the subsequently obtained binarization threshold more accurate.
[0036] In an embodiment of the present invention, the number of pixels corresponding to each grayscale level in the grayscale image of the government document is counted, the number of pixels corresponding to each grayscale level is sorted in ascending order of grayscale level, and all data in the sequence are linearly normalized to obtain a grayscale feature sequence of the grayscale image of the government document; According to the horizontal and vertical sizes of the window of each pixel in the grayscale image of the government document, a window is constructed for each pixel with each pixel as the center to obtain the window of each pixel; the number of pixels corresponding to each grayscale level in the window of each pixel is counted, and the number of pixels corresponding to each grayscale level in the window of each pixel is sorted in order from small to large grayscale levels, and all data in the sequence are linearly normalized to obtain the grayscale feature sequence of each pixel window; Get the standard deviation coefficient of each pixel in the grayscale image of the government document: ; Where, Represents the standard deviation coefficient of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the window of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the grayscale image of the government document; Represents 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; The greater 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, the more similar the grayscale distribution characteristics of the pixels in the i-th pixel window are to the image. The closer the value of is to 0, the It also approaches 0, making the binarization threshold of the i-th pixel closer to the grayscale mean value in the window of the i-th pixel; When the grayscale distribution characteristics of the pixels in the i-th pixel window deviate from the grayscale distribution characteristics of the pixels in the image, The smaller the value of The closer the value of is to 1, the more right Get the value of like When the value is greater than 0, it means that the grayscale distribution in the window of the i-th pixel point is brighter than the entire image, which means that there are fewer character pixels and more background pixels distributed in the window of the i-th pixel point. At this time, the grayscale mean in the window of the i-th pixel point is large, and the standard deviation coefficient should be made negative to reduce the binarization threshold. The value of is negative; When the value is less than 0, it means that the grayscale distribution in the window of the i-th pixel is darker than the overall image, which means that there are more character pixels and fewer background pixels in the window of the i-th pixel. At this time, the grayscale mean in the window of the i-th pixel is small, and the standard deviation coefficient should be made positive to reduce the binarization threshold. The value of is positive; When the value is equal to 0, it means that the grayscale feature of the i-th pixel window is similar to the image. At this time, the standard deviation coefficient is 0, so that the binarization threshold of the i-th pixel is the grayscale mean value in the i-th pixel window.
[0037] Get the binarization threshold for each pixel in the grayscale image of the government document: ; Where, Represents the binarization threshold of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the window of the i-th pixel in the grayscale image of the government document; Represents the standard deviation coefficient of the i-th pixel in the grayscale image of the government document; Represents the standard deviation of all pixels in the window of the i-th pixel in the grayscale image of the government document.
[0038] S4: Segment each pixel according to the binarization threshold of each pixel in the grayscale image of the government document to obtain a binarized image, and recognize the text in the government document based on the binarized image.
[0039] In an embodiment of the present invention, if the grayscale value of any pixel in the grayscale image of a government document is greater than or equal to the binarization threshold of the pixel, the grayscale value of the pixel is marked as 1, otherwise, it is marked as 0, thereby obtaining a binary image; and the text in the government document is identified based on the binarized image.
[0040] 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, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. An artificial intelligence-based intelligent recognition method for government documents, characterized by: include: Collect grayscale images of government documents; Obtain the maximum vertical size of the window based on the grayscale mean value of each row of pixels in the grayscale image of the government document; According to the grayscale mean value of each column of pixels in the grayscale image of the government document, the maximum horizontal size of the window is obtained; according to the grayscale characteristics and gradient characteristics of the pixels, the maximum vertical size and the maximum horizontal size of the window are adjusted to obtain the horizontal size and vertical size of the window for each pixel in the grayscale image of the government document; Constructing a window for each pixel based on the horizontal and vertical dimensions of the window; obtaining a standard deviation coefficient for each pixel in the grayscale image of the government document based on the difference between the grayscale mean of the window of the pixel and the grayscale mean of the government document grayscale image; and obtaining a binarization threshold for each pixel in the grayscale image of the government document based on the standard deviation coefficient; According to the binarization threshold of each pixel in the grayscale image of the government document, each pixel is segmented to obtain a binary image, and the text in the government document is recognized based on the binary image.
2. The method for intelligent identification of government documents based on artificial intelligence according to claim 1 is characterized in that: The maximum vertical size of the acquisition window includes: Sort the grayscale means of pixels in each row of the grayscale image of the government document in order 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 adjacent data as the first difference, and record the absolute value of the difference between the data and its right adjacent data as the second difference. If the first difference or the second difference is greater than the segmentation threshold T, use the data as the segmentation point of the first sequence; obtain each segmentation point of the first sequence; obtain the number of data between every two adjacent segmentation points in the first sequence, and use the maximum value of the number of data between all adjacent segmentation points in the first sequence as the initial vertical size of the window; obtain the maximum vertical size of the window , is the initial vertical size of the window; The symbol for rounding up.
3. The method for intelligent identification of government documents based on artificial intelligence according to claim 1 or 2, characterized in that: The maximum horizontal size of the acquisition window includes: Sort the grayscale means of pixels in each column of 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 adjacent data as the first difference, and record the absolute value of the difference between the data and its right adjacent data as the second difference. If the first difference or the second difference is greater than the segmentation threshold T, use the data as the segmentation point of the second sequence, and obtain each segmentation point of the second sequence; obtain the number of data between every two adjacent segmentation points in the second sequence, and use the maximum value of the number of data between all 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 symbol for rounding up.
4. The method for intelligent identification of government documents based on artificial intelligence according to claim 1 is characterized in that: The step of obtaining the horizontal size and vertical size of a window for each pixel in the grayscale image of the government document includes: ; ; Where, Represents the horizontal size of the window of the i-th pixel in the grayscale image of the government document; Represents the maximum horizontal size of the window; Represents the grayscale value of the i-th pixel in the grayscale image of the government document; Represents the gradient value of the i-th pixel in the grayscale image of the government document; Represents the maximum vertical size of the window; Represents the vertical size of the window of the i-th pixel in the grayscale image of the government document; Represents the ceiling symbol.
5. The method for intelligent identification of government documents based on artificial intelligence according to claim 1 is characterized in that: The step of obtaining the standard deviation coefficient of each pixel in the grayscale image of the government document includes: Obtain the grayscale feature sequence of each pixel window; obtain the grayscale feature sequence of the grayscale image of the government document; , where Represents the standard deviation coefficient of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the window of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the grayscale image of the government document; Represents 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.
6. The method for intelligent identification of government documents based on artificial intelligence according to claim 5 is characterized in that: The step of obtaining a grayscale feature sequence of a grayscale image of a government document includes: The number of pixels corresponding to each grayscale level in the grayscale image of the government document is counted, the number of pixels corresponding to each grayscale level is sorted in ascending order, and all the data in the sequence are linearly normalized to obtain the grayscale feature sequence of the grayscale image of the government document.
7. The method for intelligent identification of government documents based on artificial intelligence according to claim 5 is 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 point is counted, and the number of pixels corresponding to each gray level in the window of each pixel point is sorted in ascending order of gray level. All data in the sequence are linearly normalized to obtain the gray feature sequence of each pixel point window.
8. The method for intelligent identification of government documents based on artificial intelligence according to claim 1 is characterized in that: The step of obtaining a binarization threshold value for each pixel in the grayscale image of the government document includes: ; Where, Represents the binarization threshold of the i-th pixel in the grayscale image of the government document; Represents the grayscale mean of all pixels in the window of the i-th pixel in the grayscale image of the government document; Represents the standard deviation coefficient of the i-th pixel in the grayscale image of the government document; Represents the standard deviation of all pixels in the window of the i-th pixel in the grayscale image of the government document.
9. The method for intelligent identification of government documents based on artificial intelligence according to claim 1 is characterized in that: The step of segmenting each pixel according to the binarization threshold of each pixel in the grayscale image of the government document to obtain a binarized image includes: If the grayscale value of any pixel in the grayscale image of the government document is greater than or equal to the binarization threshold of the pixel, the grayscale value of the pixel is marked as 1, otherwise, it is marked as 0 to obtain a binary image.
10. The government document intelligent recognition system based on artificial intelligence is characterized by: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method for intelligent recognition of government documents based on artificial intelligence according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Self-adaption binaryzation method for document images and equipment
CN101727583A
LED lamp wick defect detection method
WO2023134792A2