A table recognition method and device

Through corrosion and expansion technology, linear fitting and optical character recognition technology, the accuracy problem of machine learning models in identifying image tables when training samples are insufficient, and the effective processing of noise and curve table lines is achieved to generate accurate target tables .

CN113887401BActive Publication Date: 2024-12-20BEIJING SOGOU TECHNOLOGY DEVELOPMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111155487.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-29
Publication Date
2024-12-20
Estimated Expiration
2041-09-29

AI Technical Summary

Technical Problem

Prior art In the case of insufficient training samples, machine learning models have difficulty accurately identifying tables in images, especially when there are noise or curve table lines.

Method used

The corrosion and expansion techniques are used to determine the table lines in the image, and the fitted table lines are obtained through straight line fitting. Combined with optical character recognition and image edge contour processing technology, the cell boundary lines are identified and supplemented to generate an accurate target table.

Benefits of technology

Improve the accuracy of table recognition, avoid misidentification of noise and curved table lines, and ensure that tables in the image can still be accurately identified in the case of insufficient training samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113887401B_ABST
    Figure CN113887401B_ABST
Patent Text Reader

Abstract

The present application discloses a table recognition method, which can first obtain a first image including a table, and determine the table lines in the first image by using the erosion and expansion technology. The erosion and expansion technology can avoid recognizing the noise in the first image as the table lines. In addition, the average height and / or maximum height of the text included in the first image is set as the parameters of the erosion and expansion technology, which can avoid the horizontal strokes and vertical strokes in the text in the first image being mistakenly recognized as table lines. In addition, since the table lines obtained by using the erosion and expansion technology may have curves, the table lines can be further fitted with straight lines to obtain the fitted table lines, and the target table can be drawn according to the fitted table lines, and the target table can be output. It can be seen that in this solution, the fitted table lines are relatively accurate, so that the target table drawn using the fitted table lines is also relatively accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to a table recognition method and device. Background Art

[0002] In some scenarios, it is necessary to identify tables in images. Currently, machine learning models can be used to identify tables in images. However, the method of using machine learning models to identify tables in images requires pre-training of the machine learning model, and training a machine model requires a large number of training samples. In the case of insufficient training samples, the trained machine learning model cannot accurately identify the table in the image.

[0003] Therefore, a solution is urgently needed to solve the above problems. Summary of the invention

[0004] The technical problem to be solved by the present application is how to accurately identify a table in an image, and to provide a table recognition method and device.

[0005] In a first aspect, an embodiment of the present application provides a table recognition method, the method comprising:

[0006] acquiring a first image including a table;

[0007] Determining the table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and / or a maximum height of text included in the first image;

[0008] Performing straight line fitting on the table line to obtain a fitted table line;

[0009] A target table is obtained by drawing the fitted table lines, and the target table is output.

[0010] Optionally, the method further includes:

[0011] Determine the text included in the first image by using optical character recognition (OCR) technology;

[0012] An average height and / or a maximum height of the text is determined.

[0013] Optionally, obtaining a target table by drawing the fitted table line includes:

[0014] Identify cells according to the fitted table lines and image edge contour processing technology;

[0015] The identified cells are drawn to obtain the target table.

[0016] Optionally, the method further includes:

[0017] Processing the first image using OCR technology to determine the missing boundary line of the cell;

[0018] Filling in the missing boundary line of the cell to obtain a processed cell;

[0019] The cell obtained by drawing and identifying includes:

[0020] The processed cells are plotted.

[0021] Optionally, acquiring the first image including the table includes:

[0022] acquiring a second image including a table, and identifying oblique lines in the second image;

[0023] Calculate the angle between the oblique line and the horizontal axis;

[0024] The second image is rotated according to the angle to obtain the first image.

[0025] In a second aspect, an embodiment of the present application provides a table recognition device, the device comprising:

[0026] An acquisition unit, configured to acquire a first image including a table;

[0027] A first determining unit, configured to determine table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and / or a maximum height of texts included in the first image;

[0028] A fitting unit, used for performing straight line fitting on the table line to obtain a fitted table line;

[0029] A drawing unit, used for drawing a target table according to the fitted table line;

[0030] An output unit is used to output the target table.

[0031] Optionally, the device further comprises:

[0032] A second determining unit, configured to determine text included in the first image by using optical character recognition (OCR) technology;

[0033] The third determining unit is used to determine the average height and / or maximum height of the text.

[0034] Optionally, the drawing unit is used to:

[0035] Identify cells according to the fitted table lines and image edge contour processing technology;

[0036] The identified cells are drawn to obtain the target table.

[0037] Optionally, the device further comprises:

[0038] a fourth determining unit, configured to process the first image using an OCR technology to determine a missing boundary line of the cell;

[0039] A processing unit, used to complete the missing boundary line of the cell to obtain a processed cell;

[0040] The drawing unit is used for:

[0041] The processed cells are plotted.

[0042] Optionally, the acquiring unit is used to:

[0043] acquiring a second image including a table, and identifying oblique lines in the second image;

[0044] Calculate the angle between the oblique line and the horizontal axis;

[0045] The second image is rotated according to the angle to obtain the first image.

[0046] In a third aspect, an embodiment of the present application provides a table recognition device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations:

[0047] acquiring a first image including a table;

[0048] Determining the table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and / or a maximum height of text included in the first image;

[0049] Performing straight line fitting on the table line to obtain a fitted table line;

[0050] A target table is obtained by drawing the fitted table lines, and the target table is output.

[0051] Optionally, the operation further includes:

[0052] Determine the text included in the first image by using optical character recognition (OCR) technology;

[0053] An average height and / or a maximum height of the text is determined.

[0054] Optionally, obtaining a target table by drawing the fitted table line includes:

[0055] Identify cells according to the fitted table lines and image edge contour processing technology;

[0056] The identified cells are drawn to obtain the target table.

[0057] Optionally, the operation further includes:

[0058] Processing the first image using OCR technology to determine the missing boundary line of the cell;

[0059] Filling in the missing boundary line of the cell to obtain a processed cell;

[0060] The cell obtained by drawing and identifying includes:

[0061] The processed cells are plotted.

[0062] Optionally, acquiring the first image including the table includes:

[0063] acquiring a second image including a table, and identifying oblique lines in the second image;

[0064] Calculate the angle between the oblique line and the horizontal axis;

[0065] The second image is rotated according to the angle to obtain the first image.

[0066] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having instructions stored thereon, which, when executed by one or more processors, enables a device to execute the table recognition method described in any one of the first aspects above.

[0067] Compared with the prior art, the embodiments of the present application have the following advantages:

[0068] The embodiment of the present application provides a table recognition method, in which a first image including a table can be first obtained, and the table lines in the first image can be determined by corrosion and expansion techniques. It can be understood that the corrosion and expansion techniques can avoid identifying noise in the first image as table lines. In addition, the average height and / or maximum height of the text included in the first image is set as a parameter of the corrosion and expansion technique, which can avoid misidentifying horizontal strokes and vertical strokes in the text in the first image as table lines. In addition, since the table line obtained by the corrosion and expansion technique may have a curve, the table line can be further fitted with a straight line to obtain a fitted table line, and a target table can be drawn according to the fitted table line, and the target table is output. It can be seen that in this solution, the fitted table line is relatively accurate, so that the target table drawn by the fitted table line is also relatively accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0070] Figure 1 A flowchart of a table recognition method provided in an embodiment of the present application;

[0071] Figure 2 A schematic diagram of the structure of a table recognition device provided in an embodiment of the present application;

[0072] Figure 3 A schematic diagram of the structure of the client provided in the embodiment of the present application;

[0073] Figure 4 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0074] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0075] The inventor of the present application has found through research that a machine learning model can be used to identify tables in images. However, the method of using a machine learning model to identify tables in images requires pre-training of the machine learning model, and training a machine model requires a large number of training samples. If the training samples are insufficient, the trained machine learning model cannot accurately identify the table in the image.

[0076] For example: If no training samples containing noise are used when training a machine learning model, then when the image to be recognized contains noise, the machine learning model cannot accurately recognize the table in the image to be processed. If no training samples in which the table lines are curves are used when training a machine learning model, then when the table lines in the image to be recognized are curves, the trained machine learning model cannot accurately recognize the table in the image to be recognized.

