Document image binarization method, system, computer device and readable storage medium

Through the ground filter and dark field text mask technology of three-dimensional point cloud processing, the binarization problem of document images in complex lighting environments is solved, and the recognition accuracy of the OCR tool is improved.

CN116798043BActive Publication Date: 2025-10-21SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310555567.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-16
Publication Date
2025-10-21
Estimated Expiration
2043-05-16

AI Technical Summary

Technical Problem

Existing document image binarization methods are difficult to adapt to background brightness changes in complex lighting environments, resulting in a decrease in text recognition accuracy.

Method used

The ground filter in 3D point cloud processing is used to separate text and background by treating grayscale values ​​as elevation values, estimating and removing background light, and using dark field text mask to enhance text contrast and realize binarization of document images.

Benefits of technology

The OCR tool improves the document image recognition accuracy under harsh lighting conditions, adapts to widely fluctuating background brightness and extreme lighting conditions, and provides better text binarization results than traditional local threshold segmentation methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116798043B_ABST
    Figure CN116798043B_ABST
Patent Text Reader

Abstract

The application discloses a kind of document image binarization method, system, computer equipment and readable storage medium, method includes: obtaining input image and anti-color image;Based on ground filter, according to the way of regarding gray value as elevation value, the input image and the anti-color image are binarized, obtain the first binary image and the second binary image, wherein, the first binary image is as positive bottom, the second binary image is as reverse bottom;According to the positive bottom and the anti-color surface after gray value reversal, obtain dark field text mask;Based on the background brightness estimation value of the input image, deduct the background light of the input image, obtain the background light removal image;The text information of the background light removal image is enhanced using the dark field text mask, and the document image binarization result is obtained.The application can provide better text binarization result than traditional local threshold segmentation method, improve the recognition accuracy of OCR tool on document image under poor lighting conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a document image binarization method, system, computer equipment and readable storage medium, and belongs to the field of image binarization. Background Art

[0002] Document image binarization is a method for segmenting text and background in an image. It provides accurate text image input for optical character recognition (OCR), achieving higher character recognition accuracy. Document image binarization has many applications, including digital archiving of large quantities of paper documents, text content verification in online streaming media, document entry, road sign recognition in autonomous driving systems, and scanning and recognition of barcodes such as QR codes. A good document image binarization method should be able to adapt to input images degraded by environmental factors such as lighting.

[0003] Currently, classic image binarization methods can be categorized into global threshold segmentation and local threshold segmentation. Global threshold segmentation typically calculates a fixed threshold based on the grayscale values ​​of the entire image and uses this threshold to segment the image. Examples include ISODATA threshold segmentation, Otsu's algorithm, and minimum cross-entropy image segmentation. Global threshold segmentation methods use a single threshold to segment the entire image. This approach is suitable for input images with uniform background brightness, but it struggles to adapt to large background brightness variations. Local threshold segmentation typically calculates a local optimal segmentation threshold based on the neighborhood of the pixel to be classified. This can, to a certain extent, address background brightness fluctuations in the input image. Examples include the Bernsen algorithm, NiBlack algorithm, Sauvola algorithm, Wolf algorithm, Su algorithm, TRSingh algorithm, Bataineh algorithm, and ISauvola algorithm. However, local threshold segmentation algorithms prioritize information from the neighborhood of the pixel being processed and utilize less global information. Furthermore, they can still produce unsatisfactory segmentation results when there is significant grayscale variation within the pixel neighborhood. Other approaches aim to estimate and mitigate uneven background light, such as using the Retinex algorithm to model background light, homomorphic filtering to eliminate uneven background light, and using bilateral filters or image downsampling to estimate background light. However, these methods may not always be able to robustly handle varying background brightness. Other approaches utilize deep learning, such as fully convolutional networks (FCNs), U-Nets, and generative adversarial networks (GANs). However, most of these methods require appropriate training data, and in practice, they perform poorly for scenarios that are rare or absent in the dataset.

[0004] In summary, designing a document image binarization method that can adapt to complex lighting backgrounds in different situations can further improve the robustness of OCR tools to the environment, which has important practical significance for improving text recognition quality and promoting related applications. Summary of the Invention

