Handwritten table structure recognition and Excel cooperative processing method and system

By detecting table lines through image preprocessing and morphological operations, combined with OCR engine recognition of text content, and in collaboration with Excel templates, the problems of merged cells and text positioning in handwritten table structure recognition are solved, achieving efficient automated processing and accurate spreadsheet generation.

CN121354150APending Publication Date: 2026-01-16SINOMACH IND INTERNET RES INST (HENAN) CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511498332.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-20
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

Existing technologies have weak ability to recognize merged cells when processing complex handwritten tables. They may result in missing, incorrectly merged, or misaligned ranges, misalignment of text content and cell ownership, and poor adaptability to non-standard layouts. This leads to distortion of the spreadsheet's logical structure, requiring users to perform extensive manual corrections and hindering the efficiency of automated office work.

Method used

Image preprocessing and morphological operations are used to detect table lines and identify merged cell regions. The text content is recognized by an OCR engine, and a row and column logical mapping relationship is established based on an Excel template to generate a consistent spreadsheet.

Benefits of technology

It improves the accuracy of reconstructing merged cells, reduces text content positioning errors, reduces manual correction time, enhances the robustness of the system, and adapts to various real-world handwritten table scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121354150A_ABST
    Figure CN121354150A_ABST
Patent Text Reader

Abstract

The invention discloses a handwritten table structure recognition and Excel cooperative processing method and system, relates to the technical field of computer vision, and comprises the steps of image preprocessing, table structure recognition, cell positioning, content recognition, Excel template analysis and text mapping. The system preprocesses the input image; respectively extracting horizontal and vertical lines based on morphological operation, and identifying a logic rank range of the merged cells; calculating a cell pixel bounding box through the cross points, and carrying out logic sorting and interference filtering; independently cutting each cell and calling a handwriting OCR (Optical Character Recognition) engine to extract text content; matching a preset Excel template according to the header or the code, and analyzing the coordinates of the combined and non-combined cells of the Excel template; and accurately mapping the identification content to the corresponding position of the Excel based on the row and column logic sequence numbers by taking the anchor point cell as a reference, and generating a spreadsheet. According to the method, the problems of inaccurate merging cell recognition, content dislocation and the like are effectively solved, and the electronization precision and efficiency of the handwritten form are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and in particular to a method and system for handwritten table structure recognition and Excel collaborative processing. Background Technology

[0002] Currently, the technology for converting handwritten table images into structured spreadsheets (such as .xlsx format) mainly relies on OCR and table reconstruction algorithms. Tools such as Baidu Image to Table and Quark OCR exist on the market; their basic process involves OCR recognition of the image and then inferring the table structure based on text location. However, such methods have significant drawbacks when processing complex handwritten tables:

[0003] The ability to recognize merged cells is weak, often resulting in missing merges, incorrect merges, or misaligned ranges, leading to distortion of the spreadsheet's logical structure. The text content and cell affiliation are misaligned, especially when table lines are connected to handwritten text, the handwriting is illegible, or the cells are densely packed, the OCR results are easily misassigned to adjacent cells. It has poor adaptability to non-standard layouts, such as nested tables and multi-line text within cells, where existing algorithms struggle to accurately resolve cell boundaries and hierarchical relationships.

[0004] The aforementioned problems force users to perform extensive manual corrections after conversion, severely hindering the efficiency of automated office work. Therefore, there is an urgent need for a processing method and system that can accurately recognize handwritten table structures (especially merged cells), precisely locate text content, and intelligently collaborate with Excel templates. Summary of the Invention

[0005] To overcome the shortcomings of the prior art, this invention discloses a method and system for handwritten table structure recognition and Excel collaborative processing.

[0006] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:

[0007] A method for handwritten table structure recognition and collaborative processing with Excel includes the following steps:

[0008] S1. Preprocess the input handwritten table image, including image cropping, tilt correction and background noise filtering, to obtain a standardized image;

