CN111414877B - Table cutting method for removing color frame, image processing apparatus and storage medium - Google Patents

Table cutting method for removing color frame, image processing apparatus and storage medium Download PDF

Info

Publication number
CN111414877B
CN111414877B CN202010225353.7A CN202010225353A CN111414877B CN 111414877 B CN111414877 B CN 111414877B CN 202010225353 A CN202010225353 A CN 202010225353A CN 111414877 B CN111414877 B CN 111414877B
Authority
CN
China
Prior art keywords
image
frame
tone
outermost
saturation value
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.)
Active
Application number
CN202010225353.7A
Other languages
Chinese (zh)
Other versions
CN111414877A (en
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.)
Telephase Technology Development Beijing Co ltd
Original Assignee
Telephase Technology Development Beijing 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 Telephase Technology Development Beijing Co ltd filed Critical Telephase Technology Development Beijing Co ltd
Priority to CN202010225353.7A priority Critical patent/CN111414877B/en
Publication of CN111414877A publication Critical patent/CN111414877A/en
Application granted granted Critical
Publication of CN111414877B publication Critical patent/CN111414877B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/414Extracting the geometrical structure, e.g. layout tree; Block segmentation, e.g. bounding boxes for graphics or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/412Layout analysis of documents structured with printed lines or input boxes, e.g. business forms or tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/413Classification of content, e.g. text, photographs or tables
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a form cutting method for removing color frames, which comprises the following steps: acquiring an image to be processed, wherein the image to be processed comprises characters to be extracted, the characters to be extracted are positioned in at least one frame, and at least part of the at least one frame has different colors; calculating the tone saturation value of each pixel of the image to be processed to generate a tone saturated image; extracting at least one frame tone saturation value corresponding to at least one frame in the tone saturated image; median filtering is carried out on at least the tone saturation values of the frames, the outermost tone saturation values corresponding to the outermost peripheral frames are reserved, and a single-frame image is generated; edge detection is carried out on the single-side block image, and a binary image is obtained; performing contour detection on the binary image, and cutting the single-side block image according to the detection result to obtain a cut image; and replacing the color of the outermost peripheral frame in the cut image with white to generate an extraction image. By the mode, the working efficiency can be effectively improved, and the image processing device and the storage medium can be used for processing the image.

Description