[0077] In order to solve the above problems, the embodiments of the present application provide a table recognition method and device, which can accurately recognize a table in an image.

[0078] Various non-limiting implementations of the present application are described in detail below in conjunction with the accompanying drawings.

[0079] Exemplary Methods

[0080] See also Figure 1 , which is a flow chart of a table recognition method provided in an embodiment of the present application.

[0081] The method provided in the embodiment of the present application can be executed by a first device, and the first device mentioned here includes but is not limited to a terminal device and a server. The terminal device mentioned here can be a mobile terminal such as a smart phone and a tablet computer, or a terminal device such as a desktop computer.

[0082] Figure 1 The method shown can be implemented, for example, through the following S101-S104.

[0083] S101: Acquire a first image including a table.

[0084] The first image in the embodiment of the present application can be any one of a network screenshot, a printed text scan image, a word document image, a pdf document image, and a LaTeX document image.

[0085] In one implementation of the embodiment of the present application, considering that in practice, the table in the image may be tilted, in order to avoid recognizing that the table is tilted, in the embodiment of the present application, the first image may be obtained by processing the second image including the table, and the table in the first image does not include a diagonal line. Specifically:

[0086] The second image including the table may be first acquired, and then the oblique line in the second image may be identified, and the angle between the oblique line and the horizontal axis direction may be calculated, and then the second image may be rotated according to the angle to obtain the first image. It is understood that the oblique line in the second image is a line parallel to the horizontal axis direction in the first image. The horizontal axis direction mentioned here may be the horizontal axis of a pre-established rectangular coordinate system.

[0087] Considering that the Hough deformation technology can identify lines in an image, in the embodiment of the present application, the Hough deformation technology can be used to identify oblique lines in the second image.

[0088] When rotating the second image according to the angle, for example, the second image can be rotated clockwise or counterclockwise during specific implementation. For example, in a rectangular coordinate system, the angle between the oblique line and the positive direction of the horizontal axis is α, then the second image can be rotated clockwise by α, or counterclockwise by (180°-α). The specific rotation method can be determined according to the text direction in the table. If the text in the first image is displayed normally after the second image is rotated clockwise by α, the second image can be rotated clockwise by α. If the text in the first image is displayed upside down after the second image is rotated clockwise by α, the second image can be rotated counterclockwise by (180°-α).

[0089] S102: Determine table lines in the first image by using an erosion and dilation technique, where parameters of the erosion and dilation technique include: an average height and / or a maximum height of text included in the first image.

[0090] In the embodiment of the present application, it is considered that there may be noise in the first image, and the noise may be mistakenly identified as table lines, resulting in inaccurate table line identification. The erosion and dilation technique can eliminate the noise and identify the lines in the image. Therefore, in the embodiment of the present application, the erosion and dilation technique can be used to determine the table lines in the first image. When using the erosion and dilation technique to identify the table lines in the first image, the parameters of the erosion and dilation technique can be set. The parameters of the erosion and dilation technique are not specifically limited in the embodiment of the present application.

[0091] In one example, considering that there may be text in the table in the first image, and there may be some horizontal strokes or vertical strokes in the text, these horizontal strokes and vertical strokes in the text may be mistakenly recognized as table lines, resulting in inaccurate table line recognition. In order to solve this problem, in an implementation method of an embodiment of the present application, the average height and / or maximum height of the text included in the first image can be used as a parameter of the erosion and expansion technology. In this way, when using the erosion and expansion technology to identify the table lines in the first image, the average height and / or maximum height of the text in the table are taken into account, so it can effectively avoid the horizontal strokes and vertical strokes in the text from being mistakenly recognized as table lines, and effectively improve the accuracy of the recognized table lines.

[0092] For this case, before executing S102, it is also necessary to determine the average height and / or maximum height of the text included in the first image. In the embodiment of the present application, considering the optical character recognition (OCR) technology, the shape of the text in the image can be determined by detecting dark and light patterns, and then the shape is translated into computer text using a character recognition method. In other words, the OCR technology can identify the text included in the first image. In view of this, in the embodiment of the present application, the OCR technology can be used to determine the text included in the first image, and then the height of the text included in the first image can be counted to determine the average height and / or maximum height of the text.

