CN111145126A - Image character fast erasing method - Google Patents
Image character fast erasing method Download PDFInfo
- Publication number
- CN111145126A CN111145126A CN201911405784.5A CN201911405784A CN111145126A CN 111145126 A CN111145126 A CN 111145126A CN 201911405784 A CN201911405784 A CN 201911405784A CN 111145126 A CN111145126 A CN 111145126A
- Authority
- CN
- China
- Prior art keywords
- background
- pixel
- color
- value
- characters
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 230000008569 process Effects 0.000 claims description 9
- 230000007480 spreading Effects 0.000 claims description 4
- 238000005070 sampling Methods 0.000 abstract description 6
- 239000003086 colorant Substances 0.000 description 11
- 230000000694 effects Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000008439 repair process Effects 0.000 description 3
- 230000007704 transition Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/77—Retouching; Inpainting; Scratch removal
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Processing Or Creating Images (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
The invention discloses a method for quickly erasing image characters, which comprises the steps of inputting an image to be processed; judging and selecting the background color type of the character area to be erased, drawing a selection frame to select the characters to be erased: if the background is a monochromatic background, automatically sampling and selecting pixel points from the initial position of the selecting frame by the system, continuously copying the background blocks with preset pixel width to the end point direction of the selecting frame and covering character pixel points; if the background is the gradient color background, the system adds a preset expansion value to the RGB value of the pixel point at the starting point of the culling frame to serve as a background protection color gamut, sequentially reads the RGB values of all the pixel points in the culling frame, judges whether the RGB values are in the range of the background protection color gamut, and if so, does not perform any operation; if not, replacing the RGB value covering the current pixel point by the RGB value of the pixel point adjacent to the protection color pixel point, adding a preset expansion value to the RGB value of the pixel point after replacement to serve as a new background protection color gamut, and repeating the steps.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to a method for quickly erasing image characters.
Background
In the field of image processing, Adobe Photoshop is highly favored by the industry, especially the image restoration function is very powerful, but the efficiency of restoring the erased image text is very low. Image processing software other than Adobe Photoshop is similar to the repair concept of Adobe Photoshop, and is basically ignored in the erasing technique of image characters.
The existing image repairing tool uses a non-specific erasing technique, such as a Photoshop stamp or a repairing tool, and when erasing characters on an image, a user manually samples an image background block pattern around the characters (or the size of a brush set by the user) to cover the characters to achieve the effect of erasing the characters. As shown in fig. 1, particularly such images containing a gradient-colored background, erasing a segment of text on the image may require the image processor to play by sampling, clicking or dragging, smearing several tens, or even hundreds of times around the text. For a person who does not perform professional image processing or a common user, the characters can be erased, but the background leaves various modified mottled traces, the background is not better restored, and the time is very long.
In view of the above, it is desirable to provide a new method for erasing graphic characters quickly.
Disclosure of Invention
In order to solve the above technical problems, the technical solution of the present invention is to provide a method for erasing image and text quickly, comprising the following steps:
s1, inputting an image to be processed;
s2, judging and selecting the background color type of the character area to be erased, drawing a selection frame to select the characters to be erased;
s3, if the background is a single color background, the step goes to S4, if the background is a gradient color background, the step goes to S5;
s4, according to the preset pixel covering direction, the system automatically samples and selects the pixel from the initial position of the selecting frame, continuously copies and covers the character pixel to the terminal direction of the selecting frame by the background block with the preset width of 1-10 pixels, and outputs and displays the processed image;
s5, according to the preset pixel coverage direction, the system takes the RGB value of the pixel at the starting point of the selecting frame plus the preset expansion value as the boundary RGB value of the background protection color gamut, and the RGB value pixel beyond the boundary value is the non-background protection color gamut; when processing characters with light color, background and deep color, the background protection color gamut is from pure white to boundary RGB value; when processing the characters with dark color background and light color, the background protection color gamut is from the boundary RGB value to pure black;
the preset expansion value is set according to the background color of the characters to be erased and the periphery of the corresponding characters in the image judged by the user, if the characters are light-color backgrounds of dark characters, the preset expansion value is set to be not more than 0 by the user, and if the characters are light-color backgrounds of dark characters, the preset expansion value is set to be not less than 0 by the user;
traversing to obtain all RGB pixel points contained in the selection frame; in the traversing process, if the RGB value of the current pixel point is contained in the background protection color gamut, no processing is carried out, and the remaining pixel points are continuously traversed; if the current pixel point is not contained in the background protection color gamut, replacing and covering the current pixel point by using an RGB value pixel point which is adjacent to the current pixel point and belongs to the background protection color gamut; the RGB value of the pixel point after replacement plus a preset expansion value is used as a new boundary RGB value of the background protection color gamut; continuously repeating the steps until all pixel points in the selection frame are traversed, compared and processed; and outputs and displays the processed image.
In the method, the shape of the marquee is a rectangular frame or a user-defined multi-frame.
In the method, the traversal order of the RGB color values of all the pixel points included in the marquee obtained by the traversal of the gradient background is from left to right, from right to left, from top to bottom, or from bottom to top.
In the above method, the covering direction includes any angle from left to right, from right to left, from top to bottom, or from bottom to top, according to the setting.
In the method, the selection of the range of the adjacent pixel points of the gradient color background can be set as the pixel points with the interval of 1-10 pixel points around the replaced pixel point according to the requirement, and the RGB value of the pixel point is in the background protection color gamut.
In the method, the expansion value of the gradient background is set to be-255, if one of the R, G and B values is less than 0 after being expanded by a negative value, the value is counted as 0, and if one of the R, G and B values is more than 255 after being expanded by a positive value, the value is counted as 255.
In the method, the range of the adjacent pixel points of the gradient background is selected as the pixel points with the interval of 1-10 pixels around the replaced pixel point.
In the method, the monochrome background automatically uses the background block to sample pixels with the width of 1-300 pixels, if the monochrome marquee is a rectangle, the height is the height of the rectangle, and if the monochrome marquee is a polygon, the height is the length from the highest point to the lowest point multiplied by 1.5 times.
In the method, the preset pixel width range can be set to be 1-10 pixels.
The image erasing technology of the invention determines a monochromatic background or a gradient color background according to different types of processed image backgrounds, if the background is the monochromatic background, a system automatically samples and selects pixel points from the starting position of a selecting frame and continuously copies and covers character pixel points to the end point direction of the selecting frame by using background blocks with preset pixel widths; if the background is the gradient color background, the system sets the boundary RGB value of the background protection color gamut by the RGB value of the starting point pixel of the culling frame and the preset expansion value, then reads the RGB color values of all the pixel points in a traversing manner, replaces the pixel points which meet the replacement condition according to the protection color RGB color values among the pixels with the preset spacing, and takes the RGB value of the pixel points after replacement and the preset expansion value as the boundary RGB value of the new background protection color gamut; the method is repeated to the end point, so as to achieve the effect of erasing the characters quickly. Since the background color pixels which are very close to the text color pixels are used for replacement, the pixel points which are replaced after the text is erased are more naturally fused with the background color. The automatic sampling of the present invention solves this problem if a large number of manual fine repair operations between 1-10 pixels are used, which is very costly and inefficient. The invention has wide use population, can erase characters and line patterns on images and video frame images, and has simple operation method and high erasing efficiency.
Drawings
FIG. 1 is a flow chart provided in the present invention;
FIG. 2 is a schematic illustration of the type of background provided in the present invention;
FIG. 3 is an image to be processed in the case provided by the present invention;
FIG. 4 is a diagram illustrating an image of a portion to be erased selected by a selecting frame according to an embodiment of the present invention;
FIG. 5 is a diagram of the first erasure result in the case of the present invention;
FIG. 6 is a diagram of the second erasing result in the case of the present invention.
Detailed Description
The invention is described in detail below with reference to specific embodiments and the accompanying drawings.
As shown in FIG. 1, the present invention provides a method for erasing image and text rapidly, comprising the following steps:
s1, inputting an image to be processed;
s2, judging and selecting the background color type of the character area to be erased; in this embodiment, the different regions of the image may include a monochrome background or a gradient color background; the monochrome background refers to a line or a color block of which the color of the character background is only a single RGB value, as shown in fig. 2, the drawings (a) to (b) are monochrome backgrounds (single pure color backgrounds) formed by lines of single RGB values, and the drawings (c) to (d) are monochrome backgrounds formed by a plurality of color blocks of single RGB values longitudinally and transversely, respectively; the gradient color is a complex background with an arbitrary color from light to dark, or from dark to light, or from one color to another color, and the diagrams (e) to (f) are background with gradient color.
In this embodiment, since the text backgrounds in different areas of the image to be processed have both a gradient color background and a monochrome background, the user can visually determine and determine the background, and then select the monochrome check frame or the gradient color check frame to perform the text erasing operation.
S3, if the background is a single color background, the step goes to S4, if the background is a gradient color background, the step goes to S5;
s4, according to the preset or selected pixel covering direction, the system automatically samples and selects the pixel from the initial position of the selecting frame, continuously copies and covers the character pixel to the terminal direction of the selecting frame by the background block with the preset width of 1-10 pixels, and outputs and displays the processed image; in this embodiment, it is preferable that the background block with a width of 5 pixels is continuously copied to the end point direction of the culling box and covers the text pixels.
For example, the background color of the processed image is shown in fig. 2(c), and the background color is a monochrome background formed by a plurality of single RGB value color blocks longitudinally, so the selected coverage direction is from top to bottom or from bottom to top, if the background color of the processed image is shown in fig. 2(d), the selected coverage direction is from left to right or from right to left, and if the background color of the processed image is a monochrome background formed by single RGB value color blocks, the coverage direction at this time is any direction, such as the types of fig. 2(a) and (b).
In this embodiment, in order to adapt to various application environments, the shape of the marquee may be a rectangle or a custom polygon according to the shape of the font, the rule of the text arrangement, or the shape of the pattern.
S5, according to the preset pixel coverage direction, the system takes the RGB value of the pixel at the starting point of the selecting frame plus the preset expansion value as the boundary RGB value of the background protection color gamut, and the RGB value pixel beyond the boundary value is the non-background protection color gamut; when processing light background dark characters, the background protection color gamut is pure white to boundary RGB values. When processing the characters with dark color background and light color, the background protection color gamut is from the boundary RGB value to pure black;
traversing to obtain all RGB pixel points contained in the selection frame; in the traversing process, if the RGB value of the current pixel point is contained in the background protection color gamut, no processing is carried out, and the remaining pixel points are continuously traversed; if the current pixel point is not contained in the background protection color gamut, replacing and covering the current pixel point by using an RGB value pixel point which is adjacent to the current pixel point and belongs to the background protection color gamut; the RGB value of the pixel point after replacement plus a preset expansion value is used as a new boundary RGB value of the background protection color gamut; continuously repeating the steps until all pixel points in the selection frame are traversed, compared and processed; and outputs and displays the processed image.
The following description describes the different cases under the gradient background and the monochromatic background, respectively.
In this embodiment, the RGB values of the pixels are formed by mixing red, blue and green according to a certain ratio, which is also called three primary colors, and the three primary colors are represented by english as r (red), g (green), and b (blue). On a computer display, the RGB values refer to luminance and are expressed as integers. Typically, RGB has 256 levels of brightness, each represented numerically from 0 to 255. Although the number is 255 at the highest, 0 is also one of the numbers, for 256 levels. The total number of colors is 256 × 256 — 16777216, so each pixel in an image has a unique RGB value.
For the gradient background image, in order to identify that the character color and the background color have RGB value difference certainly, the character can be divided into light background dark characters or dark background light characters for simple classification, wherein the background is any color background; in this embodiment, the preset spreading value selection is set as: -255 to 255; the preset expansion value is set so that a user can conveniently take protection according to the shade difference of the background colors of different local parts of the image selection area, and meanwhile, the protection color boundary value of the background colors is dynamically updated along with the change of the shade difference of the background, so that the situation that only characters are smeared or lines or other elements which are not background colors are smeared can be better realized aiming at the contrast of the characters and the background colors.
Setting a preset expansion value according to the background color of the characters to be erased in the image and the periphery of the corresponding characters judged by a user, setting the preset expansion value to be less than or equal to 0 by the user if the characters are light-colored background and dark-colored (the color depth is compared according to the characters and the background), setting the boundary RGB value of the background protection color gamut to be the RGB value of the pixel point plus the preset expansion value, and setting the boundary RGB value of the current background protection color gamut to be pure white RGB (255 ) to the boundary RGB value of the background protection color gamut; if the characters are dark background light color characters, setting a preset expansion value to be more than or equal to 0 by a user, setting the boundary RGB value of the background protection color gamut to be the RGB value of the pixel point plus the preset expansion value, and setting the current background protection color gamut to be the boundary RGB value from pure black RGB (0,0,0) to the background protection color gamut;
for example, the image to be processed is a light-color background and a dark-color text, when a rectangular selection frame is drawn on the light-color background, assuming that the pixel color value of the starting point is RGB (211,191,160), the preset expansion value is-10, and the pixel color value is all RGB values in the color gamut from RGB (255 ) to RGB (201,181,150), i.e., a background protection color, during the process of reading the pixel color value, RGB pixel points of the text with RGB three-color values all smaller than the RGB (201,181,150) color value all belong to a dark-color unprotected color, satisfy an erasure condition, and will be replaced by the adjacent pixel color value of the background protection color, and after the replacement, the replaced pixel point + the preset expansion value is used again to redefine the protection color gamut. By analogy, the background protection color gamut is continuously and dynamically updated, all the dark color pixel points meeting the erasing condition are replaced, and finally the effect of erasing the dark color characters is achieved. Similarly, if the image to be processed is a dark background and light characters, when a rectangular marquee is drawn on the dark background, assuming that the pixel color value at the starting point is RGB (23,1,19), the preset extension value is 10, and that the pixel color value is all RGB values of the color gamut ranging from RGB (0,0,0) to RGB (33,11,29), i.e. the background protection color, in reading the pixel color value, RGB pixel points of light-colored characters with RGB three-color values all larger than RGB (33,11,29) color values belong to non-protection colors, satisfy the erasing condition, will be replaced by adjacent pixel points of background protection colors, after replacement, redefine the protection color gamut by using the replaced pixel points + the preset expansion value, by analogy, the background protection color gamut is continuously and dynamically updated, all the light-color pixel points meeting the erasing condition are replaced, and finally the effect of erasing the light-color characters is achieved.
For a monochrome background image, the system automatically samples and selects pixel points directly from the start of a monochrome marquee, and continuously copies and covers character pixel points in the direction of the end point of the marquee by using a background block with the preset value of 5 pixel widths. In addition, the distance from the starting point to the character is ensured to be larger than the preset width of 5 pixels, so that the system obtains the character copy of the pure background pattern from the starting point to the end point direction and covers the character copy. If the distance from the starting point to the character is less than 5 pixels, the x and y coordinate positions of the marquee can be finely adjusted to enlarge the distance, or the width of the automatically sampled block is adjusted to 1-4 pixels, and the system can copy and cover the character pixel points from any angle of left to right, right to left, top to bottom and bottom to top to the end point according to the set covering direction and the starting point of the marquee.
For example, the background color of the text in the selected area to be processed is light gray of RGB (160,160,160), the text color is three, which are RGB (0,0,0), RGB (100,100,100), RGB (255 ), the width and height of the selected rectangular frame range is 380 × 260 pixels, the covering direction is from left to right as default, and the system automatically samples and selects pixel points directly from the top left of the monochrome selection frame and continuously copies the rectangular background block with preset width of 5 pixels and height of 260 pixels to the right end point and covers the text in the above three color combinations. The monochrome background image is used for erasing the characters without distinguishing the background protection color gamut from the non-background protection color gamut and without distinguishing the light background dark characters from the dark background light characters, but directly uses the monochrome background to directly cover the characters, so that the monochrome background image can be used for quickly erasing the characters with any color by using the automatically sampled blocks.
In this embodiment, if the pixel width of the background block is not set before the smearing operation, the pixel width of the monochrome background automatically sampled by the background block is 1-300 pixels, and if the frame is rectangular, the height is the height of the rectangle; in the case of a polygonal box, the height is 1.5 times the length from the highest point to the lowest point, but the replacement coverage only acts on the area pixels in the marquee.
Meanwhile, it can be known that the embodiment can be applied to not only smearing characters, but also smearing out other elements including lines, symbols and the like in the image can be realized by the same method, which is different from the character recognition technology, so that the erasable characters are not limited to any fonts.
The difference between the present embodiment and the existing PS or other image modifying software is that the existing image modifying software removes the text by manually selecting the block samples and then erasing the text, and particularly for image processing of the gradient background, the method of erasing the text using the existing block samples requires that the image processor smear around the text by dozens or even hundreds of background color samples, which is difficult and very inefficient. The central idea of the present embodiment is to process a gradient background by pixel sampling automatically or a monochrome background by block sampling automatically, so as to cope with various complicated image backgrounds by a flexible and changeable method. For a complicated gradient color background area, the method is realized by the principle of chromatic aberration of characters and the background, a monochrome selecting frame selects the characters needing to be erased and simultaneously directly copies and covers the characters, the gradient selecting frame traverses the RGB values of all pixel points contained in the selected area, the RGB values of the pixel points can be read in the traversing process, the RGB values of the pixel points of a non-background protection color gamut are sequentially replaced by the RGB values of the pixel points contained in the adjacent background protection color gamut, automatic sampling is adopted in the whole process to erase the characters on the monochrome or gradient color background, and the method is simple to operate and high in efficiency.
In this embodiment, when the range of the culling frame is the gradient background, the traversal direction of the RGB color values of all the pixel points included in the traversal culling frame may be determined according to a preset rule, that is, the traversal order may be set from left to right, from right to left, from top to bottom, or from bottom to top according to the system program, and the traversal may be performed according to the direction from the starting point to the ending point of the culling frame.
In this embodiment, the pixel point covering direction in the marquee includes from left to right according to the setting, from right to left, from top to bottom or from bottom to top arbitrary angle, if scribble the in-process and not set up pixel point covering direction, then pixel point covering direction can be according to system setting predetermine for from left to right, from right to left, from top to bottom or from bottom to top arbitrary angle.
If the pixel coverage direction is set from left to right, the direction of the coverage process selects the RGB value of the background protection color pixel in the left preset range to replace the RGB value of the pixel read in the current traversal under the condition of meeting the coverage condition; if the pixel coverage direction is set from top to bottom, the direction of the coverage process selects the RGB value of the pixel in the upper preset range to replace the RGB value of the pixel read in the current traversal under the condition of meeting the coverage condition, so that transition and repair of erasing characters and background colors are realized.
In this embodiment, it should be noted that, since the image is two-dimensional (x, y), the reading and the covering of the RGB values of the pixels may be performed sequentially in a row or a column.
In the preferred embodiment, under the condition of the background with gradually changed color, the adjacent pixel points in the selection frame are detected pixel points within a preset range of the pixel points to be replaced, the range of the adjacent pixel points can be selected as pixel points with the interval of 1-10 pixel points around the pixel points to be replaced according to requirements, and if the adjacent pixel points are not set before smearing, the preset value is 5 pixel point intervals; the condition can be set according to the complexity of the background color, and a proper range can be selected for smearing the characters, so that the color transition of the background after smearing is more natural. In addition, when the pixel point is read to be the non-protection color (namely the RGB value of the current pixel point is not in the range of the background protection color gamut), once the coverage condition is met, any pixel point RGB value which is adjacent to the current pixel and has the RGB value of the pixel point in the range of the background protection color gamut is obtained according to the preset coverage direction to be used as the RGB value of the coverage point; if the adjacent pixel points do not find the meeting conditions, traversing all the pixel points with the radius of the current pixel point as 5 pixel points until the available RGB value of the background protection color gamut pixel point is found to be used as a replacement.
In this embodiment, for a monochrome marquee, the system will automatically sample and select pixel points directly from the start of the marquee and copy and cover the text pixel points continuously to the end of the marquee with a background block with a preset width of 5 pixels. The system can copy and cover the characters to the end point at any angle from left to right, from right to left, from top to bottom and from bottom to top according to the starting point of the frame selected by the menu color.
The operation of the present invention will be described in detail below.
Firstly, selecting an image to be processed, preliminarily judging a character removing area and a shape of a selecting box to be selected by a user according to elements such as the background color type, character color, character arrangement, background color difference of different areas and the like of the image, setting the background color type of the character removing area to be erased, and setting the pixel width, the pixel coverage direction, the expansion value and the range of adjacent pixels of a background block;
according to the background color type of the selected character area to be erased: if the background is a monochromatic background, selecting the character to be erased through the selecting frame, directly selecting pixel points from the initial position of the selecting frame by the system according to the set covering direction, continuously covering and replacing other pixel points in the end point direction of the selecting frame by a block with the preset pixel width, and outputting and displaying the image coated with the character;
if the background is the gradient color background, selecting characters by using the marquee, starting the system to traverse and obtain RGB color values of all pixel points contained in the marquee, determining a background protection color gamut by the system according to the RGB value of the pixel at the starting point of the marquee and a preset expansion value, and using the principle of replacing adjacent background protection colors when encountering the pixel of a non-background protection color gamut (as a character color gamut): sequentially reading RGB values of the pixel points according to a preset pixel point coverage direction; and if the RGB value of the current pixel point is not in the background protection color gamut range, replacing the RGB value covering the current pixel point by the RGB value of the adjacent pixel point of the current pixel point (traversing the current pixel point serving as the dot center radius and taking the dot center radius as the 5 pixel range, and acquiring the RGB value of the nearest background protection color gamut pixel point according to the preset direction). By analogy, after traversing all the pixel points in the selection frame, the image after the characters are smeared is obtained.
The present embodiment will be described below by way of specific examples.
As shown in fig. 3-4, for the image to be processed in this case, all the text in the image and the line pattern in the right middle area need to be erased, as shown, because the color of the characters and the color of the line patterns are greatly different from the color of the background, the color of the characters and the color of the background have two kinds of contrast, and the layout of the other characters is more regular, for a monochrome background area (for example, the bottommost character part and the white black character part at the upper right corner, since the character is a solid background with a single color, the covering direction does not need to be set), a rectangular marquee is directly drawn on the characters from the upper left to the lower right by using a monochrome marquee, the distance from the left to the characters is ensured to be larger than the preset width of 5 pixels, if the space is less than 5 pixel width, fine tuning the x, y coordinates of the selecting frame or modifying the space width to 1-4 pixel width, so that the system can obtain the character copy and cover of the pure background pattern to the right. This example requires the lines under the text to be preserved so that the left side of the marquee contains background and lines of greater than 5 pixel area, and the end point is also within the line. If the link lines are to be erased together, the pick box may begin picking outside the leftmost line and end outside the line. And for the gradient color background area, setting the pixel point coverage direction from left to right, presetting the expansion value to be-10 (because the background is light-color background and dark characters), setting the background color to be gradient color with relatively changed color, and finishing the setting by acquiring adjacent pixel points and setting the coverage range to be 5 pixels according to default values.
As shown in fig. 5, the characters and line patterns to be erased are selected by setting different parameters and using the selection frame, respectively, and the effect of complete erasing is shown in fig. 5, it can be seen that the line patterns are not erased, the line patterns are erased by resetting the protection color expansion value, because the color of the line patterns is lighter than that of the characters compared with the background color, the expansion value is modified to-2, the RGB boundary value of the background protection color gamut is reduced, and then the line patterns are selected by the selection frame to be erased, as shown in fig. 6, which is the erasing result.
The present invention is not limited to the above-mentioned preferred embodiments, and any structural changes made under the teaching of the present invention shall fall within the protection scope of the present invention, which has the same or similar technical solutions as the present invention.
Claims (9)
1. A method for erasing image and text quickly is characterized by comprising the following steps:
s1, inputting an image to be processed;
s2, judging and selecting the background color type of the character area to be erased, drawing a selection frame to select the characters to be erased;
s3, if the background is a single color background, go to step S4, if the background is a gradient color background, go to step S5;
s4, according to the preset pixel covering direction, the system automatically samples and selects the pixel from the initial position of the selecting frame, continuously copies and covers the character pixel to the terminal direction of the selecting frame by the background block with the preset pixel width, and outputs and displays the processed image;
s5, according to the preset pixel coverage direction, the system takes the RGB value of the pixel at the starting point of the selecting frame plus the preset expansion value as the boundary RGB value of the background protection color gamut, and the RGB value pixel beyond the boundary value is the non-background protection color gamut; when processing characters with light color, background and deep color, the background protection color gamut is from pure white to boundary RGB value; when processing the characters with dark color background and light color, the background protection color gamut is from the boundary RGB value to pure black;
the preset expansion value is set according to the background color of the characters to be erased and the periphery of the corresponding characters in the image judged by the user, if the characters are light-color backgrounds of dark characters, the preset expansion value is set to be not more than 0 by the user, and if the characters are light-color backgrounds of dark characters, the preset expansion value is set to be not less than 0 by the user;
traversing to obtain all RGB pixel points contained in the selection frame; in the traversing process, if the RGB value of the current pixel point is contained in the background protection color gamut, no processing is carried out, and the remaining pixel points are continuously traversed; if the current pixel point is not contained in the background protection color gamut, replacing and covering the current pixel point by using an RGB value pixel point which is adjacent to the current pixel point and belongs to the background protection color gamut; the RGB value of the pixel point after replacement plus a preset expansion value is used as a new boundary RGB value of the background protection color gamut; continuously repeating the steps until all pixel points in the selection frame are traversed, compared and processed; and outputs and displays the processed image.
2. The method for erasing image and text quickly of claim 1, wherein the shape of the pick frame is rectangular or custom multi-frame.
3. The method for erasing image and text quickly as claimed in claim 1, wherein the traversal of the gradient background obtains the RGB color values of all the pixels included in the cull box in a traversal order of from left to right, from right to left, from top to bottom, or from bottom to top.
4. The method for erasing image and text quickly of claim 1, wherein the covering direction includes any angle from left to right, from right to left, from top to bottom or from bottom to top according to the setting.
5. The method for erasing image and text rapidly as claimed in claim 1, wherein the selection of the range of adjacent pixels of the gradient background is set as a pixel with a distance of 1-10 pixel around the pixel to be replaced according to the requirement, and the RGB value of the pixel is in the background protection color gamut.
6. The method for erasing image and text quickly as claimed in claim 1, wherein the spreading value of the gradient background is set to-255, and is counted as 0 if one of the R, G, B values is less than 0 after spreading with a negative value, and is counted as 255 if one of the R, G, B values is greater than 255 after spreading with a positive value.
7. The method for erasing image and text quickly as claimed in claim 1, wherein the range of adjacent pixels of the gradient background is selected to be pixels with a distance of 1-10 pixels around the replaced pixel.
8. The method for erasing image and text quickly of claim 1, wherein the monochrome background is automatically sampled with a background block having a pixel width of 1-300 pixels, and if the frame is rectangular, the height is the height of the rectangle; in the case of a polygonal box, the height is the length from the highest point to the lowest point multiplied by 1.5 times.
9. The method for erasing image and text quickly of claim 1, wherein the predetermined pixel width range is set to 1-10 pixels.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911405784.5A CN111145126B (en) | 2019-12-31 | 2019-12-31 | Image character fast erasing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911405784.5A CN111145126B (en) | 2019-12-31 | 2019-12-31 | Image character fast erasing method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111145126A true CN111145126A (en) | 2020-05-12 |
CN111145126B CN111145126B (en) | 2023-04-07 |
Family
ID=70522804
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911405784.5A Active CN111145126B (en) | 2019-12-31 | 2019-12-31 | Image character fast erasing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111145126B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112258416A (en) * | 2020-10-27 | 2021-01-22 | 维沃移动通信有限公司 | Image processing method and device and electronic equipment |
CN112465931A (en) * | 2020-12-03 | 2021-03-09 | 科大讯飞股份有限公司 | Image text erasing method, related equipment and readable storage medium |
CN112887730A (en) * | 2021-01-21 | 2021-06-01 | 百果园技术(新加坡)有限公司 | Video coding and decoding method and device |
CN114697674A (en) * | 2020-12-30 | 2022-07-01 | 中科寒武纪科技股份有限公司 | Video encoding and decoding methods, related devices, apparatuses and readable storage medium |
CN114841906A (en) * | 2022-05-12 | 2022-08-02 | 北京百度网讯科技有限公司 | Image synthesis method and device, electronic equipment and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002056355A (en) * | 2000-08-08 | 2002-02-20 | Nippon Telegr & Teleph Corp <Ntt> | Character region extracting method, character region extracting device, and recording medium |
EP1574987A2 (en) * | 2004-03-10 | 2005-09-14 | Fujitsu Limited | Character recognition method |
CN103049756A (en) * | 2012-11-16 | 2013-04-17 | 健雄职业技术学院 | Method for automatically extracting and removing words in color image on basis of CEMA (Cellular Message Encryption Algorithm) and texture matching repairing technology |
CN106204424A (en) * | 2016-06-30 | 2016-12-07 | 厦门美图之家科技有限公司 | Image removes water mark method, applies and calculating equipment |
CN108320265A (en) * | 2018-01-31 | 2018-07-24 | 努比亚技术有限公司 | A kind of image processing method, terminal and computer readable storage medium |
CN109255355A (en) * | 2018-05-28 | 2019-01-22 | 北京京东尚科信息技术有限公司 | Image processing method, device, terminal, electronic equipment and computer-readable medium |
CN109447086A (en) * | 2018-09-19 | 2019-03-08 | 浙江口碑网络技术有限公司 | A kind of extracting method and device of picture character color |
-
2019
- 2019-12-31 CN CN201911405784.5A patent/CN111145126B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002056355A (en) * | 2000-08-08 | 2002-02-20 | Nippon Telegr & Teleph Corp <Ntt> | Character region extracting method, character region extracting device, and recording medium |
EP1574987A2 (en) * | 2004-03-10 | 2005-09-14 | Fujitsu Limited | Character recognition method |
CN103049756A (en) * | 2012-11-16 | 2013-04-17 | 健雄职业技术学院 | Method for automatically extracting and removing words in color image on basis of CEMA (Cellular Message Encryption Algorithm) and texture matching repairing technology |
CN106204424A (en) * | 2016-06-30 | 2016-12-07 | 厦门美图之家科技有限公司 | Image removes water mark method, applies and calculating equipment |
CN108320265A (en) * | 2018-01-31 | 2018-07-24 | 努比亚技术有限公司 | A kind of image processing method, terminal and computer readable storage medium |
CN109255355A (en) * | 2018-05-28 | 2019-01-22 | 北京京东尚科信息技术有限公司 | Image processing method, device, terminal, electronic equipment and computer-readable medium |
CN109447086A (en) * | 2018-09-19 | 2019-03-08 | 浙江口碑网络技术有限公司 | A kind of extracting method and device of picture character color |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112258416A (en) * | 2020-10-27 | 2021-01-22 | 维沃移动通信有限公司 | Image processing method and device and electronic equipment |
CN112258416B (en) * | 2020-10-27 | 2024-08-20 | 维沃移动通信有限公司 | Image processing method and device and electronic equipment |
CN112465931A (en) * | 2020-12-03 | 2021-03-09 | 科大讯飞股份有限公司 | Image text erasing method, related equipment and readable storage medium |
CN112465931B (en) * | 2020-12-03 | 2024-05-31 | 科大讯飞股份有限公司 | Image text erasing method, related equipment and readable storage medium |
CN114697674A (en) * | 2020-12-30 | 2022-07-01 | 中科寒武纪科技股份有限公司 | Video encoding and decoding methods, related devices, apparatuses and readable storage medium |
CN112887730A (en) * | 2021-01-21 | 2021-06-01 | 百果园技术(新加坡)有限公司 | Video coding and decoding method and device |
CN114841906A (en) * | 2022-05-12 | 2022-08-02 | 北京百度网讯科技有限公司 | Image synthesis method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111145126B (en) | 2023-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111145126B (en) | Image character fast erasing method | |
EP1056052B1 (en) | User-defined erasure brush for modifying digital image | |
EP1174854B1 (en) | Display equipment, display method, and storage medium storing a display control program using sub-pixels | |
EP1284471B1 (en) | Display equipment, display method, and recording medium for recording display control program | |
EP1962224B1 (en) | Applying traps to a printed page specified in a page description language format | |
EP0786757B1 (en) | Adjusting contrast in antialiasing | |
US20070253640A1 (en) | Image manipulation method and apparatus | |
JP5880767B2 (en) | Region determination apparatus, region determination method, and program | |
US9792695B2 (en) | Image processing apparatus, image processing method, image processing system, and non-transitory computer readable medium | |
US7468732B2 (en) | Character display apparatus and character display method, control program for controlling the character display method and recording medium recording the control program | |
US20060239548A1 (en) | Segmentation of digital images | |
WO2018151043A1 (en) | Image processing method and computer program | |
US5418894A (en) | Coloring of designated image area and pinhole elimination by image scaling | |
US20110187721A1 (en) | Line drawing processing apparatus, storage medium storing a computer-readable program, and line drawing processing method | |
US6665451B1 (en) | Image processing method and apparatus | |
US6496198B1 (en) | Color editing system | |
JP2021167084A (en) | Image processing device, image processing method and program | |
JP2006031688A (en) | Image processing device, method, and program | |
JPH04139589A (en) | Graphic processor | |
JP4084105B2 (en) | Character creation method and character creation program | |
JP2016181111A (en) | Image processing apparatus and image processing program | |
EP1733377B1 (en) | Sub-component based rendering of objects having spatial frequency dominance parallel to the striping direction of the display | |
JP3304381B2 (en) | Image processing device having contour extraction function | |
JP2007300202A (en) | Image processor, its control method and program | |
JP4736489B2 (en) | Image processing device |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |