CN116740724A - Method and device for removing penetration content in text image, electronic equipment and medium - Google Patents

Method and device for removing penetration content in text image, electronic equipment and medium Download PDF

Info

Publication number
CN116740724A
CN116740724A CN202310594956.8A CN202310594956A CN116740724A CN 116740724 A CN116740724 A CN 116740724A CN 202310594956 A CN202310594956 A CN 202310594956A CN 116740724 A CN116740724 A CN 116740724A
Authority
CN
China
Prior art keywords
channel
pixel value
text image
processed
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310594956.8A
Other languages
Chinese (zh)
Inventor
沈辉
丁拥科
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongan Online P&c Insurance Co ltd
Original Assignee
Zhongan Online P&c Insurance Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongan Online P&c Insurance Co ltd filed Critical Zhongan Online P&c Insurance Co ltd
Priority to CN202310594956.8A priority Critical patent/CN116740724A/en
Publication of CN116740724A publication Critical patent/CN116740724A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/155Removing patterns interfering with the pattern to be recognised, such as ruled lines or underlines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/18Extraction of features or characteristics of the image
    • G06V30/18105Extraction of features or characteristics of the image related to colour
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a method and a device for clearing permeable content in a text image, electronic equipment and a medium. The method comprises the following steps: acquiring a text image to be processed, respectively determining each pixel point in the text image to be processed, and respectively corresponding channel pixel values in each color channel of an RGB color space; determining a channel reference pixel value for performing cleaning processing on the text image to be processed based on each channel pixel value; and determining a pixel point to be processed in the text image to be processed based on the channel reference pixel value, and carrying out pixel processing on the pixel point to be processed to obtain a processed target text image. The method of the application realizes the removal of the back penetration content in the text image, thereby improving the reliability of the subsequent automatic analysis result of the text image.

Description