[0093] S103: performing straight line fitting on the table line to obtain a fitted table line.

[0094] In the embodiment of the present application, considering that the table lines in the first image may include curves, this results in the table lines identified by S102 including curves. For example, for an image taken by a mobile phone, due to the shooting angle problem, the table lines in the first image are curves. In view of this, in the embodiment of the present application, a straight line fitting can be performed on the table lines to obtain a fitted table line. The straight line fitting in the embodiment of the present application refers to processing the curve to obtain a straight line. It can be understood that the fitted table line is a line segment.

[0095] The embodiment of the present application does not specifically limit the specific implementation method of the straight line fitting for the table lines. In the embodiment of the present application, the table lines can be fitted with a least squares method, or a gradient descent method, or a Gauss-Newton or Lev-Maalakshmi algorithm. The embodiment of the present application does not make any specific limitation.

[0096] S104: Draw a target table according to the fitted table lines, and output the target table.

[0097] After obtaining the fitted table line, the target table can be obtained by drawing the fitted table line. It can be understood that since the fitted table line is relatively accurate, the table drawn according to the fitted table line is also relatively accurate.

[0098] It should be noted that the fitted table lines include horizontal lines and vertical lines, which are lines with width. There are many intersections between a horizontal line with width and a vertical line with width, while for an accurate table, there is only one intersection between a horizontal line and a vertical line, and the intersection is a vertex of a rectangular cell. Therefore, by connecting the horizontal lines and vertical lines in the fitted table lines, a rough framework of the table can be obtained. For example, a binary image including the framework of the table is obtained. If an accurate target table is to be drawn, the cells in the table can be further identified, and then the identified cells are drawn to obtain the target table.

[0099] In the embodiment of the present application, the cell can be identified based on the fitted table line and the image edge contour processing technology. It is understandable that the fitted table line can reflect the approximate position of the cell, and the cell can be accurately identified by using the image edge contour processing technology at the approximate position where the cell is located. For example, the binary image of the frame including the table is identified using the image edge contour processing technology to obtain the cell.

[0100] Considering that the table in the first image may lack border lines. For example, the left border line is missing; another example, the right border line is missing; another example, the upper border line or the lower border line is missing. Therefore, in one implementation of this embodiment, after the cell is identified by using the image edge contour processing technology, the cell can be further optimized to complete the missing border line of the cell.

[0101] As mentioned above, OCR technology can identify the text included in the first image. Therefore, it can be determined in combination with the text in the table whether the cell lacks a border. For example, for a certain text, if the text does not have a corresponding left border line, it can be determined that the cell where the text is located does not have a left border line. For another example: for a certain text, if the text does not have a corresponding right border line, it can be determined that the cell where the text is located does not have a right border line. For another example, for a certain text, if the text does not have a corresponding upper border line, it can be determined that the cell where the text is located does not have an upper border line. For another example, for a certain text, if the text does not have a corresponding lower border line, it can be determined that the cell where the text is located does not have a lower border line.

[0102] Therefore, in an embodiment of the present application, the first image can be processed in combination with OCR technology to determine the missing boundary lines of the cells, and further fill in the missing boundary lines to obtain processed cells. Specifically: OCR technology can be used to identify the text in the first image, and then determine whether the cell where the text is located lacks a boundary line. If the cell where the text is located lacks a boundary line, the missing boundary line is filled in to obtain a complete cell.

[0103] For example:

[0104] Text A is identified using OCR technology, where text A may include one or more characters. The text A has no corresponding left border line, so it can be determined that the cell where text A is located has no left border line. Therefore, the left border line of the cell where text A is located can be completed in combination with other border lines of the cell where text A is located.

[0105] After the missing border lines of the cells are filled to obtain the processed cells, the processed cells can be drawn to obtain the target table. It can be understood that the target table drawn in this way does not have the situation where the cells lack borders.

[0106] In the embodiment of the present application, when outputting the target table, for example, a table in a specific format may be output. The embodiment of the present application does not specifically limit the specific format, and the specific format may be, for example, an Excel format.