[0009] S2. Based on the standardized image, use morphological operations to detect horizontal and vertical lines respectively, construct a binary image of table lines, and identify the original table structure and merged cell areas by analyzing the line intersection and interruption features, and output the starting row, starting column, ending row and ending column of each merged cell.

[0010] S3. Based on the detected intersections of horizontal and vertical lines, calculate the pixel bounding boxes of all cells, sort the bounding boxes in order of row priority and column priority, remove interference areas with width and height less than a preset threshold, and obtain a structured cell position list.

[0011] S4. Based on the structured cell location list, crop the image of each cell area, and call the handwriting OCR engine to recognize the text content in each cell, generating cell content-location mapping data;

[0012] S5. Based on the header or coding information in the handwritten table, match the corresponding Excel template file from the preset Excel template library, and parse the valid data range, the coordinate range of merged cells and the coordinate range of non-merged cells in the template.

[0013] S6. Establish a row and column logical mapping relationship between the handwritten table and the Excel template: Using the first valid cell in the handwritten table as the anchor point, match the corresponding logical position in the Excel template, and map the recognized text content to the corresponding cell in the Excel template according to the row and column order to generate a consistent and accurate spreadsheet file.

[0014] Preferably, the following algorithm is used to identify the table structure in step S2:

[0015] Erosion and dilation operations are performed on the binarized image using horizontal structuring elements with a height of rows / scale and vertical structuring elements with a width of cols / scale, respectively, to extract horizontal and vertical lines. The extracted horizontal and vertical lines are then weighted, fused, and inverted, and then subjected to little kernel erosion and thresholding to generate the final table-structured binary image.

[0016] Preferably, the relative position sorting in step S3 includes:

[0017] Based on the top-left y-coordinate of the cell bounding box, group bounding boxes with y-coordinate differences within a preset threshold into the same row; sort the bounding boxes in each row in ascending order of x-coordinate to form a left-to-right order within the row; merge all sorted results from top to bottom in each row and output a globally ordered list of cells.

[0018] Preferably, in step S5, when parsing the Excel template, all merged cell regions are first identified, and then cells that overlap with merged cells are removed from the valid data region, thereby accurately separating the coordinate sets of merged cells and non-merged cells.

[0019] Preferably, in step S6, a mapping relationship is established based on the row and column logical sequence numbers to eliminate spatial errors caused by image scanning offset or cropping.

[0020] A handwritten table structure recognition and Excel collaborative processing system includes:

[0021] The image preprocessing module is used to perform cropping, tilt correction, and background filtering on handwritten form images;

[0022] The table structure recognition module is used to detect horizontal and vertical lines and identify the row and column ranges of merged cells;

[0023] The cell positioning module is used to calculate the cell pixel coordinates based on the intersection points, and to perform row / column sorting and interference filtering;

[0024] The content recognition module is used to extract text content by calling the OCR engine after cropping each cell area;

[0025] The Excel template parsing module is used to match templates based on headers or codes, and parse the coordinates of merged and non-merged cells.

[0026] The text mapping module is used to map the recognized content to the corresponding position in the Excel template based on the anchor cell and the row and column logic, thereby generating the final spreadsheet.

[0027] Preferably, the table structure recognition module uses morphological erosion-dilation operations to extract horizontal and vertical lines respectively, and determines the boundaries of merged cells by line interruption features.

[0028] Preferably, the cell positioning module is configured with a cell sorting submodule, which is used to perform row partitioning based on y-coordinate clustering and column alignment based on x-coordinate sorting.

[0029] Preferably, the Excel template parsing module prioritizes extracting merged cell regions during parsing and excludes overlapping parts from the valid region to accurately obtain the set of non-merged cells.

[0030] Preferably, the text mapping module uses row and column logical indices for mapping to ensure that the mapping result is not affected by image geometric deformation.

[0031] By employing the technical solution described above, the present invention has the following beneficial effects:

[0032] (1) The accuracy of cell reconstruction by merging is significantly improved by the present invention, and the loss, incorrect merging and range offset of the existing technology are effectively avoided.

[0033] (2) The text content positioning accuracy of the present invention is high. Through cell cropping + OCR local recognition strategy, the misrecognition across cells is greatly reduced.

[0034] (3) The manual correction time in the later stage of the present invention is reduced by 70%–90%, and the output results can be directly used for data analysis and business system integration.

[0035] (4) The system of the present invention is robust and can adapt to various actual handwritten table scenarios such as tilt, blur, cluttered background, and incomplete wireframe. Attached Figure Description

[0036] Figure 1 This is a flowchart of the overall processing of the present invention;

[0037] Figure 2 A flowchart for the module that locates the position of a handwritten table cell;

[0038] Figure 3 This is a flowchart for the Excel spreadsheet template parsing module. Detailed Implementation

[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0040] In the description of this invention, it should be noted that the terms "upper" and "lower" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship in which the product of this invention is usually placed when in use. They are only used to facilitate the description of this invention and to simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0041] In this application, unless otherwise expressly specified and limited, the terms "installation," "connection," "joining," "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0042] Example 1:

[0043] Combined with appendix Figures 1-3 A method for handwritten table structure recognition and collaborative processing with Excel includes the following steps:

[0044] In step S1, the system first receives the handwritten table image uploaded by the user and performs systematic data preprocessing on the handwritten table image to be processed. This preprocessing process includes three core operations: image cropping, tilt correction, and background noise filtering.

[0045] Specifically, the effective content area in the image is first determined through edge detection or user interaction, and redundant blank spaces or irrelevant backgrounds around the image are cropped. Then, if the image is tilted due to shooting or scanning (e.g., table lines are not horizontal or vertical), the tilt angle is calculated using Hough transform or minimum bounding rectangle methods, and geometric correction is performed through affine transformation to restore the table to a standard frontal viewing angle. Finally, image segmentation, morphological operations, or deep learning background removal models are used to remove interfering elements such as watermarks, shadows, and paper textures from the image, preserving clear table lines and handwritten content. In this embodiment, image super-resolution technology (such as ESRGAN) can be further introduced to enhance the low-resolution image, improving the recognizability of small or blurry handwritten characters, thereby obtaining a high-quality binarized input image, laying the foundation for subsequent structure recognition.

[0046] Step S2 involves recognizing the handwritten table structure based on the preprocessed binarized image. This step employs OpenCV-based image processing technology, first detecting vertical and horizontal lines in the image separately. Specifically, a scale parameter (e.g., scale=20) is set, and a rectangular structuring element with a width of cols / / scale is constructed based on the image width cols as the vertical line kernel. This kernel is then eroded and dilated to extract all vertical lines. Similarly, a horizontal line kernel with a height of rows / / scale is constructed based on the image height rows to extract all horizontal lines. Subsequently, the extracted horizontal and vertical line images are weighted and fused with a weight of 0.5. The fused result is then inverted, eroded using a 3×3 structuring element, and segmented using OTSU thresholding to generate the final binary image of the table skeleton. Based on this, by analyzing the distribution of table line intersections, line breaks, and the connectivity of blank areas, all merged cell regions are identified. The starting row, starting column, ending row, and ending column coordinates of each merged cell are accurately calculated, outputting complete table structure information, including whether each cell is a merged cell and its boundary range.

[0047] Step S3: Based on the table structure output in step S2, further locate the pixel coordinates of each cell. Specifically, first, extract the pixel positions of all horizontal and vertical lines from the table skeleton image, calculate their intersection points, and thus initially divide all candidate cell regions. Use the bounding rectangle of each region as a bounding box, and record its top-left corner coordinates (x, y) and width and height. Since pixel offsets or incomplete table lines may exist in the actual image, causing bounding box position deviations, it is necessary to sort and correct the coordinates of all bounding boxes.

[0048] The sorting algorithm is as follows: Traverse all bounding boxes, using the y-coordinate as the row reference, grouping bounding boxes with a y-coordinate difference not exceeding a preset threshold (e.g., 10 pixels) into the same row; sort the bounding boxes within each row in ascending order of their x-coordinates; simultaneously, remove abnormally small boxes with a width or height less than a preset threshold (e.g., 5 pixels) to avoid misclassifying a single interfering black line as a valid cell. The final output is a list of cell positions arranged in a logical order from left to right and top to bottom, with each cell containing precise pixel coordinates and a row / column logical index.

[0049] Step S4: Perform handwritten table content recognition. For each cell bounding box obtained in Step S3, a sub-image of the corresponding region is cropped from the original preprocessed image, and a high-precision handwritten OCR engine (such as an OCR model based on Transformer or CRNN architecture) is called to perform text recognition on the sub-image. To improve recognition robustness, the OCR engine is specifically optimized for handling handwritten text that is closely connected to the table lines, has messy handwriting, or contains cursive strokes, and can perform post-processing corrections based on contextual semantics. The recognition result is output in the form of a text string, and a one-to-one mapping relationship is established with the logical position of the corresponding cell (such as the i-th row and j-th column), forming a structured "position-content" data pair.

[0050] Step S5: Parsing the Excel template. The system pre-builds an Excel template library, with each template corresponding to a handwritten table format specific to a particular business scenario (such as expense reports, attendance sheets, etc.). When the handwritten table image contains header text or a unique code, the system retrieves and loads the corresponding Excel template file from the template library through text matching or code recognition. Then, it parses the current worksheet of the Excel file: first, it determines the valid data area (i.e., the maximum range of non-empty rows and columns); then, it traverses all cells, identifies existing merged cells, and records their starting row, starting column, ending row, ending column, and merged content; simultaneously, it excludes parts overlapping with the coordinates of merged cells in the non-merged area, ensuring that each logical cell is processed only once. Finally, the system obtains the complete cell structure information of the template, including the precise coordinates of merged and non-merged cells and their original content.

[0051] Step S6 involves performing text content mapping and collaborative data writing. The system uses the content and position of the first valid cell in the handwritten table (e.g., the first cell in the header) as the anchor point, matching the corresponding position in the Excel template to establish a row-column logical mapping relationship between the handwritten table and the Excel template. Subsequently, based on the cell logical row and column indices obtained in step S4, the recognized text content is sequentially written into the cells at the corresponding coordinate positions in the Excel template. For merged cells, the system ensures that the content is only written to the top-left cell of the merged area, preserving the original merged format; for non-merged cells, the content is directly filled. The final generated Excel file faithfully reproduces the original handwritten table in terms of table structure (especially the layout of merged cells) and text content, and can be directly used for subsequent data calculation, analysis, or archiving, requiring little or no manual proofreading.

[0052] Example 2:

[0053] Combined with appendix Figures 1-3 A handwritten table structure recognition and Excel collaborative processing system includes an image preprocessing module, a table structure recognition module, a cell positioning module, a content recognition module, an Excel template parsing module, and a text mapping module. The image preprocessing module performs cropping, skew correction, and background filtering on the handwritten table image. The table structure recognition module detects horizontal and vertical lines and identifies the row and column ranges of merged cells. The cell positioning module calculates the cell pixel coordinates based on intersection points and performs row / column sorting and interference filtering. The content recognition module crops each cell area and then uses an OCR engine to extract the text content. The Excel template parsing module matches the template based on the table header or code and parses the coordinates of merged and non-merged cells. The text mapping module uses anchor cells as a reference and maps the recognized content to the corresponding position in the Excel template according to row and column logic to generate the final spreadsheet.

[0054] Specifically, the image preprocessing module receives handwritten form images (such as JPG or PNG formats) uploaded by the user. Since images in actual acquisition scenarios often have edge redundancy, shooting tilt, or background interference, the preprocessing module first standardizes the original image to improve the robustness of subsequent recognition. This includes three sub-steps:

[0055] Image cropping: Automatically identify the smallest bounding rectangle region containing the table content through edge detection algorithms (such as the Canny operator) or based on connected component analysis, and crop out this region, removing irrelevant edge content.

[0056] Tilt correction: Apply Hough linear transform to the cropped image to detect the direction angle of the main horizontal or vertical table lines in the image; if a significant tilt is detected (such as an absolute angle greater than 2°), rotate the image to a horizontally aligned state through affine transformation to ensure the accuracy of subsequent line detection.

[0057] Background noise removal and enhancement: Adaptive Gaussian thresholding is used to convert the image into a black and white binary image. Then, morphological opening operations (erosion followed by dilation) are used to remove isolated noise points, and closing operations are used to fill in the broken lines of the table. Finally, a standardized binary image with clear lines, prominent text, and a clean background is output. The output of this module is a high-quality binary image, which serves as the sole input for the next step of table structure recognition.

[0058] The table structure recognition module accurately extracts table lines from the preprocessed binary image and uses this to identify the logical structure of the original table, especially the boundaries of merged cells. Its technical implementation is based on OpenCV morphological operations, and the specific process is as follows:

[0059] Get image dimensions: Let the image height be rows and the width be cols.

[0060] Vertical line detection: Construct a vertical rectangular structuring element kernel_col with a width of 1 pixel and a height of cols / / scale (scale is an adjustable parameter, typically 30-50); perform erosion (cv2.erode) and dilation (cv2.dilate) operations on the binary image in sequence to obtain the image dilated_col, which retains only the significant vertical lines.

[0061] Horizontal line detection: Similarly, construct a horizontal struct kernel_row (height is rows / / scale, width is 1), perform the same operation, and obtain dilated_row.

[0062] Table structure fusion: Dilated_row and dilated_col are fused with a weight of 0.5 (cv2.addWeighted) to obtain a preliminary table skeleton; then the skeleton is inverted (bitwise_not), and a 3×3 kernel is used to perform an erosion operation to connect broken segments. Finally, the final binary graph table_segment is generated by Otsu thresholding.

[0063] After obtaining the complete table line chart, the system further analyzes the continuity of the lines: if a rectangular area has neither horizontal lines crossing its top and bottom boundaries nor vertical lines crossing its left and right boundaries, then the area is determined to be a merged cell. By traversing all such areas, the system accurately calculates the logical coordinates of each merged cell, namely the starting row index, starting column index, ending row index, and ending column index (in cells, not pixels). This information will be used for subsequent cell positioning and Excel mapping.

[0064] The cell location module aims to generate a precise pixel bounding box for each cell based on the known table lines, and establish its logical row and column number in the table.

[0065] The specific implementation is as follows:

[0066] Intersection point extraction: Perform a bitwise AND operation on dilated_row and dilated_col to obtain the set of pixel coordinates of all horizontal and vertical line intersections.

[0067] Boundary box generation: Based on the x and y coordinates of the intersection points, sort and remove duplicates to form vertical dividing line columns and horizontal dividing line rows; the rectangle enclosed by two adjacent vertical lines and two horizontal lines is a candidate cell, and its upper left corner coordinates (x, y) and width and height (w, h) are recorded.

[0068] Interference filtering: Remove candidate boxes with a width or height smaller than a preset threshold (e.g., 5 pixels) to eliminate pseudo cells caused by line burrs or OCR interference.

[0069] Logical sorting, as shown in the appendix Figure 2 As shown: To establish the row and column logical relationships of cells, the system executes the following sorting algorithm:

[0070] Initialize the processed index set `processed_indices` and the result list `sorted_bounding_boxes`;

[0071] Iterate through all bounding boxes, and using the y-coordinate of the current box as a reference, group all boxes whose y-coordinate difference is ≤ a threshold (e.g., 10 pixels) into the same row;

[0072] Sort the bounding boxes within each row in ascending order of their x-coordinates;

[0073] Merge all rows from top to bottom and output a globally ordered list of bounding boxes, where the i-th box corresponds to the logical position [row_i, col_i].

[0074] This module outputs a structured list, where each element contains a pixel bounding box (x, y, w, h) and a logical row and column number (row, col), which serves as the basis for content recognition and localization.

[0075] The handwritten table content recognition module performs independent OCR recognition on each cell based on the cell position information output in the previous step.

[0076] The original preprocessed image (non-binary image) is cropped according to the pixel bounding box of each cell to generate independent sub-images;

[0077] A high-precision handwritten OCR engine (such as a model based on Transformer or CRNN architecture that supports Chinese handwritten text) is invoked to perform text recognition on each sub-image;

[0078] The recognition results are bound to the logical row and column numbers of the corresponding cells to form a mapping dictionary of "(row,col) - text content".

[0079] Because the recognition range is strictly limited to the cell, it effectively avoids the classification errors caused by text crossing cells in traditional full-text OCR, and is especially suitable for scenarios where multiple words are written in a row in merged cells or where the handwriting is close to the edge.

[0080] Excel template parsing module, as shown in the attached document Figure 3 As shown, to achieve seamless integration with business systems, prior knowledge of Excel templates is introduced. The system maintains a template library, and each template file is associated with a unique header keyword or code identifier.

[0081] Template matching: Based on the content of the header cells output by the content recognition module (such as the text in the first row and first column), keyword matching or regular expression matching is performed in the template library to locate the corresponding Excel file.

[0082] Template loading and parsing: Use libraries such as openpyxl or xlrd to load the Excel file and read the currently active worksheet.

[0083] Structural analysis:

[0084] Iterate through all cells in the worksheet, identify all merged cell ranges, and record the start / end row and column coordinates and the content of the main cell for each merged range.

[0085] Determine the valid data range (e.g., using the max_row and max_column attributes);

[0086] Within the valid area, exclude all child cells that belong to merged cells; the remaining cells are the set of non-merged cells.

[0087] Output two structured datasets: a list of merged cell coordinates and a list of unmerged cell coordinates, which together constitute the complete logical structure of the template.

[0088] The text content mapping module does not rely on absolute pixel coordinates, but rather on row and column logical indices for mapping, thereby eliminating geometric errors in the image acquisition process.

[0089] Anchor alignment: Using the cell with a logical position of [0,0] (i.e., the first row and first column) in the handwritten table as the anchor point, match the position in the Excel template that is also located at [0,0] (i.e., cell A1). If this position is a merged cell in the template, the content is written to its parent cell.

[0090] Row-to-column mapping: Traverse each (row,col) text pair in the handwritten table recognition results and find the corresponding logical cell in the Excel template:

[0091] If the location belongs to a merged cell, the text will be written to the main cell (top left corner) of the merged area.

[0092] If it is a regular cell, write directly.

[0093] Structural consistency guarantee: Since the logical row and column numbers of the handwritten table correspond one-to-one with the row and column structure of the Excel template, even if the original image has scaling, rotation residue or local deformation, the mapping result can still maintain structural alignment.

[0094] Finally, the system saves the filled Excel worksheet as a standard .xlsx file, which users can directly use for calculations, statistics, or import into business systems, requiring little or no manual correction.

[0095] The parts of this invention not described in detail are prior art. It will be apparent to those skilled in the art that this invention is not limited to the details of the above exemplary embodiments, and that the invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be regarded as exemplary and non-limiting in all respects, and are intended to encompass all changes falling within the meaning and scope of equivalents within this invention.

Claims

1. A method for handwritten table structure recognition and Excel co-processing, characterized in that, The method comprises the following steps: S1, preprocessing the input handwritten form image, including image cropping, tilt correction and background noise filtering, to obtain a standardized image; S2, based on the standardized image, using morphological operations to detect horizontal and vertical lines respectively, constructing a table line binary image, and identifying the original table structure and merged cell area by analyzing the line intersection and interruption characteristics, and outputting the starting row, starting column, ending row and ending column of each merged cell; S3, according to the detected horizontal and vertical line intersection points, calculating the pixel boundary box of all cells, and sorting the relative positions of the boundary boxes in the order of row first and column second, and removing the interference areas with width and height less than the preset threshold, to obtain a structured cell position list; S4, according to the structured cell position list, image cropping is performed on each cell area, and a handwritten OCR engine is called to recognize the text content in each cell, to generate cell content-position mapping data; S5, according to the table header or coding information in the handwritten form, matching the corresponding Excel template file from the preset Excel template library, parsing the effective data area, merged cell coordinate range and non-merged cell coordinate range in the template; S6, establishing the row-column logical mapping relationship between the handwritten form and the Excel template: taking the first effective cell in the handwritten form as the anchor point, matching the corresponding logical position in the Excel template, and mapping the recognized text content to the corresponding cells in the Excel template according to the row-column order, to generate an electronic form file with consistent structure and accurate content.

2. The method of claim 1, wherein the handwritten table structure recognition and Excel co-processing method is characterized by, The following algorithm is used in step S2 to identify the table structure: The binary image is respectively subjected to erosion and expansion operations using horizontal structure elements with a height of rows / scale and vertical structure elements with a width of cols / scale to extract horizontal lines and vertical lines; the extracted horizontal lines and vertical lines are weighted and fused, then inverted, and then subjected to small kernel erosion and threshold processing to generate a final table structure binary image.

3. The method of claim 1, wherein the handwritten table structure recognition and Excel co-processing method is characterized by, The relative position sorting in step S3 includes: Taking the y-coordinate of the top-left corner of the cell boundary box as the reference, the boundary boxes with a y-coordinate difference within a preset threshold are classified into the same row; the boundary boxes in each row are sorted in ascending order of x-coordinate to form a left-to-right order in the row; all sorting results are combined from top to bottom by row to output a globally ordered cell list.

4. The method of claim 1, wherein the handwritten table structure recognition and Excel co-processing method is characterized by, In step S5, when parsing the Excel template, all merged cell areas are first identified, and then the cells overlapping with the merged cells are removed from the effective data area, so as to accurately separate the coordinate sets of the merged cells and the non-merged cells.

5. The method of claim 1, wherein the handwritten table structure recognition and Excel co-processing method is characterized by, In step S6, the mapping relationship is established based on the row-column logical serial numbers to eliminate spatial errors caused by image scanning offset or cropping.

6. A handwritten form structure recognition and Excel co-processing system, characterized by, It comprises: An image preprocessing module for performing cropping, tilt correction and background filtering on a handwritten form image; A table structure identification module for detecting horizontal and vertical lines and identifying the row-column range of merged cells; A cell positioning module for calculating cell pixel coordinates based on intersection points, and performing row / column sorting and interference filtering; A content recognition module is configured to call an OCR engine to extract text content after cropping each cell region; An Excel template analysis module is configured to match a template according to a table header or a code, and analyze merged and non-merged cell coordinates in the template; A text mapping module is configured to map the recognized content to a corresponding position of the Excel template according to a row-column logical relationship with the anchor cell as a reference, to generate a final electronic form.

7. The handwritten table structure recognition and Excel collaborative processing system according to claim 6, characterized in that: The table structure recognition module is configured to extract horizontal lines and vertical lines through morphological erosion and dilation operations respectively, and determine the boundaries of the merged cells through line interruption features.

8. The handwritten table structure recognition and Excel collaborative processing system according to claim 6, characterized in that: The cell positioning module is configured with a cell sorting submodule, which is configured to perform row division based on y-coordinate clustering and column alignment based on x-coordinate sorting.

9. The handwritten table structure recognition and Excel collaborative processing system according to claim 6, characterized in that: The Excel template analysis module is configured to extract merged cell regions preferentially during analysis, and exclude overlapping parts from the effective area to accurately obtain a non-merged cell set.

10. The handwritten table structure recognition and Excel collaborative processing method and system according to claim 6, characterized in that: The text mapping module is configured to use row-column logical serial numbers for mapping, to ensure that the mapping result is not affected by image geometric deformation.

Citation Information

Cited By

  • Semantic sorting method and recognition system for hydraulic cylinder engineering drawing table

    CN121963216A

  • A semantic sorting method and recognition system for hydraulic cylinder engineering drawing forms

    CN121963216B