[0005] In view of this, the present invention provides a method, system, computer device and readable storage medium for binarization of unevenly illuminated document images using a ground filter processed by three-dimensional point cloud. The method can provide better text binarization results than traditional local threshold segmentation methods and improve the recognition accuracy of OCR tools for document images under harsh lighting conditions.

[0006] The first object of the present invention is to provide a document image binarization method.

[0007] The second object of the present invention is to provide a document image binarization method.

[0008] The third object of the present invention is to provide a document image binarization method.

[0009] A fourth object of the present invention is to provide a document image binarization system.

[0010] A fifth object of the present invention is to provide a document image binarization system.

[0011] A sixth object of the present invention is to provide a document image binarization system.

[0012] A seventh object of the present invention is to provide a computer device.

[0013] An eighth object of the present invention is to provide a readable storage medium.

[0014] The first object of the present invention can be achieved by adopting the following technical solutions:

[0015] A document image binarization method, the method comprising:

[0016] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0017] Based on a ground filter, binarizing the input image and the inverted image in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0018] In the bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0019] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0020] Obtaining a dark field text mask according to the front bottom surface and the reverse bottom surface after grayscale value inversion;

[0021] deducting the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0022] The dark field text mask is used to enhance the text information of the background light removed image, thereby obtaining a document image binarization result.

[0023] In a possible embodiment, obtaining a dark field text mask based on the front bottom surface and the reverse bottom surface after grayscale value inversion includes:

[0024] Taking the union of the front bottom surface and the reverse bottom surface with inverted grayscale values ​​to obtain a union image;

[0025] Based on the union image, a dark field text mask is obtained according to a morphological processing and modification method.

[0026] In a possible embodiment, the process of obtaining the background brightness estimation value of the input image includes:

[0027] The reverse bottom surface is used as a mask to extract background pixels of the input image, and the holes left after the background pixels are extracted are filled by interpolation to obtain an estimated background brightness value of the input image.

[0028] The second object of the present invention can be achieved by adopting the following technical solutions:

[0029] A document image binarization method, the method comprising:

[0030] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0031] Based on a ground filter, the inverted image is binarized by treating grayscale values ​​as elevation values ​​to obtain a third binary image corresponding to the inverted image, wherein the third binary image serves as the inverted bottom surface;

[0032] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0033] Using the reverse bottom surface as a mask, extracting background pixels of the input image, and filling holes left by the extracted background pixels by interpolation to obtain an estimated background brightness value of the input image;

[0034] deducting the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0035] Based on the background light removed image, a document image binarization result is obtained according to a binarization algorithm.

[0036] The third object of the present invention can be achieved by adopting the following technical solutions:

[0037] A document image binarization method, the method comprising:

[0038] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0039] Based on a ground filter, binarizing the input image and the inverted image in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0040] In the front bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0041] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0042] A dark field text mask is obtained based on the front bottom surface and the reverse bottom surface after grayscale value inversion, and is directly used as a document image binarization result.

[0043] In a possible embodiment, obtaining a dark field text mask based on the front bottom surface and the reverse bottom surface after grayscale value inversion includes:

[0044] Taking the union of the front bottom surface and the reverse bottom surface with inverted grayscale values ​​to obtain a union image;

[0045] Based on the union image, a dark field text mask is obtained according to a morphological processing and modification method.

[0046] The fourth object of the present invention can be achieved by adopting the following technical solutions:

[0047] A document image binarization system, comprising:

[0048] An input unit, configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0049] a filtering unit configured to perform a binarization process on the input image and the inverted image based on a ground filter and in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0050] In the front bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0051] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0052] a merging and modifying unit, configured to obtain a dark field text mask based on the front bottom surface and the reverse bottom surface after grayscale value inversion;

[0053] a subtraction unit, configured to subtract the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0054] The enhancement and output unit is used to enhance the text information of the background light removed image using the dark field text mask, thereby obtaining a document image binarization result.

[0055] The fifth object of the present invention can be achieved by adopting the following technical solutions:

[0056] A document image binarization system, comprising:

[0057] An input unit, configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0058] a filtering unit configured to perform a binarization process on the inverted image based on a ground filter and in a manner of regarding grayscale values ​​as elevation values, to obtain a third binary image corresponding to the inverted image, wherein the third binary image serves as the inverted bottom surface;

[0059] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0060] an estimation unit, configured to extract background pixels of the input image using the reverse bottom surface as a mask, and fill holes left by the extracted background pixels by interpolation to obtain an estimated background brightness value of the input image;

[0061] a subtraction unit, configured to subtract the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0062] The output unit is configured to obtain a document image binarization result based on the background light removed image and a binarization algorithm.

[0063] The sixth object of the present invention can be achieved by adopting the following technical solutions:

[0064] A document image binarization system, comprising:

[0065] An input unit, configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0066] a filtering unit configured to perform a binarization process on the input image and the inverted image based on a ground filter and in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0067] In the bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0068] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0069] The output unit is used to obtain a dark field text mask according to the front bottom surface and the reverse bottom surface after grayscale value inversion, and directly use it as the document image binarization result.

[0070] The seventh object of the present invention can be achieved by adopting the following technical solutions:

[0071] A computer device comprises a processor and a memory for storing a program executable by the processor. When the processor executes the program stored in the memory, the document image binarization method is implemented.

[0072] The eighth object of the present invention can be achieved by adopting the following technical solutions:

[0073] A storage medium stores a program, which, when executed by a processor, implements the document image binarization method.

[0074] The present invention has the following beneficial effects compared to the prior art:

[0075] This method uses the concept of estimating and removing background light to process text images with uneven illumination, followed by binarization. Compared to directly binarizing the input image, this method is more adaptable to input images under extreme lighting conditions and is more capable of segmenting text content in overexposed or dark areas.

[0076] This method treats the grayscale values ​​of text images as elevation values ​​within a 3D scene, and the background and text as the ground and ground objects, respectively. It also incorporates a ground filter from 3D point cloud processing to estimate uneven background brightness. Compared to existing binarization methods that estimate and eliminate the effects of background light, this method achieves a better fit for any complex background lighting and is less likely to affect text content.

[0077] The present invention introduces a dark field text mask, which further improves the binarization effect of the document image binarization algorithm on extremely low brightness input images, making the algorithm better adaptable to widely fluctuating background brightness and some extreme lighting conditions.

[0078] In summary, the present invention provides a set of process methods for applying the ground filtering algorithm in three-dimensional point cloud processing to document image binarization. The ground in a three-dimensional scene fluctuates irregularly, so the ground filtering algorithm has a good fitting ability for complex changing planes and some sudden changes in elevation. Thanks to this, the present invention can adapt to text images under any complex lighting background. Due to the ability of the ground filter to separate the ground and non-ground points, the image lighting background fitted based on the ground filtering result can better eliminate the influence of text pixels. In addition, the dark field text mask used in the present invention can effectively enhance the text contrast in the lower brightness areas of the input image, and can better identify the text content under extreme lighting conditions. Therefore, the present invention can provide better text binarization results than the traditional local threshold segmentation method, and improve the recognition accuracy of OCR tools for document images under harsh lighting conditions. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0080] Figure 1 Flowchart of the document image binarization method according to the first embodiment of the present invention.

[0081] Figure 2 Flowchart of the document image binarization method according to the first embodiment of the present invention.

[0082] Figure 3 FIG. 1 is a diagram illustrating the document image binarization process according to the first embodiment of the present invention.

[0083] Figure 4 Flowchart of a document image binarization method according to a second embodiment of the present invention.

[0084] Figure 5 Flowchart of a document image binarization method according to a third embodiment of the present invention.

[0085] Figure 6 This is a structural block diagram of a document image binarization system according to a fourth embodiment of the present invention.

[0086] Figure 7 This is a structural block diagram of a document image binarization system according to a fifth embodiment of the present invention.

[0087] Figure 8 This is a structural block diagram of a document image binarization system according to a sixth embodiment of the present invention.

[0088] Figure 9 FIG. 4 is a structural block diagram of a computer device according to a seventh embodiment of the present invention.

[0089] Figure 3 In the figure, (a) input image, (b) inverted image, (c) front bottom surface, (d) reverse bottom surface, (e) background light estimation, (f) text mask, (g) background light removed image, (h) corrected image, and (i) document image binarization result. DETAILED DESCRIPTION