Table cutting method for removing color frame, image processing apparatus and storage medium
Technical Field
The present invention relates to the field of image processing, and more particularly, to a form cropping method, an image processing apparatus, and a storage medium that remove color borders.
Background
For OCR (Optical Character Recognition) form text extraction, there is a case where a text picture is provided with a color form. The steps of frame filtering, edge detection, contour detection and cutting are needed for cutting the table, and then the table frame can be accurately extracted for the next character recognition preparation.
In the current application of table cutting to color frames, filtering conditions are manually set according to specific colors to remove colors for frames with different colors, so that internal parameters can be modified each time, automatic processing can not be realized, and low working efficiency can be generated.
Disclosure of Invention
The invention mainly solves the technical problem of providing a table cutting method for removing color frames, image processing equipment and a storage medium, which can realize automatic cutting of the table with the color frames removed and effectively improve the working efficiency.
In order to solve the technical problems, the invention adopts a technical scheme that: providing an image to be processed, wherein the image to be processed comprises characters to be extracted, the characters to be extracted are positioned in at least one frame, and at least part of the frames are different in color; calculating the tone saturation value of each pixel of the image to be processed to generate a tone saturated image; extracting at least one frame tone saturation value corresponding to the at least one frame in the tone saturated image; performing median filtering on the at least frame tone saturation values, and reserving the outermost tone saturation values corresponding to the outermost frames to generate a single frame image; performing edge detection on the single-side block image to obtain a binary image; performing contour detection on the binary image, and cutting the single-side block image according to a detection result to obtain a cut image; and replacing the color of the outermost peripheral frame in the cut image with white to generate an extraction image.
Wherein, after the step of extracting the tone saturation value of at least one frame corresponding to the at least one frame in the tone saturated image, the method comprises: and acquiring the lowest value and the highest value of the tone saturation value of the at least one frame, and acquiring the corresponding area of the at least one frame according to the highest value and the lowest value.
The step of performing edge detection on the single-side block image includes: filtering the single-side block image by adopting a Gaussian filter to obtain a filtered image; calculating the gradient size and gradient direction of each pixel point of the filtered image; performing non-maximum suppression on the filtered image to obtain a suppressed image; and determining the edge of the inhibition image by adopting a double-threshold method.
Wherein the difference between the maximum threshold and the minimum threshold in the dual threshold method is greater than 100.
After the step of performing edge detection on the single-side block image, the method includes: acquiring the shortest line length according to the width of the outermost peripheral frame and the line number of the outermost peripheral frame; and adopting statistical probability Hough linear transformation on the image result of the edge detection, wherein the shortest length of the straight line of the statistical probability Hough linear transformation is the shortest line length.
After the step of performing contour detection on the binary image, the method includes: and compressing pixels in the horizontal direction, the vertical direction and the diagonal direction of the result of the contour detection, and only preserving the end point coordinates in the horizontal direction, the vertical direction and the diagonal direction.
The step of cutting the single-side frame image according to the detection result comprises the following steps: and starting from the central points of the rows and columns of the single-frame image, respectively taking squares with equal distances to the left and right for cutting.
In order to solve the technical problems, the invention adopts another technical scheme that: there is provided an image processing apparatus including: the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an image to be processed, the image to be processed comprises characters to be extracted, the characters to be extracted are positioned in at least one frame, and at least part of the frames are different in color; the calculating module is used for calculating the tone saturation value of each pixel of the image to be processed and generating a tone saturated image; the extraction module is used for extracting at least one frame tone saturation value corresponding to the at least one frame in the tone saturation image; the filtering module is used for carrying out median filtering on the at least frame tone saturation values, reserving the outermost tone saturation value corresponding to the outermost frame, and generating a single frame image; the edge module is used for carrying out edge detection on the single-side block image to obtain a binary image; the contour module is used for carrying out contour detection on the binary image, and cutting the single-side block image according to a detection result to obtain a cut image; and the replacing module is used for replacing the color of the outermost peripheral frame in the cut image with white to generate an extracted image.
In order to solve the technical problems, the invention adopts another technical scheme that: there is provided an image processing apparatus including: a processor and a memory, the processor being coupled to the memory, the memory having a computer program stored therein, the processor executing the computer program to implement the method as described above.
In order to solve the technical problems, the invention adopts another technical scheme that: there is provided a computer readable storage medium storing a computer program executable by a processor to implement a method as described above.
The beneficial effects of the invention are as follows: compared with the prior art, the method for introducing the HSV color comparison table automatically identifies the colors corresponding to the comparison table, provides technical support for table cutting for removing color frames, can realize automatic cutting of the table for removing the color frames, and effectively improves the production efficiency.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart illustrating a first embodiment of a method for table cutting for removing color frames according to the present invention;
FIG. 2 is a flowchart illustrating a method for cutting a form with color frames removed according to a second embodiment of the present invention
Fig. 3 is a schematic structural view of a first embodiment of an image processing apparatus provided by the present invention;
fig. 4 is a schematic structural view of a second embodiment of an image processing apparatus provided by the present invention;
fig. 5 is a schematic structural diagram of an embodiment of a computer readable storage medium according to the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a first embodiment of a table clipping method for removing color borders according to the present invention. The table cutting method for removing the color frame provided by the invention comprises the following steps:
s101: and acquiring an image to be processed, wherein the image to be processed comprises characters to be extracted, the characters to be extracted are positioned in at least one frame, and at least part of at least one frame has different colors.
In one particular implementation scenario, an image to be processed is acquired. The image to be processed comprises characters to be extracted, the characters to be extracted are located in at least one frame, and the colors of the at least one frame are different. When extracting the text, the frames with different colors need to be removed so as to realize the extraction of the text contained in at least one frame.
In this embodiment, at least one of the frames has different colors, for example, three frames may have different colors from one frame and the other two frames, or the colors of the three frames may be the same, that is, the color of at least one frame includes at least two colors.
S102: a tone saturation value of each pixel of the image to be processed is calculated, and a tone saturated image is generated.
In one particular implementation scenario, a hue saturation value is calculated for each pixel of the image to be processed. In this implementation scenario, the image to be processed is an RGB image converted into an HSV (Value) image. HSV (Value) is a color space created by a.r.smith in 1978 based on visual properties of colors, also known as the hexagonal pyramid model (hexacone model). The parameters of the color in this model are respectively: hue (H), saturation (S), brightness (V). The hue H is measured by an angle, the value range is 0-360 degrees, the red is 0 degrees, the green is 120 degrees, and the blue is 240 degrees, calculated from the red in the anticlockwise direction. Their complementary colors are: yellow 60 °, cyan 180 °, and magenta 300 °. The saturation S is in the range of 0.0-1.0, and the larger the value is, the more saturated the color is. The brightness V is in the range of 0 (black) to 255 (white). For light source colors, the luminance value is related to the luminance of the illuminant; for object colors, this value is related to the transmittance or reflectance of the object. The RGB color model is hardware-oriented, while the HSV (Hue Saturation Value) color model is user-oriented.
Specifically, the Hue Saturation Value (HSV) value of each pixel is calculated according to the following formula.
R’=R/255
G’=G/255
B’=B/255
C max =max(R’,G’,B’)
C min =min(R’,G’,B’)
△=C max -C min
Figure BDA0002427456500000051
Figure BDA0002427456500000052
V=C max
In the present embodiment, a tone saturation value of each pixel of an image to be processed is calculated, and a tone saturated image is generated. In other embodiments, only the hue saturation value of each pixel of the region corresponding to at least one frame may be calculated to generate a hue saturation image.
S103: at least one frame tone saturation value corresponding to at least one frame in the tone saturated image is extracted.
In this implementation scenario, the HSV lookup table may be obtained from the network. And automatically acquiring HSV values of at least one frame, and comparing the results of mean and variance calculation with a color HSV comparison table to acquire the color which automatically identifies the at least one frame. The application range is suitable for common red, orange, yellow, green, cyan, blue, purple, black, white and gray (color HSV comparison table).
After the HSV value of the image to be processed is obtained, filtering is carried out according to the minimum value and the maximum value of the frame line HSV of at least one frame, and the frame line result of at least one frame is extracted, wherein the minimum value and the maximum value of the frame line HSV of at least one frame are obtained through inquiring an HSV range comparison table with different colors.
S104: and carrying out median filtering on at least the tone saturation values of the frames, and reserving the outermost tone saturation values corresponding to the outermost frames to generate a single-frame image.
In this implementation scenario, the frame line of at least one frame is filtered, and the lines outside the frame line of the outermost frame are filtered, so as to retain the outermost layer. In the implementation scene, a median filtering method is adopted to remove frame lines of frames in the scene, the size step of median filtering is selected to be 19 x 19, and thus the frame lines of the outermost frame are returned to generate a single frame image.
In this implementation scenario, the single-frame image only includes the outermost peripheral frame of the image to be processed and the text to be extracted.
S105: and carrying out edge detection on the single-side block image to obtain a binary image.
In this embodiment, edge detection, for example, canny edge detection, is performed on a single-side frame image to obtain a binary image. More profile information in the single frame image can be removed by edge detection.
S106: and carrying out contour detection on the binary image, and cutting the single-side block image according to the detection result to obtain a cut image.
In this embodiment, a detection mode of contour detection is selected, in this embodiment, only the outer contour of the binary image is selected, and the single-side frame image is cut according to the result of contour detection, thereby obtaining a cut image. According to the above description, the cut image includes a border at the outermost periphery and the text to be extracted in the border at the outermost periphery, and the border at the outermost periphery has a color.
S107: and replacing the color of the outermost peripheral frame in the cut image with white to generate an extraction image.
In the implementation scene, the color of the outermost border in the cut image is obtained, the color is replaced by white, an extraction image is generated, at the moment, the extraction image only comprises the characters to be extracted, and the characters to be extracted can be obtained by performing the character extraction operation on the extraction image. The method for extracting the characters in the image can be a method for extracting the characters in the image in the prior art, and will not be described here again.
As can be seen from the above description, in this embodiment, the tone saturation value of each pixel of the image to be processed is calculated, a tone saturated image is generated, and at least one frame tone saturation value corresponding to at least one frame in the tone saturated image is extracted; the color of at least one frame can be automatically obtained, the outermost tone saturation value corresponding to the outermost frame is reserved, and other frames except the outermost frame are deleted to generate a single-frame image; the color of the outermost peripheral frame is replaced by white, an extraction image is generated, automatic extraction of characters to be extracted in the image with at least one frame with different colors can be realized, and the work efficiency of character extraction can be effectively improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating a table cutting method for color frames according to a second embodiment of the present invention. The table cutting method of the color frame provided by the invention comprises the following steps:
s201: and acquiring an image to be processed, wherein the image to be processed comprises characters to be extracted, the characters to be extracted are positioned in at least one frame, and at least part of at least one frame has different colors.
S202: a tone saturation value of each pixel of the image to be processed is calculated, and a tone saturated image is generated.
S203: at least one frame tone saturation value corresponding to at least one frame in the tone saturated image is extracted.
In a specific implementation scenario, steps S201 to S203 are substantially identical to steps S101 to S103 in the first embodiment of the method for cutting a table for removing a color border provided in the present invention, and will not be described herein.
S204: and acquiring the lowest value and the highest value of the tone saturation value of at least one frame, and acquiring the corresponding region of at least one frame according to the highest value and the lowest value.
In this embodiment scenario, after obtaining the hue saturation value of at least one frame, the highest value and the lowest value in the hue saturation value are obtained, and the corresponding region of at least one frame is obtained according to the highest value and the lowest value. Specifically, the corresponding region of each wire or the corresponding regions of all wires may be acquired.
S205: and carrying out median filtering on at least the tone saturation values of the frames, and reserving the outermost tone saturation values corresponding to the outermost frames to generate a single-frame image.
In a specific implementation scenario, step S205 is substantially identical to step S104 in the first embodiment of the method for cutting a table for removing a color border provided in the present invention, and will not be described herein.
S206: and filtering the single-side block image by adopting a Gaussian filter to obtain a filtered image.
In this implementation scenario, a gaussian filter is used to filter the single-sided block image. Gaussian filtering is a linear smoothing filtering, is suitable for eliminating Gaussian noise, and is widely applied to a noise reduction process of image processing. In popular terms, gaussian filtering is a process of weighted averaging over the entire image, where the value of each pixel is obtained by weighted averaging itself and other pixel values in the neighborhood. The specific operations of gaussian filtering are: each pixel in the image is scanned with a template (or convolution, mask), and the value of the center pixel point of the template is replaced with the weighted average gray value of the pixels in the neighborhood determined by the template. The Gaussian noise in the filtered image obtained by Gaussian filtering is effectively reduced, and the image quality of the subsequently obtained frontal binary image can be effectively improved.
S207: and calculating the gradient size and gradient direction of each pixel point of the filtered image.
In this implementation scenario, the gradient magnitude and gradient direction of each pixel point of the image are calculated, mainly to capture contour information, and meanwhile, the interference of illumination is further weakened, and more noise is removed before the subsequent binarization operation.
Since the image is stored in the computer in the form of a digital image, i.e. the image is a discrete digital signal, the gradients of the digital image are differentiated using differences instead of differences in the continuous signal. Common gradients include Roberts gradients, sobel gradients, prewitt gradients, laplacian gradients, and the like.
For example, using Sobel gradient, the gradient of the image function f (x, y) at the point (x, y) is a vector having a magnitude and a direction, set G x And G y Representing the gradients in the x-direction and y-direction, respectively, can be used to first calculate G by the Sobel operator x 、G y Then, the gradient angle θ=arctan (G y /G x ) The gradient direction and the direction of increasing the image gray scale, wherein the gradient included angle of the gradient direction is larger than the gradient included angle of the flat area.
S208: and performing non-maximum suppression on the filtered image to obtain a suppressed image.
In the present embodiment, the local maximum value of the search is suppressed by the non-maximum value based on the gradient value (including the gradient magnitude and the gradient direction) of each pixel obtained in step S207, and the maximum value in the filtered image is suppressed.
S209: the edges of the suppressed image are determined using a double thresholding method.
In the implementation scene, the pixel points of the edge obtained by adopting the double-threshold method have good noise resistance, and the edge is continuous and meanwhile the edge accuracy is ensured. The dual threshold selection uses a difference between the maximum and minimum thresholds greater than 100, so that much profile information can be removed.
S210: and acquiring the shortest line length according to the width of the outermost peripheral frame and the line number of the outermost peripheral frame.
In this implementation scenario, the shortest line length is obtained by dividing the width of the outermost peripheral frame by the number of lines of the outermost peripheral frame.
S211: and adopting statistical probability Hough linear transformation on an image result of edge detection, wherein the shortest length of a line of the statistical probability Hough linear transformation is the shortest line length.
In the implementation scene, the statistical probability Hough straight line transformation is Hough line transformation with higher execution efficiency, and the method for searching the straight line is used for outputting the end point of the detected straight line, and the outermost peripheral frame on the suppressed image can be accurately obtained by adopting the statistical probability Hough straight line transformation on the image result (namely the suppressed image) of edge detection. The shortest length of the straight line needs to be set when the statistical probability Hough straight line transformation is performed. In this embodiment, the shortest length of the straight line is set to the value of the width of the outermost peripheral frame divided by the number of lines, so that the shortest line length is obtained, and the line below this length is ignored.
S212: and performing contour detection on the binary image.
In a specific implementation scenario, step S212 is substantially identical to step S106 in the first embodiment of the method for cutting a table for removing a color border provided in the present invention, and will not be described herein.
S213: the pixels in the horizontal direction, the vertical direction, and the diagonal direction as a result of the compression contour detection remain only the end coordinates in the horizontal direction, the vertical direction, and the diagonal direction.
In the present embodiment, pixels in the horizontal direction, the vertical direction, and the diagonal direction of the result of the compressed contour detection (i.e., the suppressed image) remain only the end point coordinates in the horizontal direction, the vertical direction, and the diagonal direction. Blank parts in the inhibition image or other parts of the area of the outermost periphery wire frame column can be effectively removed.
S214: and starting from the central points of the rows and columns of the unilateral block image, respectively taking squares with equal distances to the left and right for cutting, and obtaining a cutting image.
In this implementation scenario, cropping the picture may be accomplished through an array slicing operation. And (5) starting from the central points of the rows and the columns, respectively taking squares with equal distances to the left and the right for cutting, and obtaining a cutting image. In other implementations, it may be rectangular or other graphics. From the central points of the rows and the columns, squares with equal distances are respectively taken leftwards and rightwards to be cut, so that the problem that the result error of the subsequent text extraction is caused by cutting off the partial area comprising the text to be extracted can be effectively avoided.
S215: and replacing the color of the outermost peripheral frame in the cut image with white to generate an extraction image.
In a specific implementation scenario, step S212 is substantially identical to step S107 in the first embodiment of the method for cutting a table for removing a color border provided in the present invention, and will not be described herein.
As can be seen from the above description, in this embodiment, the difference between the maximum threshold and the minimum threshold is greater than 100, and only the end coordinates in the horizontal direction, the vertical direction and the diagonal direction are reserved, so that redundant information can be effectively removed, and the accuracy of text extraction is improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a first embodiment of an image processing apparatus according to the present invention. The image processing apparatus includes: the device comprises an acquisition module 11, a calculation module 12, an extraction module 13, a filtering module 14, an edge module 15, a contour module 16 and a replacement module 17. The obtaining module 11 is configured to obtain an image to be processed, where the image to be processed includes text to be extracted, the text to be extracted is located in at least one frame, and at least some of the at least one frame has different colors. The calculation module 12 is configured to calculate a tone saturation value of each pixel of the image to be processed, and generate a tone saturated image. The extracting module 13 is configured to extract at least one frame tone saturation value corresponding to at least one frame in the tone saturated image. The filtering module 14 is configured to median filter at least the frame tone saturation values, and retain the outermost tone saturation value corresponding to the outermost frame, so as to generate a single frame image. The edge module 15 is used for performing edge detection on the single-side block image to obtain a binary image. The contour module 16 is used for performing contour detection on the binary image, and cutting the single-side block image according to the detection result to obtain a cut image. The replacing module 17 is configured to replace the color of the outermost border in the cropped image with white, and generate an extracted image.
The extracting module 13 is further configured to obtain a minimum value and a maximum value of the at least one frame tone saturation value, and obtain a corresponding region of the at least one frame according to the maximum value and the minimum value.
The edge module 15 is further used for filtering the single-side block image by adopting a gaussian filter to obtain a filtered image; calculating the gradient size and gradient direction of each pixel point of the filtered image; performing non-maximum suppression on the filtered image to obtain a suppressed image; the edges of the suppressed image are determined using a double thresholding method.
Wherein the difference between the maximum threshold and the minimum threshold in the dual threshold method is greater than 100.
The edge module 15 is further configured to obtain a shortest line length according to the width of the outermost peripheral frame and the number of lines of the outermost peripheral frame; and adopting statistical probability Hough linear transformation on an image result of edge detection, wherein the shortest length of a line of the statistical probability Hough linear transformation is the shortest line length.
The contour module 16 is used to compress the resulting horizontal, vertical and diagonal pixels of the contour detection, leaving only the end coordinates of the horizontal, vertical and diagonal directions.
The outline module 16 is also used to cut squares equidistant to the left and right, respectively, starting from the center points of the rows and columns of the single-sided frame image.
As is clear from the above description, in the present embodiment, the image processing apparatus calculates a tone saturation value of each pixel of an image to be processed, extracts at least one frame tone saturation value corresponding to at least one frame; the color of at least one frame can be automatically obtained, the outermost tone saturation value corresponding to the outermost frame is reserved, other frames except the outermost frame are deleted, the color of the outermost frame is replaced by white, an extraction image is generated, automatic extraction of characters to be extracted in the image with at least one frame with different colors can be realized, and the work efficiency of character extraction can be effectively improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a second embodiment of an image processing apparatus according to the present invention, and the image processing apparatus 20 includes a processor 21 and a memory 22. The processor 21 is coupled to the memory 22. The memory 22 has stored therein a computer program which is executed by the processor 21 in operation to implement the method as shown in fig. 1-3. The detailed method can be referred to above, and will not be described here.
As is clear from the above description, in the present embodiment, the image processing apparatus calculates a tone saturation value of each pixel of an image to be processed, extracts at least one frame tone saturation value corresponding to at least one frame; the color of at least one frame can be automatically obtained, the outermost tone saturation value corresponding to the outermost frame is reserved, other frames except the outermost frame are deleted, the color of the outermost frame is replaced by white, an extraction image is generated, automatic extraction of characters to be extracted in the image with at least one frame with different colors can be realized, and the work efficiency of character extraction can be effectively improved.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an embodiment of a computer readable storage medium according to the present invention. The computer readable storage medium 30 stores at least one computer program 31, and the computer program 31 is configured to be executed by a processor to implement the method shown in fig. 1-3, and the detailed method is referred to above and will not be repeated herein. In one embodiment, the computer readable storage medium 30 may be a memory chip, a hard disk or a removable hard disk in a terminal, or other readable and writable storage means such as a flash disk, an optical disk, etc., and may also be a server, etc.
As is apparent from the above description, the computer program in the computer-readable storage medium in this embodiment can be used to calculate the tone saturation value of each pixel of the image to be processed, extract at least one frame tone saturation value corresponding to at least one frame; the color of at least one frame can be automatically obtained, the outermost tone saturation value corresponding to the outermost frame is reserved, other frames except the outermost frame are deleted, the color of the outermost frame is replaced by white, an extraction image is generated, automatic extraction of characters to be extracted in the image with at least one frame with different colors can be realized, and the work efficiency of character extraction can be effectively improved.
Compared with the prior art, the method for introducing the HSV color comparison table automatically identifies the colors corresponding to the comparison table, provides technical support for table cutting for removing color frames, can realize automatic cutting of the table for removing the color frames, and effectively improves the production efficiency.
The foregoing is only the embodiments of the present invention, and therefore, the patent scope of the invention is not limited thereto, and all equivalent structures or equivalent processes using the descriptions of the present invention and the accompanying drawings, or direct or indirect application in other related technical fields, are included in the scope of the invention.