[0107] In addition, in the embodiment of the present application, in addition to drawing the target table, the text in the target table can also be drawn, so as to obtain a target table including text. After obtaining the target table including text, the target table including text can be output. The embodiment of the present application does not specifically limit the implementation method of drawing the text in the target table.

[0108] Exemplary Devices

[0109] Based on the method provided in the above embodiment, the embodiment of the present application further provides a device, which is described below in conjunction with the accompanying drawings.

[0110] See also Figure 2 , which is a schematic diagram of the structure of a table recognition device provided in an embodiment of the present application. The device 200 may specifically include: an acquisition unit 201, a first determination unit 202, a fitting unit 203, a drawing unit 204 and an output unit 205.

[0111] An acquisition unit 201 is used to acquire a first image including a table;

[0112] A first determining unit 202 is used to determine the table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and / or a maximum height of texts included in the first image;

[0113] A fitting unit 203, used for performing straight line fitting on the table line to obtain a fitted table line;

[0114] A drawing unit 204, configured to draw a target table according to the fitted table line;

[0115] The output unit 205 is used to output the target table.

[0116] Optionally, the device further comprises:

[0117] A second determining unit, configured to determine text included in the first image by using optical character recognition (OCR) technology;

[0118] The third determining unit is used to determine the average height and / or maximum height of the text.

[0119] Optionally, the drawing unit 204 is used to:

[0120] Identify cells according to the fitted table lines and image edge contour processing technology;

[0121] The identified cells are drawn to obtain the target table.

[0122] Optionally, the device further comprises:

[0123] a fourth determining unit, configured to process the first image using an OCR technology to determine a missing boundary line of the cell;

[0124] A processing unit, used to complete the missing boundary line of the cell to obtain a processed cell;

[0125] The drawing unit 204 is used for:

[0126] The processed cells are plotted.

[0127] Optionally, the acquiring unit 204 is configured to:

[0128] acquiring a second image including a table, and identifying oblique lines in the second image;

[0129] Calculate the angle between the oblique line and the horizontal axis;

[0130] The second image is rotated according to the angle to obtain the first image.

[0131] Since the device 200 is a device corresponding to the method provided in the above method embodiment, the specific implementation of each unit of the device 200 is based on the same concept as the above method embodiment. Therefore, for the specific implementation of each unit of the device 200, reference can be made to the description part of the above method embodiment, which will not be repeated here.

[0132] The method provided in the embodiment of the present application can be executed by a client or a server. The client and server that execute the above method are described below respectively.

[0133] Figure 3 1 shows a block diagram of a client 300. For example, the client 300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0134] Reference Figure 3 The client 300 may include one or more of the following components: a processing component 302 , a memory 304 , a power component 306 , a multimedia component 308 , an audio component 310 , an input / output (I / O) interface 33 , a sensor component 314 , and a communication component 316 .

[0135] The processing component 302 generally controls the overall operation of the client 300, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 302 may include one or more processors 320 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 302 may include one or more modules to facilitate the interaction between the processing component 302 and other components. For example, the processing component 302 may include a multimedia module to facilitate the interaction between the multimedia component 308 and the processing component 302.

[0136] The memory 304 is configured to store various types of data to support operations on the client 300. Examples of such data include instructions for any application or method operating on the client 300, contact data, phone book data, messages, pictures, videos, etc. The memory 304 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0137] The power supply component 306 provides power to the various components of the client 300. The power supply component 306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the client 300.

[0138] The multimedia component 308 includes a screen that provides an output interface between the client 300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 308 includes a front camera and / or a rear camera. When the client 300 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0139] The audio component 310 is configured to output and / or input audio signals. For example, the audio component 310 includes a microphone (MIC), and when the client 300 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 304 or sent via the communication component 316. In some embodiments, the audio component 310 also includes a speaker for outputting audio signals.

