Methods, apparatus, computer-readable media, and electronic devices for extracting tables from images
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-27
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]然而,传统的图像中表格的提取方案往往是单纯输出提取后的表格内容,且传统提取方案均存在准确性不高的问题,这导致人员难以发现提取出的表格内容中的错误
[0016]根据本申请实施例的一个方面,提供了一种计算机程序产品,所述计算机程序产品包括计算机指令,所述计算机指令存储在计算机可读存储介质中,计算机设备的处理器从所述计算机可读存储介质读取所述计算机指令,所述处理器执行所述计算机指令,使得所述计算机设备执行如上述实施例中所述的图像中表格的提取方法。
Smart Images

Figure CN122313502B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technology, and more specifically, to a method, apparatus, computer-readable medium, and electronic device for extracting tables from an image. Background Technology
[0002] Currently, extracting tables from images is a common task requirement in many business scenarios.
[0003] However, traditional methods for extracting tables from images often simply output the extracted table content, and these methods are not very accurate, making it difficult for people to detect errors in the extracted table content. Summary of the Invention
[0004] The embodiments of this application provide a method, apparatus, computer-readable medium, and electronic device for extracting tables from images, which can at least to some extent help users efficiently, quickly, and intuitively discover errors in the extracted table information, thereby improving work efficiency.
[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0006] According to one aspect of the embodiments of this application, a method for extracting a table from an image is provided. The method includes: acquiring a target image containing a target table; extracting table information from the target table in the target image to obtain multiple table element information and at least one confidence information corresponding to each of the table element information; constructing a target page including the target table based on the multiple table element information and the confidence information corresponding to each of the table element information, and displaying the target page through a target terminal; the target page visually displays multiple table element information and at least one confidence information corresponding to each of the table element information.
[0007] According to one aspect of the embodiments of this application, an apparatus for extracting tables from an image is provided. The apparatus includes: an image acquisition unit for acquiring a target image containing a target table; a table information extraction unit for extracting table information from the target table in the target image to obtain multiple table element information and at least one confidence information corresponding to each of the table element information; and a page construction unit for constructing a target page including the target table based on the multiple table element information and the confidence information corresponding to at least one of the table element information, and displaying the target page through a target terminal; the target page visually displays multiple table element information and at least one confidence information corresponding to the target table.
[0008] In some embodiments of this application, based on the foregoing scheme, the target table displayed on the target page includes at least one color mark corresponding to the table element information; the color of the color mark is determined according to the confidence information corresponding to the table element information.
[0009] In some embodiments of this application, based on the foregoing scheme, the device further includes an information pop-up unit; after the target page is displayed through the target terminal, the information pop-up unit is used to: when the cursor is detected to be hovering over the target table element information of the target table, pop up the confidence information corresponding to the target table element information.
[0010] In some embodiments of this application, based on the foregoing scheme, the table information extraction unit is configured to: identify the table element information of the target table in the target image based on at least one recognition model, and obtain multiple candidate table element information and confidence information corresponding to each position in at least one position of the target table; for each position in at least one position, determine the table element information corresponding to the position from the multiple candidate table element information corresponding to the position according to the confidence information respectively, and obtain the confidence information corresponding to the table element information.
[0011] In some embodiments of this application, based on the foregoing scheme, the image acquisition unit includes an original image acquisition subunit, a scaling processing subunit, and a post-processing subunit; the original image acquisition subunit is used to: acquire an original image containing the target table; the scaling processing subunit is used to: scale the original image to obtain a scaled image; the post-processing subunit is used to: if it is determined that the scaled image is a blurred image, then after performing super-resolution processing on the scaled image, acquire the target image based on the processed image.
[0012] In some embodiments of this application, based on the foregoing scheme, the post-processing subunit is configured to: perform orientation detection on the processed image, and correct the orientation of the processed image when an orientation anomaly is detected, to obtain an orientation-corrected image; perform image grayscale processing on the orientation-corrected image to obtain a grayscale image; perform edge detection on the grayscale image, and perform binarization processing based on the detection result to obtain a black and white line image; perform table position detection on the black and white line image to obtain an original table region image; perform line type classification on the original table region image to obtain a line type classification result, wherein the line type classification result is any one of the following: wired, wireless; obtain a target image based on the original table region image; the page construction unit is configured to: construct a target page including a target table matching the line type classification result based on the multiple table element information, the confidence information corresponding to at least one of the table element information, and the line type classification result.
[0013] In some embodiments of this application, based on the foregoing scheme, the post-processing subunit is configured to: perform table outline edge instance segmentation on the original table region image to obtain a table region image; and perform table outline perspective correction on the table region image to obtain a target image.
[0014] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method for extracting tables from images as described in the above embodiments.
[0015] According to one aspect of the embodiments of this application, an electronic device is provided, including: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement the method for extracting tables from images as described in the above embodiments.
[0016] According to one aspect of the embodiments of this application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium, a processor of a computer device reading the computer instructions from the computer-readable storage medium, and the processor executing the computer instructions, causing the computer device to perform the method for extracting tables from images as described in the above embodiments.
[0017] In some embodiments of this application, after obtaining a target image containing a target table, table information is extracted from the target table in the target image. This yields not only multiple table element information but also confidence information corresponding to at least one table element. Finally, a target page including the target table is constructed based on the multiple table element information and the confidence information corresponding to each table element, and the target page is displayed on the target terminal. Since this application extracts confidence information corresponding to at least one table element when extracting table information from the target table in the target image, and also utilizes the confidence information corresponding to at least one table element when constructing the target page, the target page visually displays the confidence information corresponding to at least one table element. Therefore, this application can display the confidence information corresponding to the table element information on the target page, which helps users to specifically check and verify table element information with low confidence. This allows users to efficiently, quickly, and intuitively discover errors in the extracted table information, providing visual feedback for users to promptly correct errors in the table information, thereby improving the efficiency of table information repair and personnel work efficiency.
[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0020] Figure 1 A flowchart illustrating a method for extracting a table from an image according to an embodiment of this application is shown.
[0021] Figure 2 A flowchart illustrating the specific steps involved in obtaining a target image containing a target table according to an embodiment of this application is shown.
[0022] Figure 3 An embodiment according to this application is shown. Figure 1 The flowchart of the steps following step 130 in the embodiment.
[0023] Figure 4 A block diagram of an apparatus for extracting a table from an image according to an embodiment of this application is shown.
[0024] Figure 5A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0025] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0026] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0027] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0028] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0029] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0030] This application first provides a method for extracting tables from images. This method for extracting tables from images can provide services to users such as judges.
[0031] Therefore, the solutions in this application can be applied to terminals or servers. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0032] The implementation details of the technical solutions in the embodiments of this application are described in detail below:
[0033] Figure 1 A flowchart illustrating a method for extracting a table from an image according to an embodiment of this application is provided. This method for extracting a table from an image can be performed by various devices with processing and computing capabilities. Specifically, it can be performed by a target device, such as a user terminal or a cloud server. User terminals include, but are not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, aircraft, smartwatches, etc. Please refer to... Figure 1 As shown, the method for extracting the table from the image may include at least the following steps: In step 110, the target image containing the target table is obtained.
[0034] The target image can be a regular image file in format such as PNG or JPEG, or it can be an image located in a file in format such as PDF or .pptx.
[0035] The target image may include at least one table, and the target table may be any table in the target image.
[0036] The target form could be, for example, a form in a civil judgment.
[0037] Figure 2 A flowchart illustrating the specific steps involved in obtaining a target image containing a target table according to an embodiment of this application is shown. Please refer to... Figure 2 As shown, obtaining the target image containing the target table can specifically include the following steps: In step 210, the original image containing the target table is obtained.
[0038] The original image can be a regular image file in format such as PNG or JPEG, or it can be an image located in a file in format such as PDF.
[0039] The original image may include at least one table, and the target table may be any table in the original image.
[0040] The original image can be an image uploaded by the user through a pre-defined page provided by the system.
[0041] In step 220, the original image is scaled to obtain a scaled image.
[0042] Bilinear interpolation can be used to scale the original image, which will scale the original image according to a certain ratio, making its distortion less severe.
[0043] In step 230, if it is determined that the scaled image is a blurred image, then after performing super-resolution processing on the scaled image, the target image is obtained based on the processed image.
[0044] Before performing step 230, a super-resolution classification model can be used to perform fuzzy binary classification on the scaled image to determine whether the scaled image is a fuzzy image; if the scaled image is not a fuzzy image, the target image can be obtained based on the scaled image.
[0045] The super-classification model can be the YOLOv11 model or other models.
[0046] Super-resolution models can be used to perform super-resolution processing on scaled images. These super-resolution models can be the NAFNet model or other models.
[0047] In one embodiment of this application, the step of acquiring a target image based on a processed image includes: performing orientation detection on the processed image, and correcting the orientation of the processed image when an orientation anomaly is detected, to obtain an orientation-corrected image; performing image grayscale processing on the orientation-corrected image to obtain a grayscale image; performing edge detection on the grayscale image, and performing binarization processing based on the detection results to obtain a black and white line image; performing table position detection on the black and white line image to obtain an original table region image; performing line type classification on the original table region image to obtain a line type classification result, wherein the line type classification result is any one of the following: wired, wireless; and acquiring a target image based on the original table region image.
[0048] The orientation detection of the processed image determines whether the table orientation is normal. If the table orientation (e.g., the table header orientation) is not normal (e.g., the table is tilted, upside down, or slanted), then the orientation is abnormal. If no orientation abnormality is detected, subsequent steps can be performed directly based on the processed image.
[0049] Converting the image to grayscale after orientation correction yields a grayscale image containing only black, white, and gray tones.
[0050] Canny edge detection can be used to obtain images that retain lines, contours, and boundary information as detection results.
[0051] You can use the layout model to select the table area in the black and white line drawing to obtain the original table area image.
[0052] The YOLOv11-CLS model can be used to classify tables in the original table region image into wired and wireless types. That is, it can determine whether the found table is a wired table (with horizontal and vertical border lines) or a wireless table (without obvious borders, relying only on content layout) to obtain the line type classification result, thereby completing the table type differentiation.
[0053] In one embodiment of this application, obtaining the target image based on the original table region image includes: performing table contour edge instance segmentation on the original table region image to obtain a table region image; and performing table contour perspective correction on the table region image to obtain the target image.
[0054] A deep learning model based on convolutional neural networks (CNN) can be used to segment the table contour edges to obtain the bounding box coordinates and corresponding fine mask of each table. Then, the table region image can be separated based on the bounding box coordinates and corresponding fine mask of each table.
[0055] Table outline perspective correction refers to correcting tilted or perspective-distorted table areas into a square, upright, and distortion-free regular shape, facilitating subsequent identification of table content.
[0056] In step 120, table information is extracted from the target table in the target image to obtain multiple table element information and confidence information corresponding to at least one of the table element information.
[0057] It can obtain the confidence information corresponding to each table element in some or all of the table element information.
[0058] In one embodiment of this application, the step of extracting table information from the target table in the target image to obtain multiple table element information and confidence information corresponding to at least one of the table element information includes: identifying the table element information of the target table in the target image based on at least one recognition model to obtain multiple candidate table element information and confidence information corresponding to each candidate table element information for each position in at least one position of the target table; for each position in at least one position, determining the table element information corresponding to the position from the multiple candidate table element information corresponding to the position according to the confidence information corresponding to the multiple candidate table element information corresponding to the position, and obtaining the confidence information corresponding to the table element information.
[0059] At least one recognition model may include a symbol and handwritten font detection and recognition model as well as an optical character recognition (OCR) model.
[0060] The symbol and handwritten font detection and recognition model can be the YOLOv11 detection model, which can detect checkmark symbols and perform handwritten font detection and recognition.
[0061] Optical character recognition (OCR) models can detect and recognize printed text.
[0062] Confidence information is probability. Each recognition model can include a softmax classification layer. The softmax function is essentially a normalized exponential function that can "compress" a K-dimensional vector containing arbitrary real numbers into another K-dimensional real vector, such that each element is in the range (0, 1) and the sum of all elements is 1.
[0063] The calculation process of the Softmax function can be summarized as follows: 1. Perform an exponential operation on each element of the input vector ( 1. Convert negative numbers to positive numbers and amplify numerical differences. 2. Sum all the exponentiation results to obtain the normalized denominator. 3. Divide the exponent value of each element by the sum to obtain the corresponding probability.
[0064] Each element in the input vector can correspond to a candidate table element, and the probability corresponding to each element is the confidence information corresponding to the candidate table element.
[0065] In one embodiment of this application, determining the table element information corresponding to the position from the multiple candidate table element information corresponding to the position based on the confidence information corresponding to each of the multiple candidate table element information corresponding to the position includes: selecting the candidate table element information with the highest confidence information from the multiple candidate table element information corresponding to the position as the table element information corresponding to the position.
[0066] In step 130, a target page including the target table is constructed based on the multiple table element information and the confidence information corresponding to at least one of the table element information, and the target page is displayed through the target terminal; the target page visually displays the multiple table element information of the target table and the confidence information corresponding to at least one of the table element information.
[0067] The target page can be constructed based on the confidence information corresponding to all obtained table element information, or it can be constructed based only on the confidence information corresponding to a portion of the obtained table element information. For example, the target page including the target table can be constructed based only on confidence information greater than a predetermined confidence threshold. That is, after obtaining the confidence information corresponding to at least one of the table element information, the resulting target page including the target table may only include: confidence information based on a portion, rather than all, of the confidence information corresponding to at least one of the table element information.
[0068] After obtaining the target page, which includes the target table, the target page can be returned to the terminal of the original image or the provider of the target image (such as the user) and displayed.
[0069] The target page can also provide an entry point for editing table elements. Users can trigger the table element editing entry point based on the confidence information and / or color mark corresponding to the table element information, and edit the table element information of the target table online.
[0070] After obtaining information on multiple table elements, they can be sorted according to their corresponding positions, and the target table can be restored based on the sorting results. For example, it can be restored into an HTML target page for output.
[0071] In one embodiment of this application, the step of constructing a target page including a target table based on the plurality of table element information and confidence information corresponding to at least one of the table element information includes: constructing a target page including a target table matching the line classification result based on the plurality of table element information, confidence information corresponding to at least one of the table element information, and the line classification result.
[0072] The line type used in the target table on the constructed target page can be the line type indicated by the line type classification result, thereby achieving accurate restoration of the target table in the target image.
[0073] Confidence information can be displayed directly in the target table on the target page, or it can be displayed indirectly in other forms.
[0074] In one embodiment of this application, the target table displayed on the target page includes at least one color marker corresponding to the table element information; the color of the color marker is determined based on the confidence information corresponding to the table element information.
[0075] Color marking is actually a way to display confidence information. Color marking can be a colored underline on the text of the table element information, or it can be the background color of the corresponding table element information (such as the background color of the cell where the table element information is located).
[0076] Of course, this application can also be used to extract text, and the extracted text can also be displayed with a colored wavy line to show the corresponding confidence information.
[0077] Multiple confidence intervals can be preset, and a corresponding color marker can be assigned to each confidence interval; the color markers for different confidence intervals can be different. For a given table element, the color marker can be determined based on the confidence interval to which the corresponding table element belongs.
[0078] For example, the lower the confidence interval of the confidence information corresponding to the table element information, the darker the color of the corresponding color mark can be.
[0079] For example, three confidence intervals can be set: (0, 0.4], (0.4, 0.7], and (0.7, 1).
[0080] The color of the color marker corresponding to (0, 0.4) (such as the background color corresponding to the table element information) can be red, the color of the color marker corresponding to (0.4, 0.7) can be gray, and the color of the color marker corresponding to (0.7, 1) can be green.
[0081] For example, when the confidence level of a table element is below 0.5, the wavy line corresponding to the table element can be red; when the confidence level of a table element is between 0.5 and 0.8, the wavy line corresponding to the table element can be blue.
[0082] The color markings corresponding to table element information, determined based on confidence level information, can be implemented using front-end JavaScript code.
[0083] Figure 3 An embodiment according to this application is shown. Figure 1 A flowchart of the steps following step 130 in this embodiment. Please refer to [link / reference]. Figure 3As shown, after the target page is displayed on the target terminal, the method for extracting the table from the image may further include the following steps: In step 140, when the cursor is detected to be hovering over the target table element information of the target table, the confidence information corresponding to the target table element information is popped up.
[0084] When a user moves the mouse cursor over the paragraph corresponding to the underlined wavy line, a floating tooltip can be used to display the specific confidence value of that paragraph.
[0085] When a user moves the mouse cursor over the cell corresponding to the target table element information in the target table, a floating tooltip can be used to display the specific confidence value of that target table element information.
[0086] The following describes an apparatus embodiment of this application, which can be used to execute the method for extracting tables from images in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method for extracting tables from images in the above embodiments of this application.
[0087] Figure 4 A block diagram of an apparatus for extracting a table from an image according to an embodiment of this application is shown. (Refer to...) Figure 4 As shown, an image table extraction device 400 according to an embodiment of this application includes: an image acquisition unit 410, a table information extraction unit 420, and a page construction unit 430. The image acquisition unit 410 is used to acquire a target image containing a target table; the table information extraction unit 420 is used to extract table information from the target table in the target image to obtain multiple table element information and at least one confidence information corresponding to each table element information; the page construction unit 430 is used to construct a target page including the target table based on the multiple table element information and the confidence information corresponding to at least one table element information, and to display the target page through a target terminal; the target page visually displays multiple table element information and at least one confidence information corresponding to the target table.
[0088] In some embodiments of this application, based on the foregoing scheme, the target table displayed on the target page includes at least one color mark corresponding to the table element information; the color of the color mark is determined according to the confidence information corresponding to the table element information.
[0089] In some embodiments of this application, based on the foregoing scheme, the device further includes an information pop-up unit; after the target page is displayed through the target terminal, the information pop-up unit is used to: when the cursor is detected to be hovering over the target table element information of the target table, pop up the confidence information corresponding to the target table element information.
[0090] In some embodiments of this application, based on the foregoing scheme, the table information extraction unit 420 is configured to: identify the table element information of the target table in the target image based on at least one recognition model, and obtain multiple candidate table element information and confidence information corresponding to each position in at least one position of the target table; for each position in at least one position, determine the table element information corresponding to the position from the multiple candidate table element information corresponding to the position according to the confidence information respectively, and obtain the confidence information corresponding to the table element information.
[0091] In some embodiments of this application, based on the foregoing scheme, the image acquisition unit 410 includes an original image acquisition subunit, a scaling processing subunit, and a post-processing subunit; the original image acquisition subunit is used to: acquire an original image containing the target table; the scaling processing subunit is used to: scale the original image to obtain a scaled image; the post-processing subunit is used to: if it is determined that the scaled image is a blurred image, then after performing super-resolution processing on the scaled image, acquire the target image based on the processed image.
[0092] In some embodiments of this application, based on the foregoing scheme, the post-processing subunit is configured to: perform orientation detection on the processed image, and correct the orientation of the processed image when an orientation anomaly is detected, to obtain an orientation-corrected image; perform image grayscale processing on the orientation-corrected image to obtain a grayscale image; perform edge detection on the grayscale image, and perform binarization processing based on the detection result to obtain a black and white line image; perform table position detection on the black and white line image to obtain an original table region image; perform line type classification on the original table region image to obtain a line type classification result, wherein the line type classification result is any one of the following: wired, wireless; obtain a target image based on the original table region image; the page construction unit 430 is configured to: construct a target page including a target table matching the line type classification result based on the plurality of table element information, the confidence information corresponding to at least one of the table element information, and the line type classification result.
[0093] In some embodiments of this application, based on the foregoing scheme, the post-processing subunit is configured to: perform table outline edge instance segmentation on the original table region image to obtain a table region image; and perform table outline perspective correction on the table region image to obtain a target image.
[0094] Figure 5 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0095] It should be noted that, Figure 5 The computer system 500 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0096] like Figure 5 As shown, the computer system 500 includes a CPU 501, which can perform various appropriate actions and processes according to a program stored in ROM 502 or a program loaded into RAM 503 from storage section 508, such as performing the methods described in the above embodiments. The RAM 503 also stores various programs and data required for system operation. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An I / O interface 505 is also connected to the bus 504.
[0097] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. Removable media 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 510 as needed so that computer programs read from them can be installed into storage section 508 as needed.
[0098] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by CPU 501, it performs various functions defined in the system of this application.
[0099] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0101] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0102] In one aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.
[0103] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0104] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0105] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0106] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for extracting tables from an image, characterized in that, The method includes: Obtain the original image containing the target table; The original image is scaled to obtain a scaled image; If the scaled image is determined to be a blurred image, then after super-resolution processing of the scaled image, orientation detection is performed on the processed image, and orientation correction is performed on the processed image when an orientation abnormality is detected, to obtain an orientation-corrected image. The image after orientation correction is converted to grayscale to obtain a grayscale image; Edge detection is performed on the grayscale image, and binarization is performed based on the detection results to obtain a black and white line image; Perform table position detection on the black and white line graph to obtain the original table area image; The original table area image is subjected to line type classification to obtain a line type classification result, which is any one of the following: wired or wireless; Obtain a target image containing the target table based on the original table region image; The target table in the target image is subjected to table information extraction to obtain multiple table element information and confidence information corresponding to at least one of the table element information; Based on the multiple table element information, the confidence information corresponding to at least one of the table element information, and the line type classification result, a target page is constructed including a target table matching the line type classification result, and the target page is displayed through a target terminal; the target page visually displays multiple table element information of the target table and the confidence information corresponding to at least one of the table element information; the target table displayed on the target page includes a color mark corresponding to at least one of the table element information; the color of the color mark is determined based on the confidence information corresponding to the corresponding table element information; When the cursor is detected to be hovering over the target table element information, the confidence information corresponding to the target table element information is displayed.
2. The method for extracting tables from images according to claim 1, characterized in that, The step of extracting table information from the target table in the target image to obtain multiple table element information and confidence information corresponding to at least one of the table element information includes: Based on at least one recognition model, the table element information of the target table in the target image is recognized to obtain multiple candidate table element information and confidence information corresponding to each position in at least one position of the target table. For each of at least one location, based on the confidence information corresponding to the multiple candidate table element information corresponding to the location, the table element information corresponding to the location is determined from the multiple candidate table element information corresponding to the location, and the confidence information corresponding to the table element information is obtained.
3. The method for extracting tables from an image according to claim 1, characterized in that, The step of obtaining the target image based on the original table region image includes: The original table region image is segmented into table outline edges to obtain a new table region image. The table region image is subjected to table outline perspective correction to obtain the target image.
4. A device for extracting tables from an image, characterized in that, The apparatus is used to implement the method for extracting tables from an image as described in any one of claims 1 to 3, the apparatus comprising: An image acquisition unit is used to acquire a target image containing the target table. A table information extraction unit is used to extract table information from the target table in the target image to obtain multiple table element information and confidence information corresponding to at least one of the table element information. A page construction unit is configured to construct a target page including a target table based on the plurality of table element information and confidence information corresponding to at least one of the table element information, and display the target page through a target terminal; the target page visually displays the plurality of table element information and confidence information corresponding to at least one of the table element information; the target table displayed on the target page includes a color mark corresponding to at least one of the table element information; the color of the color mark is determined based on the confidence information corresponding to the corresponding table element information.
5. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method for extracting tables from an image as described in any one of claims 1 to 3.
6. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method for extracting tables from an image as described in any one of claims 1 to 3.
Citation Information
Patent Citations
End-to-end table detection and structure identification method and system
CN113435240A
Table image recognition method, apparatus and device, and computer storage medium
CN116935425A