Claims (9)

1. A form cutting method for removing color borders, comprising:
acquiring an image to be processed, wherein the image to be processed comprises characters to be extracted, the characters to be extracted are positioned in at least one frame, and at least part of the at least one frame have different colors;
calculating the tone saturation value of each pixel of the image to be processed to generate a tone saturated image;
extracting at least one frame tone saturation value corresponding to the at least one frame in the tone saturated image;
performing median filtering on the at least one frame tone saturation value, and reserving the outermost tone saturation value corresponding to the outermost frame to generate a single frame image;
performing edge detection on the single-side block image to obtain a binary image;
after the step of performing edge detection on the single-side block image, the method comprises the following steps: acquiring the shortest line length according to the width of the outermost peripheral frame and the line number of the outermost peripheral frame;
adopting statistical probability Hough linear transformation on the image result of the edge detection, wherein the shortest length of the straight line of the statistical probability Hough linear transformation is the shortest line length;
performing contour detection on the binary image, and cutting the single-side block image according to a detection result to obtain a cut image;
and replacing the color of the outermost peripheral frame in the cut image with white to generate an extraction image.
2. The method of claim 1, wherein after the step of extracting at least one frame hue saturation value corresponding to the at least one frame in the hue saturation image, comprising:
and acquiring the lowest value and the highest value of the tone saturation value of the at least one frame, and acquiring the corresponding area of the at least one frame according to the highest value and the lowest value.
3. The method of claim 1, wherein the step of edge detecting the single-sided frame image comprises:
filtering the single-side block image by adopting a Gaussian filter to obtain a filtered image;
calculating the gradient size and gradient direction of each pixel point of the filtered image;
performing non-maximum suppression on the filtered image to obtain a suppressed image;
and determining the edge of the inhibition image by adopting a double-threshold method.
4. A method according to claim 3, wherein the difference between the maximum and minimum thresholds in the dual threshold method is greater than 100.
5. The method of claim 1, wherein after the step of contour detecting the binary image, comprising:
and compressing pixels in the horizontal direction, the vertical direction and the diagonal direction of the result of the contour detection, and only preserving the end point coordinates in the horizontal direction, the vertical direction and the diagonal direction.
6. The method according to claim 1, wherein the step of cutting the single-sided frame image according to the detection result includes:
and starting from the central points of the rows and columns of the single-frame image, respectively taking squares with equal distances to the left and right for cutting.
7. An image processing apparatus, characterized by comprising:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring an image to be processed, the image to be processed comprises characters to be extracted, the characters to be extracted are positioned in at least one frame, and at least part of the frames are different in color;
the calculating module is used for calculating the tone saturation value of each pixel of the image to be processed and generating a tone saturated image;
the extraction module is used for extracting at least one frame tone saturation value corresponding to the at least one frame in the tone saturation image;
the filtering module is used for carrying out median filtering on the tone saturation value of the at least one frame, reserving the outermost tone saturation value corresponding to the outermost frame and generating a single-frame image;
the edge module is used for carrying out edge detection on the single-side block image to obtain a binary image;
after the step of performing edge detection on the single-side block image, the method comprises the following steps: acquiring the shortest line length according to the width of the outermost peripheral frame and the line number of the outermost peripheral frame;
adopting statistical probability Hough linear transformation on the image result of the edge detection, wherein the shortest length of the straight line of the statistical probability Hough linear transformation is the shortest line length;
the contour module is used for carrying out contour detection on the binary image, and cutting the single-side block image according to a detection result to obtain a cut image;
and the replacing module is used for replacing the color of the outermost peripheral frame in the cut image with white to generate an extracted image.
8. An image processing apparatus, characterized by comprising: a processor and a memory, the processor being coupled to the memory, the memory having a computer program stored therein, the processor executing the computer program to implement the method of any of claims 1-6.
9. A computer readable storage medium, characterized in that a computer program is stored, which computer program is executable by a processor to implement the method of any one of claims 1-6.
CN202010225353.7A 2020-03-26 2020-03-26 Table cutting method for removing color frame, image processing apparatus and storage medium Active CN111414877B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010225353.7A CN111414877B (en) 2020-03-26 2020-03-26 Table cutting method for removing color frame, image processing apparatus and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010225353.7A CN111414877B (en) 2020-03-26 2020-03-26 Table cutting method for removing color frame, image processing apparatus and storage medium