[0090] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, 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 part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0091] Some nouns or terms that appear in the description of the embodiments of this application are subject to the following interpretations:

[0092] Ground filtering is a key technique in 3D point cloud processing, separating ground points from non-ground points in a scene. For a digital image, if the grayscale value of each pixel is considered elevation, the image can be considered a digital surface model (DSM), allowing the image to be mapped into a point cloud in 3D space. For document images, text pixels are equivalent to non-ground points in the mapped scene, while background pixels are equivalent to ground points. Therefore, ground filtering can be used to separate text from background in an image, providing a theoretical basis for ground filtering-based binarization methods for document images with uneven illumination.

[0093] First embodiment:

[0094] like Figure 1-2 This embodiment provides a document image binarization method. This method addresses the shortcomings of existing technologies by extracting and estimating the background light in a document image with uneven illumination, and then correcting the input image to obtain a document image with a near-uniform background light. This method achieves a higher binarization accuracy for document images with uneven illumination. The method includes the following steps:

[0095] S101: Acquire an input image and an inverted image corresponding to the input image, wherein the input image contains text information.

[0096] In S101 , the grayscale value of the input image is inverted to obtain an inverted image corresponding to the input image.

[0097] S102. Based on a ground filter, the input image and the inverted image are binarized by treating grayscale values ​​as elevation values ​​to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image is used as the positive bottom surface and the second binary image is used as the negative bottom surface.

[0098] In S102, ground filtering is applied to the input image and the inverted image corresponding to the input image, respectively, to obtain two binary images, namely a first binary image and a second binary image, wherein pixels identified as ground points are marked as 0 and appear black, and pixels identified as non-ground points are marked as 1 and appear white. It should be noted that the grayscale value of the image is regarded as the elevation value of the DSM, so that the image is regarded as a three-dimensional scene. In the original image (input image), the text is black and has a low grayscale value, which can be regarded as corresponding to the ground in the three-dimensional scene. In the inverted image, the grayscale value of the background is low and can be regarded as corresponding to the ground in the three-dimensional scene.

[0099] In one possible embodiment, the black area on the front bottom surface covers text in the input image within a first preset brightness value, text in a second preset brightness value, and background areas away from the text preset values, where the first preset brightness value is less than the second preset brightness value. Alternatively, it can be understood that the black area primarily covers text in darker areas of the original image, some text in higher brightness areas, and some background areas away from the text. On the reverse bottom surface, the black area covers the background area in the reversed image. Alternatively, it can be understood that the black area primarily covers the background area in the image; the above preset values ​​are algorithm-adaptive settings.

[0100] S103 , obtaining a dark field text mask according to the front bottom surface and the back bottom surface after grayscale value inversion.

[0101] In a possible embodiment, obtaining a dark field text mask based on the front bottom surface and the reverse bottom surface after grayscale value inversion includes:

[0102] S1031 . Take the union of the front bottom surface and the reverse bottom surface with inverted grayscale values ​​to obtain a union image.

[0103] In S1031, the grayscale value of the reverse bottom surface is inverted and then taken into union with the positive bottom surface. As a result, the remaining black area in the binary image mainly covers the text area in the image, and has the most complete coverage of the text in the darker area of ​​the original image.

[0104] S1032: Based on the union image, obtain a dark field text mask according to a morphological processing and modification method.

[0105] In S1032, some morphological processing and modification are performed on the union image to obtain a dark field text mask.

[0106] S104 : Based on the background brightness estimation value of the input image, subtract the background light of the input image to obtain a background light removed image.

[0107] In a possible embodiment, the process of obtaining the background brightness estimation value of the input image includes:

[0108] The reverse bottom surface is used as a mask to extract background pixels of the input image, and the holes left after the background pixels are extracted are filled by interpolation to obtain an estimated background brightness value of the input image.

[0109] In S104 , the estimated background light is subtracted from the original image, thereby eliminating background brightness fluctuations in the original image.

[0110] S105 , using the dark field text mask to enhance the text information of the background light removed image, thereby obtaining a document image binarization result.