[0140] The I / O interface provides an interface between the processing component 302 and the peripheral interface module, which may be a keyboard, a click wheel, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0141] The sensor assembly 314 includes one or more sensors for providing various aspects of status assessment for the client 300. For example, the sensor assembly 314 can detect the open / closed state of the device 300, the relative positioning of components, such as the display and keypad of the client 300, and the sensor assembly 314 can also detect the position change of the client 300 or a component of the client 300, the presence or absence of user contact with the client 300, the orientation or acceleration / deceleration of the client 300, and the temperature change of the client 300. The sensor assembly 314 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 314 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0142] The communication component 316 is configured to facilitate wired or wireless communication between the client 300 and other devices. The client 300 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0143] In an exemplary embodiment, the client 300 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the following methods:

[0144] acquiring a first image including a table;

[0145] Determining the table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and / or a maximum height of text included in the first image;

[0146] Performing straight line fitting on the table line to obtain a fitted table line;

[0147] A target table is obtained by drawing the fitted table lines, and the target table is output.

[0148] Optionally, the method further includes:

[0149] Determine the text included in the first image using optical character recognition (OCR) technology;

[0150] An average height and / or a maximum height of the text is determined.

[0151] Optionally, obtaining a target table by drawing the fitted table line includes:

[0152] Identify cells according to the fitted table lines and image edge contour processing technology;

[0153] The identified cells are drawn to obtain the target table.

[0154] Optionally, the method further includes:

[0155] Processing the first image using OCR technology to determine the missing boundary line of the cell;

[0156] Filling in the missing boundary line of the cell to obtain a processed cell;

[0157] The cell obtained by drawing and identifying includes:

[0158] The processed cells are plotted.

[0159] Optionally, acquiring the first image including the table includes:

[0160] acquiring a second image including a table, and identifying oblique lines in the second image;

[0161] Calculate the angle between the oblique line and the horizontal axis;

[0162] The second image is rotated according to the angle to obtain the first image.

[0163] Figure 44 is a schematic diagram of the structure of the server in the embodiment of the present application. The server 400 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 422 (for example, one or more processors) and memory 432, and one or more storage media 430 (for example, one or more mass storage devices) storing application programs 442 or data 444. Among them, the memory 432 and the storage medium 430 can be short-term storage or permanent storage. The program stored in the storage medium 430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 422 can be configured to communicate with the storage medium 430 to execute a series of instruction operations in the storage medium 430 on the server 400.

[0164] Furthermore, the CPU 422 may execute the following method:

[0165] acquiring a first image including a table;

[0166] Determining the table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and / or a maximum height of text included in the first image;

[0167] Performing straight line fitting on the table line to obtain a fitted table line;

[0168] A target table is obtained by drawing the fitted table lines, and the target table is output.

[0169] Optionally, the method further includes:

[0170] Determine the text included in the first image by using optical character recognition (OCR) technology;

[0171] An average height and / or a maximum height of the text is determined.

[0172] Optionally, obtaining a target table by drawing the fitted table line includes:

[0173] Identify cells according to the fitted table lines and image edge contour processing technology;

[0174] The identified cells are drawn to obtain the target table.

[0175] Optionally, the method further includes:

[0176] Processing the first image using OCR technology to determine the missing boundary line of the cell;

[0177] Filling in the missing boundary line of the cell to obtain a processed cell;

[0178] The cell obtained by drawing and identifying includes:

[0179] The processed cells are plotted.

[0180] Optionally, acquiring the first image including the table includes:

[0181] acquiring a second image including a table, and identifying oblique lines in the second image;

[0182] Calculate the angle between the oblique line and the horizontal axis;

[0183] The second image is rotated according to the angle to obtain the first image.

[0184] The server 400 may also include one or more power supplies 426, one or more wired or wireless network interfaces 450, one or more input and output interfaces 456, one or more keyboards 456, and / or one or more operating systems 441, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0185] The present application also provides a computer-readable medium having instructions stored thereon, which, when executed by one or more processors, causes the device to perform the following method:

[0186] acquiring a first image including a table;

[0187] Determining the table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and / or a maximum height of text included in the first image;

[0188] Performing straight line fitting on the table line to obtain a fitted table line;

[0189] A target table is obtained by drawing the fitted table lines, and the target table is output.

[0190] Optionally, the method further includes:

[0191] Determine the text included in the first image using optical character recognition (OCR) technology;

[0192] An average height and / or a maximum height of the text is determined.