Publications (2)

Publication Number Publication Date
CN111414877A CN111414877A (en) 2020-07-14
CN111414877B true CN111414877B (en) 2023-06-20

Family

ID=71491498

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010225353.7A Active CN111414877B (en) 2020-03-26 2020-03-26 Table cutting method for removing color frame, image processing apparatus and storage medium

Country Status (1)

Country Link
CN (1) CN111414877B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113223041B (en) * 2021-06-25 2024-01-12 上海添音生物科技有限公司 Method, system and storage medium for automatically extracting target area in image
CN117935296B (en) * 2024-02-06 2024-06-04 广东度才子集团有限公司 Employment quality report generation system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000357237A (en) * 1999-04-12 2000-12-26 Minolta Co Ltd Image processor, image reading device and image forming device mounted with the processor, image processing method, and computer-readable storage medium stored with image processing procedure
JP2001268383A (en) * 2000-03-23 2001-09-28 Ricoh Co Ltd Image processing apparatus, image reading device, image forming device and color copying device
CN101515325A (en) * 2009-04-08 2009-08-26 北京邮电大学 Character extracting method in digital video based on character segmentation and color cluster
CN102968782A (en) * 2012-09-12 2013-03-13 苏州大学 Automatic digging method for remarkable objects of color images
CN109327646A (en) * 2017-08-01 2019-02-12 佳能株式会社 Image processing apparatus, image processing method and computer readable storage medium
CN110599552A (en) * 2019-08-30 2019-12-20 杭州电子科技大学 pH test paper detection method based on computer vision

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000357237A (en) * 1999-04-12 2000-12-26 Minolta Co Ltd Image processor, image reading device and image forming device mounted with the processor, image processing method, and computer-readable storage medium stored with image processing procedure
JP2001268383A (en) * 2000-03-23 2001-09-28 Ricoh Co Ltd Image processing apparatus, image reading device, image forming device and color copying device
CN101515325A (en) * 2009-04-08 2009-08-26 北京邮电大学 Character extracting method in digital video based on character segmentation and color cluster
CN102968782A (en) * 2012-09-12 2013-03-13 苏州大学 Automatic digging method for remarkable objects of color images
CN109327646A (en) * 2017-08-01 2019-02-12 佳能株式会社 Image processing apparatus, image processing method and computer readable storage medium
CN110599552A (en) * 2019-08-30 2019-12-20 杭州电子科技大学 pH test paper detection method based on computer vision