[0111] Because the grayscale difference between text and background in low-brightness areas of the original image is small, and background light subtraction does not enhance image contrast, text and background in low-brightness areas remain difficult to distinguish. Using a dark-field text mask to enhance text effectively protects text in low-brightness areas and improves contrast with the background. The resulting image is the corrected image. Finally, an adaptive binarization algorithm is applied to the corrected image to produce the document image binarization result.

[0112] Assuming an input image and assuming that a Cloth Simulation Filter (CSF) ground filter is used, this embodiment also provides a document image binarization processing process as follows:

[0113] Figure 3 -a and Figure 3 -b are the input image and the inverse image of the input image. If the grayscale values ​​of the two images are regarded as elevation, the image can be regarded as a DSM, and the image can be directly mapped to a point cloud in three-dimensional space.

[0114] Perform ground filtering on the input image and the inverted image respectively to obtain the positive bottom surface as shown in Figure 3 -c and reverse bottom surface as Figure 3 -d. The black area in the reverse bottom surface indicates the location of the background pixels in the input image. Therefore, by selecting the background pixels in the input image based on the reverse bottom surface and then interpolating to fill the holes, we can get the background light estimation of the input image, such as Figure 3 -e. In addition, the black area in the front bottom contains the information of the text content in the image. The reverse bottom is inverted, and then the union is taken with the front bottom. With the help of image processing and morphological operations, the remaining black area can basically represent the text in the input image, and the coverage of the dark field text is the most complete, which is the dark field text mask. Figure 3 -f.

[0115] Directly subtract the background light estimate from the input image to obtain an image such as Figure 3 -g. Then, the text content in the image is enhanced by using text masking and grayscale stretching, and the corrected image is obtained. Figure 3 -h. Finally, local threshold segmentation is applied to the corrected image to obtain the final document image binarization result, as shown in Figure 3 -i.

[0116] Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above embodiments may be completed by instructing related hardware through a program, and the corresponding program may be stored in a computer-readable storage medium.

[0117] It should be noted that although the method operations of the above embodiments are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed to achieve the desired results. Rather, the depicted steps may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into a single step, and / or a single step may be broken down into multiple steps.

[0118] Second embodiment:

[0119] like Figure 4 As shown, this embodiment provides a document image binarization method, which includes the following steps:

[0120] S401: Acquire an input image and an inverted image corresponding to the input image, wherein the input image includes text information.

[0121] S402 . Based on a ground filter, binarize the inverted image by regarding grayscale values ​​as elevation values ​​to obtain a third binary image corresponding to the inverted image, wherein the third binary image serves as the inverted bottom surface.

[0122] In a possible embodiment, in the reverse bottom surface, the black area covers the background area in the reverse color image. Alternatively, it can be understood that the black area mainly covers the background area in the image.

[0123] S403 : Using the reverse bottom surface as a mask, extracting background pixels of the input image, and filling holes left by extracting the background pixels by interpolation to obtain a background brightness estimation value of the input image.

[0124] S404 : Based on the background brightness estimation value of the input image, subtract the background light of the input image to obtain a background light removed image.

[0125] S405 : Based on the background light removed image, obtain a document image binarization result according to a binarization algorithm.

[0126] The above process directly binarizes the input image after subtracting the background light without using a dark field text mask.

[0127] Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above embodiments may be completed by instructing related hardware through a program, and the corresponding program may be stored in a computer-readable storage medium.

[0128] It should be noted that although the method operations of the above embodiments are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed to achieve the desired results. Rather, the depicted steps may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into a single step, and / or a single step may be broken down into multiple steps.

[0129] Third embodiment:

[0130] like Figure 5 As shown, this embodiment provides a document image binarization method, which includes the following steps:

[0131] S501: Acquire an input image and an inverted image corresponding to the input image, wherein the input image contains text information.

[0132] S502. Based on a ground filter, the input image and the inverted image are binarized by treating grayscale values ​​as elevation values ​​to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image is used as the positive bottom surface and the second binary image is used as the negative bottom surface.

