CN111414877A - Table clipping method of removing color borders, image processing apparatus, and storage medium - Google Patents

Table clipping method of removing color borders, image processing apparatus, and storage medium Download PDF

Info

Publication number
CN111414877A
CN111414877A CN202010225353.7A CN202010225353A CN111414877A CN 111414877 A CN111414877 A CN 111414877A CN 202010225353 A CN202010225353 A CN 202010225353A CN 111414877 A CN111414877 A CN 111414877A
Authority
CN
China
Prior art keywords
image
frame
outermost
border
hue saturation
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
Application number
CN202010225353.7A
Other languages
Chinese (zh)
Other versions
CN111414877B (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 the colors of at least part of at least one frame are different; calculating a hue saturation value of each pixel of the image to be processed to generate a hue saturation image; extracting at least one frame tone saturation value corresponding to at least one frame in the tone saturated image; performing median filtering on at least the border hue saturation values, reserving the outermost hue saturation value corresponding to the outermost border, and generating a single-border image; carrying out edge detection on the single-side frame image to obtain a binary image; carrying out contour detection on the binary image, and cutting the image of the single-side frame according to a detection result to obtain a cut image; the color of the outermost peripheral border in the cropped image is replaced with white, generating an extracted image. By the mode, the working efficiency, the image processing equipment and the storage medium can be effectively improved.

Description

Table clipping method of removing color borders, image processing apparatus, and storage medium
Technical Field
The present invention relates to the field of image processing, and more particularly, to a form trimming method for removing a color border, an image processing apparatus, and a storage medium.
Background
For OCR (Optical Character Recognition) table text extraction, there is a case where a text picture is provided with a color table. The table is cut by the steps of frame filtering, edge detection, outline detection and cutting, and then the table frame can be accurately extracted to prepare for the next character recognition.
In the application of cutting the form of the color frame at present, for the frames with different colors, the filtering conditions are manually set according to specific colors, the colors are removed, so that the internal parameters can be modified at each time, the automatic processing cannot be realized, and the 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 borders, image processing equipment and a storage medium, which can realize automatic cutting of the table from which the color borders are 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 the colors of at least part of the at least one frame are different; calculating the hue saturation value of each pixel of the image to be processed to generate a hue saturation image; extracting at least one border hue saturation value corresponding to the at least one border in the hue saturation image; performing median filtering on the at least frame tone saturation value, reserving the outermost tone saturation value corresponding to the outermost frame, and generating a single-frame image; performing edge detection on the single frame image to obtain a binary image; carrying out contour detection on the binary image, and cutting the single-frame image according to a detection result to obtain a cut image; and replacing the color of the outermost peripheral frame in the cropped image with white to generate an extracted image.
Wherein, after the step of extracting at least one border hue saturation value corresponding to the at least one border in the hue saturation image, the method comprises: and acquiring the lowest value and the highest value of the hue 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.
Wherein the step of performing edge detection on the single frame image includes: filtering the single frame image by adopting a Gaussian filter to obtain a filtered image; calculating the gradient size and gradient direction of each pixel point of the filtering image; carrying out non-maximum suppression on the filtered image to obtain a suppressed image; and determining the edge of the suppressed 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 frame image, the method includes: obtaining the shortest line length according to the width of the outermost frame and the number of rows of the outermost frame; and adopting statistical probability Hough line transformation on the image result of the edge detection, wherein the shortest length of the line of the statistical probability Hough line transformation is the shortest line length.
Wherein, after the step of performing contour detection on the binary image, the method comprises: and compressing the pixels in the horizontal direction, the vertical direction and the diagonal direction of the contour detection result, and only keeping the end point coordinates in the horizontal direction, the vertical direction and the diagonal direction.
Wherein, the step of cutting the single frame image according to the detection result comprises: and cutting squares with equal distances from the center point of the row and the column of the single frame image to the left and the right.
In order to solve the technical problem, the invention adopts another technical scheme that: provided is 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 at least one frame has different colors; the calculation module is used for calculating the hue saturation value of each pixel of the image to be processed to generate a hue saturation image; the extraction module is used for extracting at least one border hue saturation value corresponding to the at least one border in the hue 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-frame image to obtain a binary image; the contour module is used for carrying out contour detection on the binary image and cutting the single-frame image according to a detection result to obtain a cut image; a replacement module to replace a color of the outermost border in the cropped image with white to generate an extracted image.
In order to solve the technical problem, the invention adopts another technical scheme that: provided is an image processing apparatus including: a processor coupled to the memory and a 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 problem, 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 the method as described above.
The invention has the beneficial effects that: different from the situation of the prior art, the method introduces the HSV color comparison table method, automatically identifies the corresponding color of the comparison table, provides technical support for cutting the table with the color frame removed, can realize automatic cutting of the table with the color frame removed, and effectively improves the working efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart illustrating a table cropping method for removing color borders according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating a table cropping method for removing color borders according to a second embodiment of the present invention
Fig. 3 is a schematic structural diagram of a first embodiment of an image processing apparatus provided by the present invention;
fig. 4 is a schematic structural diagram 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 provided by the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a table trimming method for removing color borders according to a first embodiment of the present invention. The table cutting method for removing the color frame provided by the invention comprises the following steps:
s101: the method comprises the steps of obtaining an image to be processed, wherein the image to be processed comprises characters to be extracted, the characters of the characters to be extracted are located in at least one frame, and at least part of the frames are different in color.
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 positioned in at least one frame, and the color of the at least one frame is different. When extracting the characters, the borders with different colors need to be removed to extract the characters contained in at least one border.
In this implementation scenario, at least one of the frames has different colors, for example, three frames have different colors, which may be that the color of one frame is different from the colors of the other two frames, or the colors of the three frames are the same, that is, the color of at least one frame includes at least two colors.
S102: and calculating the hue saturation value of each pixel of the image to be processed to generate a hue saturation image.
In a particular implementation scenario, the hue saturation value of each pixel of the image to be processed is calculated. In the present implementation scenario, the image to be processed is an RGB image and is converted into an HSV (Hue, Saturation) image. HSV (Hue, Saturation) is a color space created by a.r. smith in 1978, also known as the hexagonal cone model (HexconeModel), based on the intuitive nature of color. The parameters of the colors in this model are: hue (H), saturation (S), brightness (V). The hue H is measured by the 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 is 60 °, cyan is 180 °, and magenta is 300 °. And the saturation S is in a value range of 0.0-1.0, and the larger the value is, the more saturated the color is. The luminance V ranges from 0 (black) to 255 (white). For a source color, 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 validation value) color model is user-oriented.
Specifically, a Hue Saturation Value (HSV) value of each pixel is calculated according to the following formula.
R’=R/255
G’=G/255
B’=B/255
Cmax=max(R’,G’,B’)
Cmin=min(R’,G’,B’)
△=Cmax-Cmin
Figure BDA0002427456500000051
Figure BDA0002427456500000052
V=Cmax
In the present implementation scenario, a hue saturation value of each pixel of the image to be processed is calculated, and a hue saturated image is generated. In another implementation scenario, the hue saturation value of each pixel in the region corresponding to at least one frame may be calculated to generate a hue saturated image.
S103: and extracting at least one frame tone saturation value corresponding to at least one frame in the tone saturated image.
In this implementation scenario, the HSV lookup table may be obtained from the network. And automatically acquiring HSV values of at least one frame, comparing a color HSV comparison table according to the result of the calculation of the mean value and the variance, and acquiring which color the at least one frame is automatically identified. The application range is suitable for common red, orange, yellow, green, cyan, blue, purple, black, white and gray (color HSV comparison table).
After obtaining the HSV value of the image to be processed, filtering according to the HSV minimum value and the HSV maximum value of at least one frame, and extracting the frame line result of at least one frame, wherein the HSV minimum value and the HSV maximum value of at least one frame are obtained by inquiring HSV range comparison tables with different colors.
S104: and performing median filtering on at least the frame hue saturation values, reserving the outermost hue saturation value corresponding to the outermost frame, and generating a single-frame image.
In the implementation scenario, filtering is performed on the frame line of at least one frame, lines other than the frame line of the outermost frame are filtered, and the outermost layer is reserved. In the implementation scenario, a median filtering method is adopted to remove the frame lines of the inner frame, and the size step of the median filtering is selected to be 19 × 19, so that the frame lines of the outermost frame are returned to generate a single-frame image.
In the present implementation scenario, the single-frame image includes only the outermost frame of the image to be processed and the text to be extracted.
S105: and carrying out edge detection on the single-side frame image to obtain a binary image.
In the implementation scenario, edge detection, such as Canny edge detection, is performed on the single-sided frame image to obtain a binary image. More contour 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 image of the single-side frame according to a detection result to obtain a cut image.
In this implementation scenario, a detection mode of contour detection is selected, in this embodiment, only the outer contour of the binary image is selected to be detected, and the single-sided frame image is cropped according to the result of contour detection to obtain a cropped image. According to the above description, the cropped image includes the outermost border and the text to be extracted in the outermost border, and the outermost border has a color.
S107: the color of the outermost peripheral border in the cropped image is replaced with white, generating an extracted image.
In the implementation scenario, the color of the outermost border in the cropped image is obtained, the color is replaced by white, an extracted image is generated, at this time, only the characters to be extracted are included in the extracted image, and the characters to be extracted can be obtained by performing character extraction operation on the extracted image. The method for extracting the characters in the image can adopt a method for extracting the characters in the image in the prior art, and the details are not repeated here.
As can be seen from the above description, in the present embodiment, a hue saturation value of each pixel of the image to be processed is calculated, a hue saturation image is generated, and at least one border hue saturation value corresponding to at least one border in the hue saturation image is extracted; the color of at least one frame can be automatically acquired, the outermost hue 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 border is replaced by white to generate the extracted image, so that the automatic extraction of the characters to be extracted in the image with at least one border 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 trimming method for color borders according to a second embodiment of the present invention. The invention provides a form cutting method of a color frame, which comprises the following steps:
s201: the method comprises the steps of obtaining an image to be processed, wherein the image to be processed comprises characters to be extracted, the characters of the characters to be extracted are located in at least one frame, and at least part of the frames are different in color.
S202: and calculating the hue saturation value of each pixel of the image to be processed to generate a hue saturation image.
S203: and extracting at least one frame tone saturation value corresponding to at least one frame in the tone saturated image.
In a specific implementation scenario, steps S201 to S203 are substantially the same as steps S101 to S103 in the first embodiment of the table cropping method for removing color borders provided by the present invention, and are not described herein again.
S204: and acquiring the lowest value and the highest value of the hue saturation value of at least one frame, and acquiring the corresponding area of at least one frame according to the highest value and the lowest value.
In the implementation scenario, after the hue saturation value of at least one frame is obtained, the highest value and the lowest value are obtained, and the corresponding area of the at least one frame is obtained according to the highest value and the lowest value. In particular, a corresponding area of each of the frame lines, or of all of the frame lines, can be obtained.
S205: and performing median filtering on at least the frame hue saturation values, reserving the outermost hue saturation value corresponding to the outermost frame, and generating a single-frame image.
In a specific implementation scenario, step S205 is substantially the same as step S104 in the first embodiment of the table cropping method for removing color borders provided by the present invention, and details thereof are not repeated here.
S206: and filtering the single-side frame image by adopting a Gaussian filter to obtain a filtered image.
In the present implementation scenario, a gaussian filter is used to filter the single-sided frame image. The gaussian filtering is a linear smooth filtering, is suitable for eliminating gaussian noise, and is widely applied to a noise reduction process of image processing. Generally speaking, gaussian filtering is a process of performing weighted average on the whole image, and the value of each pixel point is obtained by performing weighted average on the value of each pixel point and other pixel values in the neighborhood. The specific operation of gaussian filtering is: each pixel in the image is scanned using a template (or convolution, mask), and the weighted average gray value of the pixels in the neighborhood determined by the template is used to replace the value of the pixel in the center of the template. Gaussian noise in the filtered image obtained through Gaussian filtering can be effectively reduced, and the image quality of the subsequently obtained binary image can be effectively improved.
S207: and calculating the gradient size and the gradient direction of each pixel point of the filtering image.
In the implementation scene, the gradient size and the gradient direction of each pixel point of the image are calculated, mainly for capturing contour information, further weakening the interference of illumination, and removing more noise 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 instead of differentiated in a continuous signal common gradients include Roberts gradients, Sobel gradients, Prewitt gradients, L aplarian gradients, and so on.
For example, using a Sobel gradient, the gradient of the image function f (x, y) at point (x, y) is a vector having a magnitude and a direction, let GxAnd GyRespectively representing the gradients in the x direction and the y direction, and firstly calculating G by using a Sobel operatorx、GyThen, the gradient angle θ is calculated as arctan (G)y/Gx) The gradient direction and the direction of increasing the image gray scale, wherein the gradient included angle in the gradient direction is larger than that in the flat area.
S208: and carrying out non-maximum suppression on the filtered image to obtain a suppressed image.
In this implementation scenario, based on the gradient values (including the gradient magnitude and the gradient direction) of each pixel acquired in step S207, the local maximum of the search is suppressed by the non-maximum, and the maximum in the filtered image is suppressed.
S209: and determining the edge of the suppressed image by adopting a dual-threshold method.
In the implementation scene, the noise immunity of the edge pixel points obtained by adopting the dual-threshold method is good, and the edge is continuous while the edge accuracy is ensured. The dual threshold selection uses a difference between the maximum threshold and the minimum threshold of greater than 100, which can eliminate much of the contour information.
S210: and obtaining the shortest line length according to the width of the outermost frame and the line number of the outermost frame.
In this implementation scenario, the shortest line length is obtained by dividing the width of the outermost border by the number of rows of the outermost border.
S211: and (3) adopting statistical probability Hough line transformation on an image result of edge detection, wherein the shortest length of a straight line of the statistical probability Hough line transformation is the shortest line length.
The statistical probability Hough line transformation is the Hough line transformation which is more efficient to execute in the implementation scene, the method for outputting the end points of the detected straight line is a method for finding the straight line, and the outermost border on the suppressed image can be accurately obtained by adopting the statistical probability Hough line transformation on the image result (namely the suppressed image) of the edge detection. The shortest length of the straight line needs to be set when the statistical probability Hough straight line transformation is carried out. In the present implementation scenario, the shortest length of the straight line is set to the value of the outermost border width divided by the number of lines, so that the shortest line length is obtained, and lines below this length are ignored.
S212: and carrying out contour detection on the binary image.
In a specific implementation scenario, step S212 is substantially the same as step S106 in the first embodiment of the table cropping method for removing color borders provided by the present invention, and details thereof are not repeated here.
S213: the result of contour detection is compressed for pixels in the horizontal, vertical, and diagonal directions, and only the end point coordinates in the horizontal, vertical, and diagonal directions are retained.
In the present implementation scenario, the pixels in the horizontal direction, the vertical direction, and the diagonal direction of the result of the contour detection (i.e., the suppressed image) are compressed, and only the end point coordinates in the horizontal direction, the vertical direction, and the diagonal direction are retained. Blank portions in the suppressed image, or other portions of the area of the outermost peripheral frame posts, can be effectively removed.
S214: and cutting squares with equal distances from the central point of the row and the column of the single-side frame image to the left and the right to obtain a cut image.
In this implementation scenario, cropping the picture may be accomplished through an array slicing operation. And (4) cutting squares which are respectively equidistant from left to right from the central points of the rows and the columns to obtain a cut image. In other implementation scenarios, the graph may also be a rectangle or other figure. The squares with equal distances are cut from the central points of the rows and the columns to the left and the right, so that the problem that partial areas including characters to be extracted are cut off to cause result errors of subsequent character extraction can be effectively avoided.
S215: the color of the outermost peripheral border in the cropped image is replaced with white, generating an extracted image.
In a specific implementation scenario, step S212 is substantially the same as step S107 in the first embodiment of the table cropping method for removing color borders provided by the present invention, and details thereof are not repeated here.
As can be seen from the above description, in this embodiment, the difference between the maximum threshold and the minimum threshold used for the dual-threshold selection is greater than 100, and only the end point coordinates in the horizontal direction, the vertical direction, and the diagonal direction are retained, so that redundant information can be effectively removed, and the accuracy of character extraction is improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an image processing apparatus according to a first embodiment of the present invention. The image processing apparatus includes: 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 characters to be extracted, the characters to be extracted are located in at least one frame, and at least a part of the at least one frame has different colors. The calculation module 12 is configured to calculate a hue saturation value of each pixel of the image to be processed, and generate a hue saturation image. The extracting module 13 is configured to extract at least one border hue saturation value corresponding to at least one border in the hue saturation image. The filtering module 14 is configured to perform median filtering on at least the border hue saturation values, retain the outermost hue saturation value corresponding to the outermost border, and generate a single-border image. The edge module 15 is configured to perform edge detection on the single-sided frame image to obtain a binary image. The outline module 16 is configured to perform outline detection on the binary image, and crop the single-sided frame image according to the detection result to obtain a cropped image. The replacement module 17 is configured to replace the color of the outermost border in the cropped image with white, and generate an extracted image.
The extraction module 13 is further configured to obtain a lowest value and a highest value of the hue saturation value of the at least one frame, and obtain a corresponding area of the at least one frame according to the highest value and the lowest value.
The edge module 15 is further configured to filter the single-sided frame image by using a gaussian filter to obtain a filtered image; calculating the gradient size and gradient direction of each pixel point of the filtering image; carrying out non-maximum suppression on the filtered image to obtain a suppressed image; and determining the edge of the suppressed image by adopting a dual-threshold 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 frame and the number of rows of the outermost frame; and (3) adopting statistical probability Hough line transformation on an image result of edge detection, wherein the shortest length of a straight line of the statistical probability Hough line transformation is the shortest line length.
The contour module 16 is configured to compress the pixels in the horizontal direction, the vertical direction, and the diagonal direction of the contour detection result, and only retain the end point coordinates in the horizontal direction, the vertical direction, and the diagonal direction.
The outline module 16 is also used to cut squares that are equidistant to the left and right, starting from the center point of the rows and columns of the single-sided block image.
As can be seen from the above description, in the present embodiment, the image processing apparatus calculates a hue saturation value of each pixel of the image to be processed, and extracts at least one frame hue saturation value corresponding to at least one frame; the method can automatically acquire the color of at least one frame, reserve the outermost hue saturation value corresponding to the outermost frame, delete other frames except the outermost frame, replace the color of the outermost frame with white, generate and extract the image, can realize automatic extraction of characters to be extracted in the image of the frame with at least one different color, and can effectively improve the work efficiency of character extraction.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an image processing apparatus 20 according to a second embodiment of the present invention, and the image processing apparatus includes a processor 21 and a memory 22. The processor 21 is coupled to a 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 methods can be referred to above and are not described herein.
As can be seen from the above description, in the present embodiment, the image processing apparatus calculates a hue saturation value of each pixel of the image to be processed, and extracts at least one frame hue saturation value corresponding to at least one frame; the method can automatically acquire the color of at least one frame, reserve the outermost hue saturation value corresponding to the outermost frame, delete other frames except the outermost frame, replace the color of the outermost frame with white, generate and extract the image, can realize automatic extraction of characters to be extracted in the image of the frame with at least one different color, and can effectively improve the work efficiency of character extraction.
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 used for being executed by a processor to implement the method shown in fig. 1 to 3, and the detailed method can be referred to above and will not be described herein again. In one embodiment, the computer readable storage medium 30 may be a memory chip in a terminal, a hard disk, or other readable and writable storage tool such as a removable hard disk, a flash disk, an optical disk, or the like, and may also be a server or the like.
As is apparent from the above description, the computer program in the computer-readable storage medium in this embodiment may be configured to calculate a hue saturation value of each pixel of the image to be processed, and extract at least one frame hue saturation value corresponding to at least one frame; the method can automatically acquire the color of at least one frame, reserve the outermost hue saturation value corresponding to the outermost frame, delete other frames except the outermost frame, replace the color of the outermost frame with white, generate and extract the image, can realize automatic extraction of characters to be extracted in the image of the frame with at least one different color, and can effectively improve the work efficiency of character extraction.
Different from the prior art, the method introduces the HSV color comparison table method, automatically identifies the corresponding color of the comparison table, provides technical support for cutting the table with the color frame removed, can realize automatic cutting of the table with the color frame removed, and effectively improves the working efficiency.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A form trimming method for removing color borders is characterized by comprising 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 the colors of at least part of the at least one frame are different;
calculating the hue saturation value of each pixel of the image to be processed to generate a hue saturation image;
extracting at least one border hue saturation value corresponding to the at least one border in the hue saturation image;
performing median filtering on the at least frame tone saturation value, reserving the outermost tone saturation value corresponding to the outermost frame, and generating a single-frame image;
performing edge detection on the single frame image to obtain a binary image;
carrying out contour detection on the binary image, and cutting the single-frame image according to a detection result to obtain a cut image;
and replacing the color of the outermost peripheral frame in the cropped image with white to generate an extracted image.
2. The method of claim 1, wherein the step of extracting at least one border hue saturation value corresponding to the at least one border in the hue saturation image is followed by the step of:
and acquiring the lowest value and the highest value of the hue 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 according to claim 1, wherein the step of performing edge detection on the single-frame image comprises:
filtering the single frame image by adopting a Gaussian filter to obtain a filtered image;
calculating the gradient size and gradient direction of each pixel point of the filtering image;
carrying out non-maximum suppression on the filtered image to obtain a suppressed image;
and determining the edge of the suppressed image by adopting a double-threshold method.
4. The method of claim 3, wherein the difference between the maximum threshold and the minimum threshold in the dual threshold method is greater than 100.
5. The method of claim 3, wherein the step of performing edge detection on the single-frame image is followed by:
obtaining the shortest line length according to the width of the outermost frame and the number of rows of the outermost frame;
and adopting statistical probability Hough line transformation on the image result of the edge detection, wherein the shortest length of the line of the statistical probability Hough line transformation is the shortest line length.
6. The method of claim 1, wherein the step of contour detecting the binary image is followed by:
and compressing the pixels in the horizontal direction, the vertical direction and the diagonal direction of the contour detection result, and only keeping the end point coordinates in the horizontal direction, the vertical direction and the diagonal direction.
7. The method according to claim 1, wherein the step of cropping the single frame image according to the detection result comprises:
and cutting squares with equal distances from the center point of the row and the column of the single frame image to the left and the right.
8. 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 at least one frame has different colors;
the calculation module is used for calculating the hue saturation value of each pixel of the image to be processed to generate a hue saturation image;
the extraction module is used for extracting at least one border hue saturation value corresponding to the at least one border in the hue 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-frame image to obtain a binary image;
the contour module is used for carrying out contour detection on the binary image and cutting the single-frame image according to a detection result to obtain a cut image;
a replacement module to replace a color of the outermost border in the cropped image with white to generate an extracted image.
9. An image processing apparatus characterized by comprising: a processor coupled to the memory and a memory having a computer program stored therein, the processor executing the computer program to implement the method of any of claims 1-7.
10. A computer-readable storage medium, in which a computer program is stored, which computer program is executable by a processor to implement the method according to any one of claims 1-7.
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 true CN111414877A (en) 2020-07-14
CN111414877B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113223041A (en) * 2021-06-25 2021-08-06 上海添音生物科技有限公司 Method, system and storage medium for automatically extracting target area in image

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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113223041A (en) * 2021-06-25 2021-08-06 上海添音生物科技有限公司 Method, system and storage medium for automatically extracting target area in image
CN113223041B (en) * 2021-06-25 2024-01-12 上海添音生物科技有限公司 Method, system and storage medium for automatically extracting target area in image

Also Published As

Publication number Publication date
CN111414877B (en) 2023-06-20

Similar Documents

Publication Publication Date Title
CN110008954B (en) Complex background text image extraction method and system based on multi-threshold fusion
KR101683704B1 (en) Face calibration method and system, and computer storage medium
CN112887693B (en) Image purple border elimination method, equipment and storage medium
CN109544583B (en) Method, device and equipment for extracting interested area of leather image
JP2016505186A (en) Image processor with edge preservation and noise suppression functions
JP2003228712A (en) Method for identifying text-like pixel from image
JP5974589B2 (en) Image processing apparatus and program
US8447113B2 (en) Character area extracting device, imaging device having character area extracting function, recording medium saving character area extracting programs, and character area extracting method
US9153013B2 (en) Image processing apparatus, image processing method and computer readable medium
CN110930321A (en) Blue/green screen digital image matting method capable of automatically selecting target area
CN110276279B (en) Method for detecting arbitrary-shape scene text based on image segmentation
CN104361335B (en) A kind of processing method that black surround is automatically removed based on scan image
JP3814353B2 (en) Image segmentation method and image segmentation apparatus
CN109754423B (en) Method and equipment for extracting coverage area of leaf scab
CN111414877B (en) Table cutting method for removing color frame, image processing apparatus and storage medium
CN115995078A (en) Image preprocessing method and system for plankton in-situ observation
US7693329B2 (en) Bound document scanning method and apparatus
CN110458012B (en) Multi-angle face recognition method and device, storage medium and terminal
CN110807747B (en) Document image noise reduction method based on foreground mask
JP2003256834A (en) Face area extracting and face configuring element position judging device
JPH1125222A (en) Method and device for segmenting character
CN115272362A (en) Method and device for segmenting effective area of digital pathology full-field image
Hong et al. A single image dehazing method based on adaptive gamma correction
CN108133204B (en) Hand body identification method, device, equipment and computer readable storage medium
CN109934215B (en) Identification card identification method

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