CN-122024246-A - Document background interference removing method and device
Abstract
The application provides a method and equipment for removing document background interference, which are used for obtaining an original image in a document to be processed, carrying out pixel color clustering on the original image to obtain a plurality of color clustering clusters, generating mask images corresponding to each color clustering cluster based on the original image and the plurality of color clustering clusters to obtain a plurality of mask images, responding to target mask images meeting preset screening conditions in the plurality of mask images, carrying out interference removing operation on the original image based on the target mask images to obtain a target image, and therefore, the recognition accuracy of document background interference can be effectively improved, and the manual interference requirement and the error rate of subsequent processing are remarkably reduced.
Inventors
- WU HAITAO
- ZHANG WEI
- HUANG HAI
- JIN SHUJUAN
- LI XIAOLONG
Assignees
- 联宝(合肥)电子科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260112
Claims (10)
- 1. A method for removing document background interference, the method comprising: Acquiring an original image in a document to be processed, wherein the document to be processed contains background interference elements; performing pixel color clustering on the original image to obtain a plurality of color clusters; Generating mask images corresponding to each color cluster based on the original image and the plurality of color clusters to obtain a plurality of mask images; And responding to the existence of target mask images meeting preset screening conditions in the plurality of mask images, and performing interference removal operation on the original image based on the target mask images to obtain target images, wherein the preset screening conditions are used for screening mask images corresponding to background interference elements.
- 2. The document background interference removal method according to claim 1, wherein, before the responding to the existence of the target mask image satisfying a preset screening condition in the plurality of mask images, performing an interference removal operation on the original image based on the target mask image, to obtain a target image, the method further comprises: If the original image is single, determining first area data and first overlapping data corresponding to a first mask image, wherein the first area data indicates the area size of the first mask image, the first overlapping data indicates the area overlapping degree of the first mask image and a second mask image, the first mask image is any one of the mask images, and the second mask image is any one of the mask images except the first mask image; if the first area data meets a preset area condition and the first overlapping data meets a preset position condition, determining that the first mask image is a target mask image meeting the preset screening condition, wherein the preset screening condition comprises the preset area condition and the preset position condition.
- 3. The method for removing document background interference according to claim 1, wherein if the first area data includes a first area value, the preset area condition includes that the first area value is smaller than a first area threshold; if the first area data includes a first area ratio, the preset area condition includes that the first area ratio is smaller than a first ratio threshold, and the first area ratio is a ratio of an area of the first mask image to an area of the original image.
- 4. The document background interference removal method according to claim 2, wherein determining first overlapping data corresponding to the first mask image includes: Acquiring a first contour region of a first mask image, wherein the first contour region is used for indicating the boundary of the first mask image; Determining, within the second mask image, an area corresponding to the coordinate parameter based on the coordinate parameter of the first contour area as a second contour area; and collecting the number of pixel points meeting a preset pixel value in the second contour area as first overlapping data.
- 5. The document background interference removal method according to claim 4, wherein the first overlapping data includes a first overlapping value, and the preset position condition includes: the first overlap value is greater than a first overlap threshold or the first overlap value meets a second overlap threshold, wherein the first overlap threshold is different from the second overlap threshold.
- 6. The method for removing background interference from a document according to claim 1, wherein said responding to existence of a target mask image satisfying a preset screening condition among the plurality of mask images, performing an interference removing operation on the original image based on the target mask image, to obtain a target image, comprises: If the number of the original images is multiple, and N first original images exist in the multiple original images, candidate mask images meeting the preset screening conditions exist in the multiple mask images corresponding to the first original images; Determining similarity degree data of a first candidate mask image and a second candidate mask image, and determining the first candidate mask image or the second candidate mask image as the target mask image if the similarity degree data meets a preset similarity condition, wherein the first candidate mask image is any one candidate mask image corresponding to N first original images, and the second candidate mask image is another candidate mask image corresponding to N first original images; and performing interference removal operation on the plurality of original images based on the target mask image to obtain the target image.
- 7. The method for removing document background interference according to claim 6, wherein if the similarity degree data includes a contour similarity, the preset similarity condition includes that the contour similarity is greater than a contour similarity threshold, or If the similarity degree data comprises image similarity, the preset similarity condition comprises that the image similarity is larger than an image similarity threshold value.
- 8. The method for removing background interference from a document according to claim 7, wherein if the similarity data includes image similarity, the determining similarity data of the first candidate mask image and the second candidate mask image includes: taking the first candidate mask image as a template image and the second candidate mask image as a search image; performing position movement on the search image by taking a preset unit pixel as a step length to obtain a plurality of candidate positions; performing similarity calculation on pixels of the template image and pixels of the corresponding area of the search image at each candidate position to obtain pixel similarity corresponding to a plurality of candidate positions; And selecting the maximum value from the pixel similarity corresponding to the candidate positions as similarity degree data of the first candidate mask image and the second candidate mask image.
- 9. The method for removing document background interference according to claim 1, wherein the performing pixel color clustering on the original image to obtain a plurality of color clusters includes: Determining color values contained in the original image to obtain a color value set; And clustering the color value sets to obtain a plurality of color clustering clusters corresponding to the original image.
- 10. An electronic device, comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
Description
Document background interference removing method and device Technical Field The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for removing document background interference. Background In the field of automated document processing, especially in the parsing process of structured text and forms, text content often needs to be identified due to the existence of background interfering elements, such as watermarks, seals, classification marks, copyright notices, and the like. At present, a large model is generally adopted to analyze a document, such as a layout recognition model is adopted to divide a document page, and an optical character recognition (Optical Character Recognition, OCR) model is adopted to perform character recognition, but related technologies often have the problem that semantic errors occur in recognition of characters, tables and the like due to background interference elements, so that the accuracy rate of subsequent file arrangement is reduced. Disclosure of Invention The application provides a method, equipment and a storage medium for removing document background interference, which are used for at least solving the technical problems in the related technology. In a first aspect of the present application, there is provided a document background interference removal method, the method comprising: Acquiring an original image in a document to be processed, wherein the document to be processed contains background interference elements; performing pixel color clustering on the original image to obtain a plurality of color clusters; Generating mask images corresponding to each color cluster based on the original image and the plurality of color clusters to obtain a plurality of mask images; And responding to the existence of target mask images meeting preset screening conditions in the plurality of mask images, and performing interference removal operation on the original image based on the target mask images to obtain target images, wherein the preset screening conditions are used for screening mask images corresponding to background interference elements. In an embodiment, before the responding to the existence of the target mask image meeting the preset screening condition in the plurality of mask images, performing an interference removal operation on the original image based on the target mask image to obtain a target image, the method further includes: If the original image is single, determining first area data and first overlapping data corresponding to a first mask image, wherein the first area data indicates the area size of the first mask image, the first overlapping data indicates the area overlapping degree of the first mask image and a second mask image, the first mask image is any one of the mask images, and the second mask image is any one of the mask images except the first mask image; if the first area data meets a preset area condition and the first overlapping data meets a preset position condition, determining that the first mask image is a target mask image meeting the preset screening condition, wherein the preset screening condition comprises the preset area condition and the preset position condition. In one embodiment, if the first area data includes a first area value, the preset area condition includes that the first area value is smaller than a first area threshold; if the first area data includes a first area ratio, the preset area condition includes that the first area ratio is smaller than a first ratio threshold, and the first area ratio is a ratio of an area of the first mask image to an area of the original image. In an embodiment, determining the first overlapping data corresponding to the first mask image includes: Acquiring a first contour region of a first mask image, wherein the first contour region is used for indicating the boundary of the first mask image; Determining, within the second mask image, an area corresponding to the coordinate parameter based on the coordinate parameter of the first contour area as a second contour area; and collecting the number of pixel points meeting a preset pixel value in the second contour area as first overlapping data. In an embodiment, the first overlapping data includes a first overlapping value, and the preset position condition includes: the first overlap value is greater than a first overlap threshold or the first overlap value meets a second overlap threshold, wherein the first overlap threshold is different from the second overlap threshold. In an embodiment, the responding to the existence of the target mask image satisfying the preset screening condition in the plurality of mask images, performing an interference removal operation on the original image based on the target mask image, to obtain a target image, includes: If the number of the original images is multiple, and N first original images exist in the multiple original images, ca