[0133] In one possible embodiment, the black area on the front bottom surface covers text in the input image within a first preset brightness value, text in the input image within a second preset brightness value, and background areas away from the text preset values, where the first preset brightness value is less than the second preset brightness value. Alternatively, it can be understood that the black area primarily covers text in darker areas of the original image, some text in higher brightness areas, and some background areas away from the text. On the reverse bottom surface, the black area covers the background area in the reversed image. Alternatively, it can be understood that the black area primarily covers the background area in the image.

[0134] S503 , obtaining a dark field text mask based on the front bottom surface and the reverse bottom surface after grayscale value inversion, and directly using it as a document image binarization result.

[0135] For the specific implementation steps of S503, refer to the possible implementation methods of S103 in Example 1.

[0136] The above process directly uses part of the text mask as the result of text binarization.

[0137] In addition, different ground filters can be used multiple times on different areas of different images to achieve the optimal processing combination for specific input data.

[0138] Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above embodiments may be completed by instructing related hardware through a program, and the corresponding program may be stored in a computer-readable storage medium.

[0139] It should be noted that although the method operations of the above embodiments are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed to achieve the desired results. Rather, the depicted steps may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into a single step, and / or a single step may be broken down into multiple steps.

[0140] Fourth embodiment:

[0141] like Figure 6 As shown, this embodiment provides a document image binarization system, which includes an input unit 601, a filtering unit 602, a merging and modifying unit 603, a subtraction unit 604, and an enhancement and output unit 605. The specific functions of each unit are as follows:

[0142] An input unit 601 is configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0143] A filtering unit 602 is configured to perform a binarization process on the input image and the inverted image based on a ground filter and by treating grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0144] In the bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0145] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0146] a merging and modifying unit 603, configured to obtain a dark field text mask based on the front bottom surface and the reverse bottom surface after grayscale value inversion;

[0147] a subtraction unit 604 configured to subtract the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0148] The enhancement and output unit 605 is configured to enhance the text information of the background light removed image using the dark field text mask, thereby obtaining a document image binarization result.

[0149] Fifth embodiment:

[0150] like Figure 7 As shown, this embodiment provides a document image binarization system, which includes an input unit 701, a filtering unit 702, an estimation unit 703, a subtraction unit 704, and an output unit 705. The specific functions of each unit are as follows:

[0151] An input unit 701 is configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0152] The filtering unit 702 is configured to perform a binarization process on the inverted image based on a ground filter and in a manner of regarding grayscale values ​​as elevation values, to obtain a third binary image corresponding to the inverted image, wherein the third binary image serves as the inverted bottom surface.

[0153] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0154] an estimating unit 703 configured to extract background pixels of the input image using the reverse bottom surface as a mask, and fill holes left by the extracted background pixels by interpolation to obtain an estimated background brightness value of the input image;

[0155] a subtraction unit 704 configured to subtract the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0156] The output unit 705 is configured to obtain a document image binarization result based on the background light removed image and a binarization algorithm.

[0157] Sixth embodiment:

[0158] like Figure 8 As shown, this embodiment provides a document image binarization system, which includes an input unit 801, a filtering unit 802, and an output unit 803. The specific functions of each unit are as follows:

[0159] An input unit 801 is configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0160] The filtering unit 802 is configured to perform a binarization process on the input image and the inverted image based on a ground filter and by treating grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface.

[0161] In the front bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0162] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0163] The output unit 803 is configured to obtain a dark field text mask based on the front bottom surface and the back bottom surface after grayscale value inversion, and directly use the mask as a document image binarization result.

[0164] Seventh embodiment:

[0165] like Figure 9 As shown, this embodiment provides a computer device, which includes a processor 902, a memory, an input device 903, a display device 904, and a network interface 905 connected via a system bus 901. The processor 902 is used to provide computing and control capabilities, and the memory includes a non-volatile storage medium 906 and an internal memory 907. The non-volatile storage medium 906 stores an operating system, a computer program, and a database. The internal memory 907 provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium 906. When the computer program is executed by the processor 902, the above-mentioned document image binarization method is implemented.

[0166] The method comprises:

[0167] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0168] Based on a ground filter, binarizing the input image and the inverted image in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0169] In the front bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0170] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0171] Obtaining a dark field text mask according to the front bottom surface and the reverse bottom surface after grayscale value inversion;

[0172] deducting the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0173] The dark field text mask is used to enhance the text information of the background light removed image, thereby obtaining a document image binarization result.

[0174] Alternatively, the method comprises:

[0175] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0176] Based on a ground filter, the inverted image is binarized by treating grayscale values ​​as elevation values ​​to obtain a third binary image corresponding to the inverted image, wherein the third binary image serves as the inverted bottom surface;

[0177] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0178] Using the reverse bottom surface as a mask, extracting background pixels of the input image, and filling holes left by the extracted background pixels by interpolation to obtain an estimated background brightness value of the input image;

[0179] deducting the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0180] Based on the background light removed image, a document image binarization result is obtained according to a binarization algorithm.

[0181] Alternatively, the method comprises:

[0182] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0183] Based on a ground filter, binarizing the input image and the inverted image in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0184] In the bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0185] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0186] A dark field text mask is obtained based on the front bottom surface and the reverse bottom surface after grayscale value inversion, and is directly used as a document image binarization result.

[0187] Eighth embodiment:

[0188] This embodiment provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the above-mentioned document image binarization method is implemented.

[0189] The method comprises:

[0190] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0191] Based on a ground filter, binarizing the input image and the inverted image in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0192] In the bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0193] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0194] Obtaining a dark field text mask according to the front bottom surface and the reverse bottom surface after grayscale value inversion;

[0195] deducting the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0196] The dark field text mask is used to enhance the text information of the background light removed image, thereby obtaining a document image binarization result.

[0197] Alternatively, the method comprises:

[0198] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0199] Based on a ground filter, the inverted image is binarized by treating grayscale values ​​as elevation values ​​to obtain a third binary image corresponding to the inverted image, wherein the third binary image serves as the inverted bottom surface;

[0200] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0201] Using the reverse bottom surface as a mask, extracting background pixels of the input image, and filling holes left by the extracted background pixels by interpolation to obtain an estimated background brightness value of the input image;

[0202] deducting the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image;

[0203] Based on the background light removed image, a document image binarization result is obtained according to a binarization algorithm.

[0204] Alternatively, the method comprises:

[0205] Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information;

[0206] Based on a ground filter, binarizing the input image and the inverted image in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface;

[0207] In the bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text preset value in the input image, wherein the first preset brightness value is less than the second preset brightness value;

[0208] In the reverse bottom surface, the black area covers the background area in the reverse color image;

[0209] A dark field text mask is obtained based on the front bottom surface and the reverse bottom surface after grayscale value inversion, and is directly used as a document image binarization result.

[0210] It should be noted that the computer-readable storage medium of the present embodiment may be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0211] In this embodiment, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. Furthermore, in this embodiment, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0212] The computer readable storage medium can be written in one or more programming languages ​​or a combination thereof to execute the computer program for performing the present embodiment, including object-oriented programming languages ​​such as Java, Python, C++, and conventional procedural programming languages ​​such as C or similar programming languages. The program can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect via the Internet).

[0213] In summary, the present invention demonstrates a simple principle and flexible structure, and its method flow is not tied to a specific ground-based filtering algorithm. Users can apply different ground-based filters at different steps as needed, optimizing speed, accuracy, ease of use, and detailed control capabilities. Furthermore, the freely selectable nature of the ground-based filters ensures that the performance of this invention can continuously improve with technological advancements, ensuring its continued advancement.

[0214] The above is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes based on the technical solution and inventive concept of the present invention within the scope disclosed by the present invention, which falls within the scope of protection of the present invention.

Claims

1. A document image binarization method, characterized in that: The method comprises: Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information; Based on a ground filter, binarizing the input image and the inverted image in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface; In the front bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text in the input image, wherein the first preset brightness value is less than the second preset brightness value; In the reverse bottom surface, the black area covers the background area in the reverse color image; Obtaining a dark field text mask according to the front bottom surface and the reverse bottom surface after grayscale value inversion; deducting the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image; The dark field text mask is used to enhance the text information of the background light removed image, thereby obtaining a document image binarization result.

2. A document image binarization method, characterized in that: The method comprises: Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information; Based on a ground filter, the inverted image is binarized by treating grayscale values ​​as elevation values ​​to obtain a third binary image corresponding to the inverted image, wherein the third binary image serves as the inverted bottom surface; In the reverse bottom surface, the black area covers the background area in the reverse color image; Using the reverse bottom surface as a mask, extracting background pixels of the input image, and filling holes left by the extracted background pixels by interpolation to obtain an estimated background brightness value of the input image; deducting the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image; Based on the background light removed image, a document image binarization result is obtained according to a binarization algorithm.

3. A document image binarization method, characterized in that: The method comprises: Acquire an input image and an inverse color image corresponding to the input image, wherein the input image includes text information; Based on a ground filter, binarizing the input image and the inverted image in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface; In the front bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text in the input image, wherein the first preset brightness value is less than the second preset brightness value; In the reverse bottom surface, the black area covers the background area in the reverse color image; A dark field text mask is obtained based on the front bottom surface and the reverse bottom surface after grayscale value inversion, and is directly used as a document image binarization result.

4. The method according to any one of claims 1 and 3, characterized in that The step of obtaining a dark field text mask based on the front bottom surface and the reverse bottom surface after grayscale value inversion comprises: Taking the union of the front bottom surface and the reverse bottom surface with inverted grayscale values ​​to obtain a union image; Based on the union image, a dark field text mask is obtained according to a morphological processing and modification method.

5. The method according to claim 1, characterized in that: The process of obtaining the background brightness estimation value of the input image includes: The reverse bottom surface is used as a mask to extract background pixels of the input image, and the holes left after the background pixels are extracted are filled by interpolation to obtain an estimated background brightness value of the input image.

6. A document image binarization system, characterized in that: The system comprises: An input unit, configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information; a filtering unit configured to perform a binarization process on the input image and the inverted image based on a ground filter and in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface; In the front bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text in the input image, wherein the first preset brightness value is less than the second preset brightness value; In the reverse bottom surface, the black area covers the background area in the reverse color image; a merging and modifying unit, configured to obtain a dark field text mask based on the front bottom surface and the reverse bottom surface after grayscale value inversion; a subtraction unit, configured to subtract the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image; The enhancement and output unit is used to enhance the text information of the background light removed image using the dark field text mask, thereby obtaining a document image binarization result.

7. A document image binarization system, characterized in that: The system comprises: An input unit, configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information; a filtering unit configured to perform a binarization process on the inverted image based on a ground filter and in a manner of regarding grayscale values ​​as elevation values, to obtain a third binary image corresponding to the inverted image, wherein the third binary image serves as the inverted bottom surface; In the reverse bottom surface, the black area covers the background area in the reverse color image; an estimation unit, configured to extract background pixels of the input image using the reverse bottom surface as a mask, and fill holes left by the extracted background pixels by interpolation to obtain an estimated background brightness value of the input image; a subtraction unit, configured to subtract the background light of the input image based on the background brightness estimation value of the input image to obtain a background light removed image; The output unit is configured to obtain a document image binarization result based on the background light removed image and a binarization algorithm.

8. A document image binarization system, characterized in that: The system comprises: An input unit, configured to obtain an input image and an inverse color image corresponding to the input image, wherein the input image includes text information; a filtering unit configured to perform a binarization process on the input image and the inverted image based on a ground filter and in a manner of regarding grayscale values ​​as elevation values, to obtain a first binary image corresponding to the input image and a second binary image corresponding to the inverted image, wherein the first binary image serves as the front bottom surface and the second binary image serves as the back bottom surface; In the front bottom surface, the black area covers the text in the first preset brightness value area, the text in the second preset brightness value area, and the background area away from the text in the input image, wherein the first preset brightness value is less than the second preset brightness value; In the reverse bottom surface, the black area covers the background area in the reverse color image; The output unit is used to obtain a dark field text mask according to the front bottom surface and the reverse bottom surface after grayscale value inversion, and directly use it as the document image binarization result.

9. A computer device comprising a processor and a memory for storing a program executable by the processor, characterized in that: When the processor executes the program stored in the memory, the method according to any one of claims 1 to 5 is implemented.

10. A readable storage medium storing a program, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method and device for extracting fields in image

    CN103854019A

  • Image processor, image processing method, program, and storage medium

    JP2009071625A