[0193] Optionally, obtaining a target table by drawing the fitted table line includes:

[0194] Identify cells according to the fitted table lines and image edge contour processing technology;

[0195] The identified cells are drawn to obtain the target table.

[0196] Optionally, the method further includes:

[0197] Processing the first image using OCR technology to determine the missing boundary line of the cell;

[0198] Filling in the missing boundary line of the cell to obtain a processed cell;

[0199] The cell obtained by drawing and identifying includes:

[0200] The processed cells are plotted.

[0201] Optionally, acquiring the first image including the table includes:

[0202] acquiring a second image including a table, and identifying oblique lines in the second image;

[0203] Calculate the angle between the oblique line and the horizontal axis;

[0204] The second image is rotated according to the angle to obtain the first image.

[0205] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0206] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0207] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A table recognition method, characterized in that: The method comprises: Acquiring a first image including a table, including: acquiring a second image including a table, and using a Hough deformation technique to identify an oblique line in the second image, wherein the oblique line in the second image is a line parallel to the horizontal axis in the first image; calculating an angle between the oblique line and the horizontal axis; rotating the second image according to the angle to obtain the first image, wherein the rotation method is determined according to the direction of the text in the table; Determining the table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and a maximum height of text included in the first image; When the table line in the recognized image is a curve, a straight line fitting is performed on the table line to obtain a fitted table line, wherein the straight line fitting refers to processing the curve to obtain a straight line, and the fitted table line is a line segment; Draw a target table according to the fitted table line, and output the target table; Wherein, the step of obtaining a target table according to the fitted table line drawing includes: Connect the horizontal and vertical lines in the fitted table line to obtain a binary image including the frame of the table; Using image edge contour processing technology, identify cells in the table; The identified cells are drawn to obtain the target table.

2. The method according to claim 1, characterized in that The method further comprises: Determine the text included in the first image by using optical character recognition (OCR) technology; An average height and / or a maximum height of the text is determined.

3. The method according to claim 1, characterized in that The method further comprises: Processing the first image using OCR technology to determine the missing boundary line of the cell; Filling in the missing boundary line of the cell to obtain a processed cell; The drawing of the identified cell includes: drawing the processed cell.

4. A table recognition device, characterized in that: The device comprises: An acquisition unit is used to acquire a first image including a table, which includes: acquiring a second image including a table, and using a Hough deformation technique to identify an oblique line in the second image, wherein the oblique line in the second image is a line parallel to the horizontal axis in the first image; calculating an angle between the oblique line and the horizontal axis; rotating the second image according to the angle to obtain the first image, wherein the rotation method is determined according to the direction of the text in the table; A first determining unit, configured to determine table lines in the first image by using an erosion and dilation technique, wherein parameters of the erosion and dilation technique include: an average height and a maximum height of texts included in the first image; A fitting unit, used for performing straight line fitting on the table line in the recognized image to obtain a fitted table line when the table line in the recognized image is a curve. The straight line fitting refers to processing the curve to obtain a straight line. The fitted table line is a line segment. A drawing unit is used to draw a target table according to the fitted table lines, which includes: connecting the horizontal lines and vertical lines in the fitted table lines to obtain a binary image including the frame of the table; using image edge contour processing technology to identify cells in the table; and drawing the identified cells to obtain the target table; An output unit is used to output the target table.

5. The device according to claim 4, characterized in that The device also includes: A second determining unit, configured to determine text included in the first image by using optical character recognition (OCR) technology; The third determining unit is used to determine the average height and / or maximum height of the text.

6. The device according to claim 4, characterized in that The device also includes: a fourth determining unit, configured to process the first image using an OCR technology to determine a missing boundary line of the cell; A processing unit, used to complete the missing boundary line of the cell to obtain a processed cell; The drawing unit is used to draw the processed cells.

7. A table recognition device, characterized in that: The device comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include being used to perform the table recognition method as described in any one of claims 1 to 3.

8. A computer-readable medium having instructions stored thereon, which, when executed by one or more processors, causes a device to perform the table recognition method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method and device for automatically identifying paper table structure

    CN112036294A

  • Table identification method, equipment and computer readable storage medium

    CN113139445A