Also Published As

Publication number Publication date
CN111414877A (en) 2020-07-14

Similar Documents

Publication Publication Date Title
CN110008954B (en) Complex background text image extraction method and system based on multi-threshold fusion
CN111260616A (en) Insulator crack detection method based on Canny operator two-dimensional threshold segmentation optimization
CN109544583B (en) Method, device and equipment for extracting interested area of leather image
CN112887693B (en) Image purple border elimination method, equipment and storage medium
IES20060564A2 (en) Improved foreground / background separation
WO2013143390A1 (en) Face calibration method and system, and computer storage medium
CN102800094A (en) Fast color image segmentation method
JP5974589B2 (en) Image processing apparatus and program
CN110930321A (en) Blue/green screen digital image matting method capable of automatically selecting target area
CN107256539B (en) Image sharpening method based on local contrast
CN111414877B (en) Table cutting method for removing color frame, image processing apparatus and storage medium
US20140140620A1 (en) Image processing apparatus, image processing method and computer readable medium
CN104361335B (en) A kind of processing method that black surround is automatically removed based on scan image
CN112508024A (en) Intelligent identification method for embossed seal font of electrical nameplate of transformer
JP3814353B2 (en) Image segmentation method and image segmentation apparatus
CN115272362A (en) Method and device for segmenting effective area of digital pathology full-field image
CN108205678B (en) Nameplate character recognition processing method containing bright spot interference
CN113610091A (en) Intelligent identification method and device for air switch state and storage medium
CN110807747B (en) Document image noise reduction method based on foreground mask
CN110458012B (en) Multi-angle face recognition method and device, storage medium and terminal
WO2024016791A1 (en) Method and apparatus for processing graphic symbol, and computer-readable storage medium
CN108133204B (en) Hand body identification method, device, equipment and computer readable storage medium
CN107481253B (en) Edge-based spot detection method
JPH1125222A (en) Method and device for segmenting character
CN112528741B (en) State identification method and device for transformer substation pressure plate

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