Method and device for removing penetration content in text image, electronic equipment and medium
Technical Field
The present application relates to computer vision, and more particularly, to a method, an apparatus, an electronic device, and a medium for removing permeable content in a text image.
Background
The OCR technology in the field of computer vision mainly refers to performing automatic analysis processing on text content in a text image by using an image algorithm technology, such as performing text detection, text recognition, document layout analysis, form analysis, formula analysis, and the like. These techniques have found great application in the vertical fields such as automated scoring, insurance automated claims settlement, banking automated auditing, and the like.
When processing a text image, one type of input style is common, namely, the paper effect is poor, so that the image page of the scanned text image to be processed often shows out the text on the background of the next page or the current page, which brings certain interference to the text content in the text image to be analyzed by the image algorithm technology, leads to the text recognition error in the text image, and finally leads to the unreliable result of automatic analysis.
For this reason, it is necessary to remove the disturbing content that has penetrated in the text background before the text image is automatically parsed.
Disclosure of Invention
The application provides a method, a device, electronic equipment and a medium for clearing penetrating content in a text image, which are used for solving the problem that in the prior art, analysis of the text image is interfered because of penetrating of the back side content in the text image to be analyzed, and clearing of the back side penetrating content in the text image is realized, so that the reliability of a subsequent automatic analysis result of the text image is improved.
On one hand, the application provides a method for clearing permeable content in a text image, which comprises the following steps:
acquiring a text image to be processed, respectively determining each pixel point in the text image to be processed, and respectively corresponding channel pixel values in each color channel of an RGB color space;
determining a channel reference pixel value for performing cleaning processing on the text image to be processed based on each channel pixel value;
and determining a pixel point to be processed in the text image to be processed based on the channel reference pixel value, and carrying out pixel processing on the pixel point to be processed to obtain a processed target text image.
Optionally, the determining each pixel point in the text image to be processed respectively, and the corresponding channel pixel value in each color channel of the RGB color space respectively includes:
for any pixel point, determining each initial channel pixel value corresponding to the current pixel point in each color channel based on the pixel value of the current pixel point;
and respectively performing interval mapping processing on the initial channel pixel values to obtain channel pixel values respectively corresponding to the current pixel point in each color channel of an RGB color space.
Optionally, the performing interval mapping processing on each initial channel pixel value to obtain channel pixel values corresponding to the current pixel point in each color channel of the RGB color space, where the processing includes:
for any color channel, acquiring a preset interval parameter, dividing the initial channel pixel value and the interval parameter, and rounding to obtain an intermediate mapping value of the current color channel;
and multiplying the intermediate mapping value by the interval parameter to obtain the channel pixel value of the current color channel.
Optionally, the determining, based on each channel pixel value, a channel reference pixel value for performing a cleaning process on the text image to be processed includes:
for any pixel point, respectively acquiring channel weights corresponding to the color channels, and determining a weight pixel value of the current pixel point based on the channel pixel value and the channel weights of the color channels;
and determining a channel reference pixel value for clearing the text image to be processed based on the weight pixel value of each pixel point in the text image to be processed.
Optionally, the determining, based on the weighted pixel value of each pixel point in the text image to be processed, a channel reference pixel value for performing a cleaning process on the text image to be processed includes:
Carrying out numerical frequency statistics on each weight pixel value, and taking the weight pixel value with the largest numerical frequency as the reference weight pixel value of the text image to be processed;
and carrying out channel decomposition processing on the reference weight pixel values to respectively obtain channel reference pixel values in each color channel.
Optionally, the difference between the channel weights of the color channels is greater than a preset difference threshold.
Optionally, the determining the pixel point to be processed in the text image to be processed based on the channel reference pixel value includes:
performing space transformation on each channel reference pixel value to obtain an HSV reference pixel value corresponding to each channel reference pixel value in an HSV color space;
for any pixel point, determining the pixel value of each initial channel corresponding to the current pixel point in each color channel of the RGB color space and the initial HSV pixel value in the HSV color space;
performing first comparison processing on each initial channel pixel value and each channel reference pixel value to obtain a corresponding first comparison result;
performing second comparison processing on the initial HSV pixel value and the HSV reference pixel value to obtain a corresponding second comparison result;
And determining whether the current pixel point is the pixel point to be processed or not based on the first comparison result and the second comparison result.
On the other hand, the application provides a method and a device for clearing the penetration content in the text image, comprising the following steps:
the channel pixel value determining module is used for acquiring a text image to be processed, respectively determining each pixel point in the text image to be processed, and respectively corresponding channel pixel values in each color channel of the RGB color space;
the channel reference pixel value determining module is used for determining a channel reference pixel value for carrying out clearing processing on the text image to be processed based on each channel pixel value;
the target text image obtaining module is used for determining a pixel point to be processed in the text image to be processed based on the channel reference pixel value, and carrying out pixel processing on the pixel point to be processed to obtain a processed target text image.
Optionally, the channel pixel value determining module includes:
an initial channel pixel value obtaining sub-module, configured to determine, for any pixel point, each initial channel pixel value corresponding to a current pixel point in each color channel based on a pixel value of the current pixel point;
And the channel pixel value determining submodule is used for respectively carrying out interval mapping processing on each initial channel pixel value to obtain channel pixel values respectively corresponding to the current pixel point in each color channel of the RGB color space.
Optionally, the channel pixel value determining submodule includes:
an obtaining unit is set in the middle, and is used for obtaining a preset interval parameter for any color channel, dividing the pixel value of the initial channel and the interval parameter, and rounding to obtain a middle mapping value of the current color channel;
and the channel pixel value determining unit is used for multiplying the intermediate mapping value and the interval parameter to obtain the channel pixel value of the current color channel.
Optionally, the channel reference pixel value obtaining module includes:
the weight pixel value obtaining sub-module is used for respectively obtaining channel weights corresponding to the color channels for any pixel point, and determining the weight pixel value of the current pixel point based on the channel pixel value and the channel weight of each color channel;
and the channel reference pixel value obtaining sub-module is used for determining the channel reference pixel value for clearing the text image to be processed based on the weight pixel value of each pixel point in the text image to be processed.
Optionally, the channel reference pixel value obtaining sub-module includes:
the reference weight pixel value determining unit is used for carrying out numerical frequency statistics on each weight pixel value, and taking the weight pixel value with the largest numerical frequency as the reference weight pixel value of the text image to be processed;
and the channel reference pixel value obtaining unit is used for carrying out channel decomposition processing on the reference weight pixel values to obtain channel reference pixel values in the color channels respectively.
Optionally, the difference between the channel weights of the color channels is greater than a preset difference threshold.
Optionally, the target text image obtaining module includes:
the HSV reference pixel value obtaining submodule is used for carrying out space transformation on the reference pixel values of all channels to obtain HSV reference pixel values corresponding to the reference pixel values of all channels in an HSV color space;
an initial HSV pixel value obtaining sub-module, configured to determine, for any pixel point, each initial channel pixel value corresponding to the current pixel point in each color channel of the RGB color space, and an initial HSV pixel value in the HSV color space;
the first comparison result obtaining module is used for carrying out first comparison processing on the initial channel pixel values and the channel reference pixel values to obtain corresponding first comparison results;
The second comparison result obtaining module is used for carrying out second comparison processing on the initial HSV pixel value and the HSV reference pixel value to obtain a corresponding second comparison result;
and the pixel point to be processed determining submodule is used for determining whether the current pixel point is the pixel point to be processed or not based on the first comparison result and the second comparison result.
In a third aspect, the present application also provides a server, including: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
wherein the processor executes the executable instructions stored in the memory to implement the method for clearing the infiltrated content in the text image according to the first aspect.
In a fourth aspect, the present application also provides a computer readable storage medium having stored therein computer executable instructions which when executed by a processor are configured to implement the method for removing the infiltrated content in the text image according to the first aspect.
In a fifth aspect, the present application further provides a computer program product, which includes a computer program, where the computer program when executed by a processor implements a method for clearing the infiltrated content in the text image according to the first aspect of the embodiment of the present application.
According to the clearing method provided by the application, the channel pixel value of the pixel point is adopted to determine the channel reference pixel value of the text image to be processed, namely the clearing threshold value, so that the pixel point to be processed in the text image to be processed is determined based on the clearing threshold value, and then the pixel point to be processed is cleared to obtain the processed target text image, the problem that analysis of the text image is interfered due to back content penetration in the text image to be analyzed in the prior art is solved, back penetration content in the text image is cleared, and the reliability of the subsequent automatic analysis result of the text image is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is an application scene diagram of a method for removing a permeable content in a text image according to the present application;
FIG. 2a is an exemplary diagram of a text image to be processed with backface-penetrating content present;
FIG. 2b is an exemplary diagram of a target text image after removal of the infiltrated content;
fig. 3 is a flow chart of a method for clearing permeable content in a text image according to an embodiment of the present application;
Fig. 4 is a flowchart of another method for removing the infiltrated content in the text image according to an embodiment of the present application;
FIG. 5 is a flow chart of a method for removing the infiltrated content in another intermediate text image according to an exemplary embodiment of the present application;
fig. 6 is a schematic structural diagram of a device for removing permeated content in a text image according to an exemplary embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 8 illustrates a block diagram of an electronic device, according to an example embodiment.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
In practical application, when the paper text image is analyzed by the OCR technology, the text content on the background of the next page or the current page is often revealed out from the image page of the scanned text image to be processed due to poor paper quality. In this case, because of the invisible disturbing text in the text image, the model for text parsing recognizes the text in the text image by recognizing the transmitted text content as the content in the text image to be processed. Therefore, a certain interference is brought to the text content in the analysis text image, so that the character recognition error in the text image is caused, and finally, the automatic analysis result is unreliable.
The application provides a method for clearing permeable content in a text image, which aims to solve the technical problems in the prior art. Specifically, determining pixel values of pixel points in a text image to be processed, decomposing the pixel values to obtain channel pixel values, determining channel pixel reference values, namely a clearing threshold value, of clearing the text image to be processed through the channel pixel values, determining the pixel points to be processed in the text image to be processed based on the clearing threshold value, clearing the pixel points to be processed to obtain a target text image without interference content, and automatically analyzing the target text image to improve reliability of analysis results.
Fig. 1 is an application scene diagram of a method for removing permeable content in a text image provided by the application. Fig. 2a is an example diagram of a text image to be processed with back side infiltrated content present. Fig. 2b is an exemplary diagram of a target text image after removal of the infiltrated content.
The application scenario to which the embodiments of the present application are applicable will be described with reference to fig. 1, 2a and 2 b. Referring to fig. 1, in the process of scanning and automatically analyzing a paper text image by using OCR technology, the paper content is scanned to obtain a text image to be processed, which contains permeated content due to poor paper quality. The specific penetration content may be text content of the next page or text content on the back of the current page. Illustratively, referring to FIG. 2a, there is backside penetration content in the image of FIG. 2 a. In the above-mentioned case, in order to ensure the accuracy of the analysis result as much as possible, it is necessary to perform a clearing process on the penetration content in the text image to be processed, so as to obtain the target text image. Specifically, when a text image to be processed is obtained, determining RGB channel pixel values of each pixel point in the text image, because text content and penetration content in each image are different, that is, the pixel values of each image are different, in order to improve the cleaning accuracy, it is necessary to individually determine channel reference pixel values required when cleaning penetration content in the current text to be processed based on the determined RGB channel pixel values, and further determine pixel points to be cleaned, that is, the pixel points to be processed, based on the channel reference pixel values and the pixel values of each pixel point, and perform penetration content cleaning processing on the pixel points to be processed, so as to obtain the processed target text image. Illustratively, referring to FIG. 2b, the infiltrated content in the image of FIG. 2b has been purged. Furthermore, when the automatic analysis processing is performed based on the target text image, the reliability of the analysis result can be improved.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 3 is a flow chart of a method for clearing permeable content in a text image according to an embodiment of the present application. The method may be performed by a device for removing the infiltrated content in the text image, where the device for removing the infiltrated content in the text image may be a server or an electronic device, and the method in this embodiment may be implemented by software, hardware or a combination of software and hardware, as shown in fig. 3, and includes the following steps.
S210, acquiring a text image to be processed, respectively determining each pixel point in the text image to be processed, and respectively corresponding channel pixel values in each color channel of the RGB color space.
In the present application, a text image to be processed can be understood as a text image in which there is a recognition of disturbing content. Particularly paper scanned images where backside bleed-through content is present. Of course, the text image to be processed may be other text images needing background processing, such as a photographed image of a watermark, such as the existence time, the place, etc.
Specifically, the method for acquiring the text image to be processed may be obtained by reading the text image from a preset database of the current execution device based on an image acquisition path, or may be obtained by directly uploading the image based on devices such as a scanning device and a shooting device, and the method for acquiring the text image to be processed is not limited.
In practical applications, a pixel point may be understood as a small point that makes up an image. Specifically, the image is divided to obtain a plurality of small squares, and each small square may be referred to as a pixel point. The pixel value can be understood as the position and color value of the assigned small square, and can be specifically formed into various colors by combining the shades of three primary colors. In the RGB color space, the three primary colors may be three primary colors of Red (Red), green (Green), and Blue (Blue). Color channels are specifically understood as channels that preserve image color information. In the above color space, the color channels specifically include R, G, B three channels.
In the embodiment of the application, on the basis of acquiring the text image to be processed, the text image to be processed is subjected to image segmentation processing, so that each pixel point of the text image to be processed is obtained. Further, a channel pixel value corresponding to each pixel point in each color channel of the RGB color space is determined based on the pixel value of each pixel point.
Specifically, the pixel values of all the pixel points in the text image to be processed can be subjected to channel decomposition processing through a pre-compiled code script, so that channel pixel values of all the pixel points in all the color channels of the RGB color space are obtained. Of course, the channel pixel value of each pixel point may be determined by a pre-trained channel decomposition model. The method for obtaining the channel pixel value is not limited in the present application.
S220, determining a channel reference pixel value for performing cleaning processing on the text image to be processed based on each channel pixel value.
Since the text content contained in the different text images is different, the pixel values of the pixels in the different text images are also different, so that the reference pixel value required for performing the clearing process on the text image to be processed needs to be set based on the pixel value of the pixels in the text image to be processed.
Based on the above, in the technical scheme of the application, when the channel pixel value of each pixel point of the text image to be processed is determined, the channel reference pixel value corresponding to the text image to be processed is determined based on each channel pixel value, and the determined channel reference pixel value is used as a clearing threshold value to clear each pixel point in the text image to be processed, so as to obtain the processed target text image.
S230, determining a pixel point to be processed in the text image to be processed based on the channel reference pixel value, and performing pixel processing on the pixel point to be processed to obtain a processed target text image.
In the embodiment of the application, the channel reference pixel value determined based on the embodiment is taken as the clearing threshold value for clearing, specifically, each pixel point in the text image to be processed is compared with the clearing threshold value condition, the pixel point which does not meet the clearing threshold value condition in the pixel points is taken as the pixel point to be processed, and the determined pixel point to be processed is cleared, so that the processed target text image is obtained. Specifically, the pixel point clearing method may be to carry out pixel point assignment on the pixel point to be processed again, for example, assign a channel reference pixel value as the pixel value of the pixel point to be processed, or randomly select the pixel value of the pixel point meeting the clearing threshold condition as the pixel value of the pixel point to be processed, which is not limited.
In the technical scheme, the channel pixel value of the text image to be processed is determined by adopting the channel pixel value of the pixel point, namely the clearing threshold value, so that the pixel point to be processed in the text image to be processed is determined based on the clearing threshold value, and then the pixel point to be processed is cleared to obtain the processed target text image, the problem that analysis of the text image is interfered due to back content penetration in the text image to be analyzed in the prior art is solved, back penetration content in the text image is cleared, and the reliability of the subsequent automatic analysis result of the text image is improved.
Fig. 4 is a flowchart of another method for removing the infiltrated content in the text image according to an embodiment of the present application. This embodiment may be understood as an embodiment of the above embodiment describing the method by referring to fig. 4, where the method may specifically include:
s310, acquiring a text image to be processed, respectively determining each pixel point in the text image to be processed, and respectively corresponding channel pixel values in each color channel of the RGB color space.
Specifically, for understanding and examples of the technical means, technical effects, and technical terms in step S310, reference may be made to the explanation of step S210 in the above embodiments.
On the basis of the foregoing embodiment, in this embodiment, the step of determining in step S310 may specifically include:
s311, for any pixel point, determining the pixel value of each initial channel corresponding to the current pixel point in each color channel based on the pixel value of the current pixel point.
In an actual scene, the acquired text image to be processed comprises text content and a background area. If the channel reference pixel value for performing the clearing process is determined based on the channel pixel value of the pixel point corresponding to the text content, the deviation between the determined pixel value and the image background pixel value in the text image to be processed may be excessively large, so that the difference between the target text image after the processing based on the value and the text image before the processing is excessively large, and finally the reliability of the processing result is low.
Based on the problem, the method can further comprise the following steps after acquiring the text image to be processed: determining the image content of the text image to be processed, and performing image interception processing on the text image to be processed based on the image content to obtain an intercepted text image to be processed.
Specifically, the image capturing may be performed based on the area of the text content and the area of the image background in the text image to be processed, and the area of the image background is taken as the captured text image to be processed, and further, the step of determining the channel pixel value and the reference channel pixel value is performed based on the captured text image to be processed.
Specifically, on the basis of determining each pixel point in the text image to be processed, the initial channel pixel value of each pixel point in each color channel is determined based on the pixel value of each pixel point. The initial channel pixel value may be understood as an initial channel pixel value obtained by performing three-channel decomposition on the pixel value.
For any pixel point, determining a pixel value of the current pixel point, and performing channel decomposition by adopting a pre-trained neural network model to obtain initial channel pixel values corresponding to all color channels in an RGB color space; alternatively, the pre-selected compiled code script may be used to perform channel decomposition on the pixel values to obtain channel initial pixel values corresponding to each color channel in the RGB color space.
S312, respectively performing interval mapping processing on the pixel values of the initial channels to obtain channel pixel values respectively corresponding to the current pixel point in each color channel of the RGB color space.
In the embodiment of the application, under the condition that the initial channel pixel value is obtained, the pixel value difference of the adjacent pixel points is smaller, so that the calculation process of directly calculating the reference pixel value of the subsequent channel based on the pixel value of each pixel point becomes complex, and the obtained initial channel pixel value is subjected to interval mapping processing in the technical scheme of the application, and continuous pixel values are mapped into discrete pixel values. Specifically, the channel pixel values in the preset range are mapped to the same interval, and then subsequent channel reference pixel value calculation is performed based on the mapped channel pixel values, so that the subsequent pixel value calculation is simpler and easier to process.
Optionally, the process of performing interval mapping on the initial channel pixel value may include: for any color channel, acquiring a preset interval parameter, dividing an initial channel pixel value and the interval parameter, and rounding to obtain an intermediate mapping value of the current color channel; and multiplying the intermediate mapping value by the interval parameter to obtain the channel pixel value of the current color channel.
Specifically, the mapping process is described by taking any one of the three RGB color channels as an example. Taking an R channel as an example, an initial channel pixel value V of each pixel point in the R channel is obtained r Further, the preset interval parameter is set to 3, and in other embodiments, other parameters may be set, which is not limited in this aspect. On the basis, V is firstly calculated R Dividing by 3, rounding to obtain RIntermediate mapping value V of channel r After that, the intermediate mapping value V r Multiplying' by 3 to obtain the channel pixel value V of R channel R
Further, channel pixel values of each pixel point in the image to be processed in the G channel and the B channel are respectively determined based on the above embodiments.
On the basis of the above embodiment, when determining each pixel point in the text image to be processed, if the number of the pixel points is too large, the calculation efficiency of the computer may be reduced due to the large data calculation amount, so the technical scheme of the application further includes performing pixel point sampling processing on each pixel point in the text image to be processed based on the number of the pixel points, and obtaining the sampled pixel points.
For example, the process of sampling the pixel points may include: the acquired text image to be processed is marked as I, the height of the I is h, the width of the I is w, and the number of total pixel points of the text image to be processed is: w is h. Here, if a sampling pixel threshold is set to 0.05, the number of pixels to be sampled n=0.05×w×h. Further, sampling without replacement is carried out, n pixel points are randomly extracted from the I, the extracted pixel points are used as sampled pixel points, and further, the channel pixel value determination and the subsequent channel reference pixel value determination are carried out based on the sampled pixel points.
S320, determining a channel reference pixel value for performing cleaning processing on the text image to be processed based on each channel pixel value.
Specifically, for understanding and examples of the technical means, technical effects, and technical terms in step S320, reference may be made to the explanation of step S220 in the above embodiments.
On the basis of the foregoing embodiment, in this embodiment, the step of step S320 may specifically include:
s321, for any pixel point, respectively acquiring channel weights corresponding to the color channels, and determining the weight pixel value of the current pixel point based on the channel pixel value and the channel weights of the color channels.
In the embodiment of the application, the channel pixel values of each color channel after the interval mapping processing is carried out on each pixel point in the text image to be processed are converted to obtain the pixel values of each pixel point, so as to determine the reference pixel value for the clearing processing based on the pixel values, and further determine the channel reference pixel value based on the reference pixel value, so as to carry out the subsequent clearing processing.
It should be noted that, for different pixel points, although the pixel values of the two pixel points in the channels of each color are different, after the pixel value conversion is performed, the pixel values of the two pixel points may be the same pixel value, so that the reliability of the result calculated later is low, in order to improve the reliability of the calculation result, the channel weights are preset for each color channel, and the difference value between the channel weights of each color channel is greater than the preset difference threshold, so that the problem that the obtained pixel values after the conversion of the two pixel points with different channel pixel values are the same can be avoided.
Specifically, channel weights corresponding to the color channels are obtained. Exemplary, in the technical scheme of the present application, the channel weight of the R channel is set to 256 2 Setting the channel weight of the G channel to be 256 1 Setting the channel weight of the B channel as 256 0 . On the basis, the channel weight of the current pixel point is multiplied by the channel pixel value correspondingly by any pixel point distance to obtain the channel weight pixel value of the pixel point in the color channel, and the pixel point is added to the channel weight pixel values to obtain the weight pixel value of the pixel point. Illustratively, the weighted pixel value of the pixel point is determined based on the following expression.
V=V R *65536+V G *256+V B
S322, determining a channel reference pixel value for clearing the text image to be processed based on the weight pixel value of each pixel point in the text image to be processed.
In the embodiment of the application, the weight pixel value of each pixel point in the text image to be processed is respectively determined based on the above embodiment. And then determining a reference weight pixel value for clearing processing based on each weight pixel value, and decomposing the reference weight pixel value to obtain a channel reference pixel value, and then carrying out subsequent clearing processing based on the channel reference pixel value.
Optionally, the method for obtaining the channel reference pixel value in the present application may include: carrying out numerical value frequency statistics on each weight pixel value, and taking the weight pixel value with the largest numerical value frequency as a reference weight pixel value of the text image to be processed; and carrying out channel decomposition processing on the reference weight pixel values to obtain channel reference pixel values in each color channel respectively.
Specifically, the occurrence frequency of the pixel value is counted for each weight pixel value, the weight pixel value with the largest occurrence frequency in each weight pixel value is counted, and the counted weight pixel value is determined as the reference weight pixel value for the subsequent cleaning treatment. Further, the reference weight pixel value is decomposed to obtain a decomposed channel reference pixel value.
Illustratively, the counted reference weight pixel value is recorded as V max_fre And then to V max_fre And carrying out pixel value decomposition processing to obtain channel reference pixel values of each color channel in the RBG color space.
Specifically, a pre-trained channel decomposition model can be adopted, and decomposition processing can also be carried out by adopting a pre-compiled code script. Alternatively, the decomposition processing may be performed by using a preset expression to obtain the reference pixel value of each channel. Illustratively, the expression is as follows:
V bg_r =V max_fre /65536
V bg_g =(V max_fre -V bg_r *65536)/256
V bg_b =V max_fre -V bg_r *65536-V bg_g *256
Wherein V is bg_r Channel reference pixel values representing R channels; v (V) bg_g Channel reference pixel values representing the G channel; v (V) bg_b Representing the channel reference pixel value of the B channel.
S330, determining a pixel point to be processed in the text image to be processed based on the channel reference pixel value, and performing pixel processing on the pixel point to be processed to obtain a processed target text image.
Specifically, for understanding and examples of the technical means, technical effects, and technical terms in step S330, reference may be made to the explanation of step S230 in the above embodiments.
On the basis of the foregoing embodiment, in this embodiment, the step of step S330 may specifically include:
s331, performing spatial transformation on the reference pixel values of each channel to obtain HSV reference pixel values corresponding to the reference pixel values of each channel in an HSV color space.
In the application, on the basis of determining the channel reference pixel value, whether each pixel point is a data to be processed pixel point can be determined directly based on the comparison result of the channel pixel value and the channel reference pixel value of each pixel point in the text image to be processed. In order to further improve the accuracy of image processing, the technical scheme of the application also carries out color space transformation on the determined channel reference pixel value, determines the HSV reference pixel value corresponding to the HSV color space, and further determines whether each pixel point is a data pixel point to be processed or not based on the comparison result of the channel pixel value of each pixel point in the HSV color space and the channel reference pixel value in the HSV color space in the text image to be processed. It should be noted that, the pixel point to be processed may be determined based on any one of the above comparison results, or may be determined based on both the above comparison results, which is not limited.
Among them, HSV color space can be understood as HSV (Hue, saturation, value) which is a color space created according to the intuitive nature of colors, also called hexapyramid Model (hexacone Model). In particular, the parameters of the color in the HSV reference pixel values may include a hue (H) value, a saturation (S) value, and a brightness (V) value, respectively.
Alternatively, the trained channel conversion model may be directly obtained, and the channel reference pixel values of each color channel in the RGB color space may be directly input into the channel conversion model, so as to obtain the HSV reference pixel values in the HSV space output by the model. Of course, a preset space conversion expression may also be obtained to perform space conversion.
S332, for any pixel point, determining the pixel value of each initial channel corresponding to the current pixel point in each color channel of the RGB color space and the initial HSV pixel value in the HSV color space.
S333, performing first comparison processing on the pixel values of the initial channels and the reference pixel values of the channels to obtain corresponding first comparison results.
In the embodiment of the present application, the first comparison process may be understood as a comparison process between the channel reference pixel value in the RGB color space and the initial channel pixel value of each pixel point, and correspondingly, the first comparison result may be understood as a pixel value comparison result in the RGB color space.
Specifically, for any pixel, in the RGB space, the initial channel pixel value of the R channel, the initial channel pixel value of the G channel, and the initial channel pixel value of the B channel of the pixel are respectively equal to the channel reference pixel value V obtained in the above embodiment bg_r ,V bg_g ,V bg_b And performing difference processing to obtain comparison results corresponding to the color channels respectively.
S334, performing second comparison processing on the initial HSV pixel value and the HSV reference pixel value to obtain a corresponding second comparison result.
In the embodiment of the present application, the second comparison process may be understood as a comparison process between the HSV reference pixel value in the HSV color space and the initial HSV pixel value of each pixel point, and correspondingly, the second comparison result may be understood as a pixel value comparison result in the HSV color space.
Specifically, for any pixel point, in the HSV space, the hue value, the saturation value and the brightness value of the pixel point are respectively subjected to difference processing with the hue reference value, the saturation reference value and the brightness reference value in the HSV reference pixel values obtained in the above embodiment, so as to obtain a pixel value comparison result in the HSV space.
S335, determining whether the current pixel point is a pixel point to be processed or not based on the first comparison result and the second comparison result.
In the embodiment of the application, a preset first comparison threshold value and a preset second comparison threshold value can be obtained in advance; comparing the obtained first comparison result with a preset first comparison condition, or comparing the obtained second comparison result with a preset second comparison condition; optionally, if the first comparison result does not meet the first comparison condition requirement, or the second comparison result does not meet the second comparison condition requirement, the current pixel point is indicated to be the pixel point to be processed.
In the embodiment of the present application, the first comparison condition may be that the pixel difference value in the comparison result of each of any two color channels in the three color channels is greater than a preset threshold value. Illustratively, the first comparison condition is that the pixel differences for each of the three channels must have more than 2 differences greater than 62. The second comparison condition may be that the comparison results of the three color parameters are all greater than a preset threshold. Illustratively, the difference in S values is greater than 0.2 and the difference in V values is greater than 0.25 in the second alignment condition.
In the actual application process, the first comparison processing and the second comparison processing can be carried out on each pixel point at the same time, and whether each pixel point is a pixel point to be processed or not is judged together according to the comparison processing result and the comparison condition; optionally, the first comparison process (second comparison process) may be performed first, and the second comparison process (first comparison process) may be performed on each pixel point in the comparison result of the first comparison process (second comparison process) that meets the first comparison condition (second comparison condition), so as to determine whether each pixel point is a pixel point to be processed according to the comparison result of the second comparison process (first comparison process) and the second comparison condition (first comparison condition). The application does not limit the judging sequence in the process of judging whether the pixel point is the pixel point to be processed.
S336, performing pixel processing on the pixel points to be processed to obtain the processed target text image.
In the embodiment of the application, when the pixel points to be processed in the text image to be processed are determined, the pixel points are required to be processed so as to eliminate the interference content in the text image to be processed and obtain the target text image with clean background.
The processing mode of the pixel point to be processed in the application can be exemplified by directly replacing the pixel value of the pixel point to be processed with the background color of the text image to be processed, namely white; specifically, the channel pixel values of each color channel in the RGB color space of the pixel to be processed may be replaced with (255, 255, 255).
In the scheme, the initial channel pixel value of each pixel point of the text image to be processed in each color channel in the RGB color space is obtained, and the interval mapping processing is carried out on the initial channel pixel value to obtain the channel pixel value of each pixel point, so that the data volume of the processing of the subsequent pixel values is simplified, and the processing efficiency is improved; further, a channel reference pixel value which is referred to when the text to be processed is cleared is determined based on the channel weight value and the channel pixel value by setting the channel weight value for each channel of the pixel points, and then the pixel points to be processed are determined based on the comparison between the channel reference pixel value and the initial channel pixel value of each pixel point; in the process, the channel reference pixel values are subjected to space transformation to obtain HSV reference pixel values in an HSV space, the HSV reference pixel values are compared with initial HSV pixel values of all pixel points in the HSV space, and meanwhile, the pixel points to be processed are determined together with the pixel value comparison results in the RGB color space, so that pixel value comparison based on multiple spaces is realized, the accuracy of pixel point determination is improved, and the processing effect of subsequent image processing is improved. And finally, carrying out pixel point processing on the determined pixel points to be processed, thereby obtaining a target text image with clean background, solving the problem of interference to the analysis of the text image caused by back surface content penetration in the text image to be analyzed in the prior art, and realizing the removal of back surface penetration content in the text image, thereby improving the reliability of the subsequent automatic analysis result of the text image.
Fig. 5 is a flowchart of another method for removing the infiltrated content in the text image according to an exemplary embodiment of the present application. Referring to fig. 5, the method specifically includes:
a text image that requires content removal processing is acquired.
On the basis, the image interception is carried out on the basis of the area of the text content and the area of the image background in the text image to be processed, the area of the image background is taken as the intercepted text image to be processed, and then the step of determining the channel pixel value and the reference channel pixel value is carried out on the basis of the intercepted text image to be processed.
Optionally, when determining each pixel point in the text image to be processed, if the number of the pixel points is too large, performing pixel point sampling processing on each pixel point in the text image to be processed based on the number of the pixel points to obtain sampled pixel points.
Specifically, the obtained initial channel pixel values are subjected to interval mapping processing, and continuous pixel values are mapped into discrete pixel values. Specifically, the channel pixel values in the preset range are mapped to the same interval, and then subsequent channel reference pixel value calculation is performed based on the mapped channel pixel values, so that the subsequent pixel value calculation is simpler and easier to process.
Specifically, the pixel values of the color channels after the interval mapping process is performed on each pixel point in the text image to be processed are converted to obtain pixel values of each pixel point, so that a reference pixel value for cleaning process is determined based on the pixel values, and further, a channel reference pixel value is determined based on the reference pixel value, so that subsequent cleaning process is performed.
Optionally, determining whether each pixel value is a processed pixel value based on the channel reference pixel value; optionally, if yes, the pixel value of the pixel point is reserved, otherwise, the pixel value of the pixel point is replaced with white until the processing of each pixel point is completed, a target text image corresponding to the text image to be processed is obtained, and the interference of the background in the text image is effectively removed, so that the false detection of text detection is reduced, and the subsequent analysis processing such as layout analysis, document structuring and the like is further facilitated.
Fig. 6 is a schematic structural diagram of a device for removing infiltrated content in a text image according to an exemplary embodiment of the present application. Referring to fig. 6, the apparatus includes:
the channel pixel value determining module 410 is configured to obtain a text image to be processed, determine each pixel point in the text image to be processed, and respectively correspond to a channel pixel value in each color channel of the RGB color space;
A channel reference pixel value determining module 420, configured to determine a channel reference pixel value for performing a cleaning process on the text image to be processed based on each channel pixel value;
the target text image obtaining module 430 is configured to determine a pixel to be processed in the text image to be processed based on the channel reference pixel value, and perform pixel processing on the pixel to be processed to obtain a processed target text image.
Optionally, the channel pixel value determining module 410 includes:
the initial channel pixel value obtaining sub-module is used for determining the pixel value of each initial channel corresponding to the current pixel point in each color channel based on the pixel value of the current pixel point for any pixel point;
and the channel pixel value determining submodule is used for respectively carrying out interval mapping processing on the initial channel pixel values to obtain channel pixel values respectively corresponding to the current pixel point in each color channel of the RGB color space.
Optionally, the channel pixel value determining submodule includes:
an obtaining unit is set in the middle, and is used for obtaining a preset interval parameter for any color channel, dividing an initial channel pixel value and the interval parameter, and rounding to obtain a middle mapping value of the current color channel;
And the channel pixel value determining unit is used for multiplying the intermediate mapping value and the interval parameter to obtain the channel pixel value of the current color channel.
Optionally, the channel reference pixel value obtaining module 420 includes:
the weight pixel value obtaining sub-module is used for respectively obtaining channel weights corresponding to all color channels for any pixel point, and determining the weight pixel value of the current pixel point based on the channel pixel value and the channel weight of each color channel;
the channel reference pixel value obtaining sub-module is used for determining the channel reference pixel value for clearing the text image to be processed based on the weight pixel value of each pixel point in the text image to be processed.
Optionally, the channel reference pixel value obtaining sub-module includes:
the reference weight pixel value determining unit is used for carrying out numerical frequency statistics on each weight pixel value, and taking the weight pixel value with the largest numerical frequency as the reference weight pixel value of the text image to be processed;
and the channel reference pixel value obtaining unit is used for carrying out channel decomposition processing on the reference weight pixel values to obtain channel reference pixel values in each color channel respectively.
Optionally, the difference between the channel weights of the color channels is greater than a preset difference threshold.
Optionally, the target text image obtaining module 430 includes:
the HSV reference pixel value obtaining submodule is used for carrying out space transformation on the reference pixel values of all channels to obtain HSV reference pixel values corresponding to the reference pixel values of all channels in an HSV color space;
an initial HSV pixel value obtaining sub-module, configured to determine, for any pixel point, each initial channel pixel value corresponding to the current pixel point in each color channel of the RGB color space, and an initial HSV pixel value in the HSV color space;
the first comparison result obtaining module is used for carrying out first comparison processing on the pixel values of the initial channels and the reference pixel values of the channels to obtain corresponding first comparison results;
the second comparison result obtaining module is used for carrying out second comparison processing on the initial HSV pixel value and the HSV reference pixel value to obtain a corresponding second comparison result;
the pixel point to be processed determining submodule is used for determining whether the current pixel point is the pixel point to be processed or not based on the first comparison result and the second comparison result.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 7, the electronic device of the present embodiment may include:
at least one processor 501; and
A memory 502 communicatively coupled to the at least one processor;
wherein the memory 502 stores instructions executable by the at least one processor 501, the instructions being executable by the at least one processor 501 to cause the server to perform a method as in any one of the embodiments described above.
Alternatively, the memory 502 may be separate or integrated with the processor 501.
The implementation principle and technical effects of the electronic device provided in this embodiment may be referred to the foregoing embodiments, and will not be described herein again.
The embodiment of the application also provides a computer readable storage medium, wherein computer executable instructions are stored in the computer readable storage medium, and when the processor executes the computer executable instructions, the method of any of the previous embodiments is realized.
Embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements the method of any of the preceding embodiments.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, e.g., the division of modules is merely a logical function division, and there may be additional divisions of actual implementation, e.g., multiple modules may be combined or integrated into another system, or some features may be omitted or not performed.
The integrated modules, which are implemented in the form of software functional modules, may be stored in a computer readable storage medium. The software functional modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or processor to perform some of the steps of the methods of the various embodiments of the application.
It should be appreciated that the processor may be a central processing unit (Central Processing Unit, CPU for short), other general purpose processors, digital signal processor (Digital Signal Processor, DSP for short), application specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution. The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The storage medium may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). It is also possible that the processor and the storage medium reside as discrete components in a server or master device.
Fig. 8 illustrates a block diagram of an electronic device, which may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like, in accordance with an exemplary embodiment.
The apparatus 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the apparatus 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interactions between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the apparatus 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 806 provides power to the various components of the device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the device 800.
The multimedia component 808 includes a screen between the device 800 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or sliding action, but also the duration and pressure associated with the touch or sliding operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear camera. The front camera and/or the rear camera may receive external multimedia data when the apparatus 800 is in an operational mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 further includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of the apparatus 800. For example, the sensor assembly 814 may detect an on/off state of the device 800, a relative positioning of the assemblies, such as a display and keypad of the device 800, the sensor assembly 814 may also detect a change in position of the device 800 or one of the assemblies of the device 800, the presence or absence of user contact with the device 800, an orientation or acceleration/deceleration of the device 800, and a change in temperature of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the apparatus 800 and other devices, either in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 804 including instructions executable by processor 820 of apparatus 800 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the split screen processing method of the electronic device.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for removing the permeated content in a text image, comprising the steps of:
acquiring a text image to be processed, respectively determining each pixel point in the text image to be processed, and respectively corresponding channel pixel values in each color channel of an RGB color space;
Determining a channel reference pixel value for performing cleaning processing on the text image to be processed based on each channel pixel value;
and determining a pixel point to be processed in the text image to be processed based on the channel reference pixel value, and carrying out pixel processing on the pixel point to be processed to obtain a processed target text image.
2. The method according to claim 1, wherein the determining each pixel point in the text image to be processed, respectively, includes:
for any pixel point, determining each initial channel pixel value corresponding to the current pixel point in each color channel based on the pixel value of the current pixel point;
and respectively performing interval mapping processing on the initial channel pixel values to obtain channel pixel values respectively corresponding to the current pixel point in each color channel of an RGB color space.
3. The method according to claim 2, wherein the performing interval mapping processing on each of the initial channel pixel values to obtain channel pixel values corresponding to the current pixel point in each color channel of the RGB color space, respectively, includes:
For any color channel, acquiring a preset interval parameter, dividing the initial channel pixel value and the interval parameter, and rounding to obtain an intermediate mapping value of the current color channel;
and multiplying the intermediate mapping value by the interval parameter to obtain the channel pixel value of the current color channel.
4. The method of claim 1, wherein determining a channel reference pixel value for a cleaning process of the text image to be processed based on each of the channel pixel values comprises:
for any pixel point, respectively acquiring channel weights corresponding to the color channels, and determining a weight pixel value of the current pixel point based on the channel pixel value and the channel weights of the color channels;
and determining a channel reference pixel value for clearing the text image to be processed based on the weight pixel value of each pixel point in the text image to be processed.
5. The method of claim 4, wherein determining a channel reference pixel value for performing a cleaning process on the text image to be processed based on the weighted pixel value of each pixel point in the text image to be processed comprises:
Carrying out numerical frequency statistics on each weight pixel value, and taking the weight pixel value with the largest numerical frequency as the reference weight pixel value of the text image to be processed;
and carrying out channel decomposition processing on the reference weight pixel values to respectively obtain channel reference pixel values in each color channel.
6. The method of claim 4, wherein a difference between channel weights for each of the color channels is greater than a preset difference threshold.
7. The method of any of claims 1-6, wherein the determining a pixel point to be processed in the text image to be processed based on the channel reference pixel value comprises:
performing space transformation on each channel reference pixel value to obtain an HSV reference pixel value corresponding to each channel reference pixel value in an HSV color space;
for any pixel point, determining the pixel value of each initial channel corresponding to the current pixel point in each color channel of the RGB color space and the initial HSV pixel value in the HSV color space;
performing first comparison processing on each initial channel pixel value and each channel reference pixel value to obtain a corresponding first comparison result;
Performing second comparison processing on the initial HSV pixel value and the HSV reference pixel value to obtain a corresponding second comparison result;
and determining whether the current pixel point is the pixel point to be processed or not based on the first comparison result and the second comparison result.
8. A device for removing the permeated content in a text image, comprising:
the channel pixel value determining module is used for acquiring a text image to be processed, respectively determining each pixel point in the text image to be processed, and respectively corresponding channel pixel values in each color channel of the RGB color space;
the channel reference pixel value determining module is used for determining a channel reference pixel value for carrying out clearing processing on the text image to be processed based on each channel pixel value;
the target text image obtaining module is used for determining a pixel point to be processed in the text image to be processed based on the channel reference pixel value, and carrying out pixel processing on the pixel point to be processed to obtain a processed target text image.
9. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
The processor executes computer-executable instructions stored in the memory to implement the text image background interference removal method of any one of claims 1 to 7.
10. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out a method of clearing of a text image of a penetrating content according to any one of claims 1 to 7.
CN202310594956.8A 2023-05-24 2023-05-24 Method and device for removing penetration content in text image, electronic equipment and medium Pending CN116740724A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310594956.8A CN116740724A (en) 2023-05-24 2023-05-24 Method and device for removing penetration content in text image, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310594956.8A CN116740724A (en) 2023-05-24 2023-05-24 Method and device for removing penetration content in text image, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN116740724A true CN116740724A (en) 2023-09-12

Family

ID=87917823

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310594956.8A Pending CN116740724A (en) 2023-05-24 2023-05-24 Method and device for removing penetration content in text image, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN116740724A (en)

Similar Documents

Publication Publication Date Title
US10157326B2 (en) Method and device for character area identification
CN105095881B (en) Face recognition method, face recognition device and terminal
EP3226204B1 (en) Method and apparatus for intelligently capturing image
US10127471B2 (en) Method, device, and computer-readable storage medium for area extraction
EP3125135A1 (en) Picture processing method and device
EP3163500A1 (en) Method and device for identifying region
EP3200125A1 (en) Fingerprint template input method and device
EP3163503A1 (en) Method and apparatus for area indentification
US10650502B2 (en) Image processing method and apparatus, and storage medium
EP2975574A2 (en) Method, apparatus and terminal for image retargeting
CN111666941A (en) Text detection method and device and electronic equipment
CN112200040A (en) Occlusion image detection method, device and medium
CN112927122A (en) Watermark removing method, device and storage medium
EP4057236A1 (en) Method and apparatus for character recognition, electronic device, and storage medium
CN108010009B (en) Method and device for removing interference image
US20230326216A1 (en) Object detection method and apparatus for vehicle, device, vehicle and medium
CN116740724A (en) Method and device for removing penetration content in text image, electronic equipment and medium
CN105653623B (en) Picture collection method and device
US11417028B2 (en) Image processing method and apparatus, and storage medium
CN114299056A (en) Defect point recognition method of image and defect image recognition model training method
CN106874444B (en) Picture processing method and device
CN112950503A (en) Training sample generation method and device and truth value image generation method and device
CN111310600B (en) Image processing method, device, equipment and medium
CN111783771B (en) Text detection method, text detection device, electronic equipment and storage medium
CN117710224A (en) Image fusion method, device, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination