A form rapid building method based on OCR recognition technology
By using OCR technology to automatically recognize and semantically match paper forms, the efficiency problem of manual data entry and import during the online transformation of paper forms has been solved, enabling fast and accurate form creation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NEW CORE TECH CO LTD
- Filing Date
- 2022-10-09
- Publication Date
- 2026-06-12
AI Technical Summary
In the process of transforming paper forms to online forms, existing technologies rely on manual data entry and Excel/Word import methods, which are time-consuming and labor-intensive. Furthermore, existing patents depend on electronic templates, which have limited applicability.
Using OCR recognition technology, the system takes photos of uploaded paper forms, checks their brightness and clarity, recognizes text data, performs semantic matching, automatically analyzes and matches field types, and generates forms based on preset layout schemes.
It enables rapid form recognition and construction, reduces manual data entry and comprehension costs, improves the accuracy of field type matching, and saves time and manpower costs.
Smart Images

Figure CN115600564B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of low-code technology, and in particular to a method for quickly building forms based on OCR recognition technology. Background Technology
[0002] Low-code development platforms (LCDPs) are development platforms that allow for the rapid generation of applications with no coding (zero code) or with minimal coding. Through a visual approach to application development (see visual programming languages), LCDPs enable developers of varying experience levels to create web and mobile applications using drag-and-drop components and model-driven logic via a graphical user interface.
[0003] Low-code form functionality is gradually replacing offline paper-based processes. However, in the transition from paper to online, a large number of offline paper forms need to be manually entered into the system and new forms need to be created. First of all, for people who are not familiar with low-code, or when the form content is large, manual entry is time-consuming and labor-intensive, and is also prone to omissions and errors.
[0004] Secondly, using the existing method of importing and creating forms in Excel / Word requires first completing the data entry from paper forms to Excel / Word documents. This also requires manual transcription before importing, which consumes a lot of manpower and time.
[0005] Finally, the existing Chinese patents, namely CN109784235A (titled "Automatic Entry Method, Apparatus, Computer Equipment and Storage Medium for Paper Forms") and CN109886108A (titled "A Method for Character Recognition and Information Entry in Arbitrary Areas of a Form"), although they also achieve form construction, are essentially constructed by entering data rather than recognizing text, and rely on existing electronic templates, thus limiting their applicability. Summary of the Invention
[0006] To address the technical problems mentioned in the background section, a method for quickly building forms based on OCR recognition technology is proposed.
[0007] To achieve the above objectives, the present invention adopts the following technical solution:
[0008] A method for quickly building forms based on OCR recognition technology includes the following steps:
[0009] S1: Upload a paper form image through the image upload entry on the form building page. After the image is successfully uploaded, call the OCR service interface to check the brightness and clarity of the image. For images that meet the inspection requirements, call the image recognition interface. For images that do not meet the inspection requirements, take a new photo and upload it.
[0010] S2: By calling the OCR text recognition service interface, obtain the text data in the returned image. The text data includes image resolution information, recognized text information and absolute position coordinates of the text in the image. If the image does not contain text, recognition fails and return to step S1.
[0011] S3: Perform semantic matching on the identified text to obtain the corresponding form components;
[0012] S4: Calculate the absolute position and width / height of the recognized text in the layout, and calculate the position of the field in the layout by combining the layout preset scheme;
[0013] S5: Arrange the identified form components according to their layout position and proportion to obtain a form preview page. Obtain a component list based on the identified form components. Manually adjust the component types in the component list and edit the form components in the form preview page.
[0014] S6: After confirming that the fields in the form preview page are correct, generate the form page on the form design page, set the form parameters, and complete the form creation.
[0015] As a further description of the above technical solution:
[0016] In step S3, the text semantic matching step includes:
[0017] S31: Perform precise and fuzzy matching between the recognized text and the field names in the database, obtain the set of form components corresponding to the matched field names, and group and count the form component sets, taking the component type with the most quantity in the group as the type of the text to be matched;
[0018] S32: When the matched component type is a single selection, multiple selection, or table, the field matching continues. For single selection or multiple selection, the option values will continue to be identified. For tables, the component type in the table will be identified according to step S31.
[0019] S33: When the unmatched component type is a combination of radio button, checkbox, or table, manually determine whether the recognized text is radio button, checkbox, or table, and add other fields to the combination type;
[0020] S34: If matching fails based on steps S31-S33, matching will be performed according to the semantic basic rules. If matching fails based on both the semantic basic rules and steps S31-S33, the component type will default to TEXT.
[0021] As a further description of the above technical solution:
[0022] In step S31, the exact field matching is as follows: the identified text to be matched is used as the matching condition and brought into the name.keyword in the query condition for keyword filtering. The filtered records are grouped and statistically analyzed according to the field type dataType. The type of the group with the largest number of statistics is taken as the semantic field type of the text.
[0023] As a further description of the above technical solution:
[0024] In step S31, the field fuzzy matching is as follows: when exact matching cannot match the data, word segmentation is used for fuzzy matching, and the type of the record with the highest relevance is taken as the type of the text to be matched. If there are multiple records with the highest relevance, the records are grouped according to the field type, and the type of the largest group is taken as the semantic type of the text.
[0025] As a further description of the above technical solution:
[0026] In step S32, when the matched type is a single selection or multiple selection, option matching will be performed. The option matching rules are as follows:
[0027] S321. Based on the data sample whose field type was confirmed in step S31, obtain the options attribute of these data, encapsulate all these options into a Set collection, remove duplicates, and obtain a union of options;
[0028] S322. Accurately match possible options by combining the union set into the OCR recognition data;
[0029] When the matched type is a table, the table header fields will be matched, and the matching rules are as follows:
[0030] S323. Based on the data samples whose field types were confirmed in step S31, obtain the tableField attributes of these data, encapsulate all these header fields into a Set collection, remove duplicates, and obtain a union of header fields;
[0031] S324. Accurately match possible options by combining the union set into the OCR recognition data.
[0032] As a further description of the above technical solution:
[0033] In step S1, an image sharpness evaluation algorithm is used to calculate the image sharpness. After processing the image using the Sobel operator in the Tenegrad function, the gradient values in the horizontal and vertical directions of the image are extracted. If the calculated gradient values are lower than the preset threshold, the image is judged not to meet the inspection requirements.
[0034] As a further description of the above technical solution:
[0035] In step S4, the preset schemes for form layout include: 1 / 2 line, 1 / 3 line, 1 / 4 line, 2 / 3 line, 3 / 4 line, and full line. A single line is allowed to have a maximum of 4 components. The relative position of the field in the form layout is calculated based on the text position recognized by OCR.
[0036] As a further description of the above technical solution:
[0037] In step S4, the form layout calculation steps are as follows:
[0038] S41. Based on the image width imageWidth, obtain the first recognized field, obtain the width attribute value of this field, calculate imageWidth-width. If the calculation result is less than 0, the first field occupies a separate row; otherwise, record this calculation result for the second calculation.
[0039] S42. Get the next field, use the previous calculation result to calculate the width again, until the calculation result is less than or equal to 0 or the number of fields reaches 4. Then perform the layout calculation for the next row. If the result is less than 0, the last field is not included in the current row. If the result is equal to 0, the last field is included in the current row.
[0040] S43. When the obtained field type is TABLE, the layout calculation for the next row is performed directly, and the TABLE occupies a single row. At the same time, the fields in the TABLE do not participate in the position calculation and are directly displayed in the TABLE.
[0041] As a further description of the above technical solution:
[0042] In step S5, the steps for obtaining the form preview interface are as follows:
[0043] S51. After all the recognized text has been matched, return the matched form data to the front end;
[0044] S52. After obtaining the form data, the front-end page generates a canvas using the recognized image as the background image, iterates through all field objects, overlays the recognized text and position onto the canvas, and displays the semantically encoded field names and types. The operable boxes in the canvas are associated with the semantically encoded form fields through a unique key.
[0045] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0046] 1. In this invention, firstly, users only need to take a picture of the form and upload it for quick recognition, eliminating the need to manually enter the information into Excel before importing it. This minimizes the time and manpower costs of manual entry and reduces the cost of information maintenance for users. Secondly, it adds a semantic recognition process. Through automatic recognition, it quickly analyzes and matches field types, helping users quickly understand the component types of the form. Users do not need to understand the differences in field types to quickly build the form, reducing the user's understanding cost.
[0047] 2. In this invention, rapid image recognition is particularly suitable for situations where there are many field components in a form. Through automatic processing of OCR and semantics, forms can be quickly entered and built, saving users a lot of time. The form can be quickly built with simple operations.
[0048] 3. In this invention, relying on the advantages of the platform's big data, based on historical data, it helps users automatically analyze and process field component types, thereby improving the accuracy of field type matching. Attached Figure Description
[0049] Figure 1 A flowchart illustrating a method for rapidly constructing a form based on OCR recognition technology according to an embodiment of the present invention is shown.
[0050] Figure 2 The diagram illustrates the working principle of a method for quickly building a form based on OCR recognition technology according to an embodiment of the present invention. Detailed Implementation
[0051] 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] Example 1
[0053] Please see Figure 1 and Figure 2 This invention provides a technical solution: a method for quickly building forms based on OCR recognition technology, comprising the following steps:
[0054] S1: Install / Log in to the low-code system: Log in to the low-code system and enter the form building page. The building page supports creating custom forms through field components, and also supports uploading images and automatically creating forms after image recognition.
[0055] S2: The user takes a photo of the paper form and uploads the image of the paper form through the image upload entry on the form building page. After the image is successfully uploaded, the OCR service interface is called. The service checks the brightness and clarity of the uploaded image. For images that meet the requirements, the image recognition interface is called to recognize the text in the image and the absolute position of the text in the entire image. For images that do not meet the brightness and clarity requirements, the user takes a new photo and uploads it.
[0056] The image brightness method is as follows: convert the image to a grayscale image, calculate the mean and variance of the grayscale value of the image, and images with a mean brightness value between 80 and 120 meet the brightness check requirements.
[0057] Image sharpness is calculated using an image sharpness evaluation algorithm. The principle is that a well-focused image has sharper edges and therefore a larger gradient function value. Specifically, the image sharpness check method is to use the Sobel operator in the Tenengrad function to extract the gradient values in the horizontal and vertical directions. The larger the value, the sharper the image. If the calculated gradient value is lower than the preset threshold, the image sharpness requirement is not met.
[0058] S3: By calling the OCR text recognition service interface, obtain the text data in the returned image. The text data includes image resolution information, recognized text information and absolute position coordinates of the text in the image, as shown below. The recognized image text is returned in the format from top to bottom, and the format is text / json. Each recognized phrase is an object. If the image does not contain text, recognition fails and returns to S2.
[0059] Here is an example of text data from the returned image:
[0060]
[0061]
[0062] Among them, Result: The result object returned by the OCR service includes the resolution information related to the image, the recognized text information, and the absolute position coordinates of the text in the image;
[0063] imageWidth: The width of the image, in pixels (px), and is a number.
[0064] imageHeight: Image height, in pixels (px), type is number;
[0065] `words`: The recognized text information. The `text` property is the content of the recognized text. `position` is the absolute position of the recognized text within the image. Absolute position means the distance of the text relative to the top-left corner of the image (0 axis). The `top` property is the top margin based on the x-axis, the `left` property is the left margin based on the y-axis, the `width` property is the width of the recognized text within the image, and the `height` property is the height of the recognized text within the image. Because multiple words, phrases, absolute positions, and widths / heights may be recognized within the image, this property is an array type.
[0066] S4: Perform semantic matching on the identified text to obtain the corresponding form components. The types of form components include: TEXT (single-line text), MULTI_TEXT (multi-line text), NUM (number), DATE (date), SELECT (single selection), MULTI_SELECT (multiple selection), ATTACHMENT (attachment), BOOLEAN (switch), PICTURE (image), and TABLE (table).
[0067] The form service database already contains a large number of form fields, each with its own field name and field type. The semantic matching process involves converting the text recognized by OCR into form fields. Each generated form field is a JSON object in the database. When performing semantic matching, the main attributes to focus on are: name (the name of the form field), dataType (the type of the form field), options (the options corresponding to the field when the type is single selection or multiple selection), and tableFields (the content is the table header when the type is a table).
[0068] Therefore, the specific steps for text semantic matching are as follows:
[0069] S41: Perform precise and fuzzy matching between the recognized text and field names in the database to obtain the set of form components corresponding to the matched field names. Group the set of form components and take the component type with the most occurrences in the group as the type of the text to be matched. Based on the accumulation of historical data, help users quickly determine the component type and reduce the user's understanding and usage costs. For example, if "name" matches 1,000 data in the database, including text, number and single selection types, but 800 of them are text type, then it can be inferred that the recognized "name" is most likely a text type field, helping users quickly determine the type of component.
[0070] Specifically, field fuzzy matching is as follows: when exact matching fails to match data, word segmentation is used for fuzzy matching, and the type of the record with the highest relevance is taken as the type of the text to be matched. If there are multiple records with the highest relevance, the records are grouped by field type, and the type of the largest group is taken as the semantic type of the text.
[0071] For example, when filtering employee names by keywords, the following implementation is shown. When using term matching, the name condition will be matched precisely, i.e.:
[0072]
[0073] Exact field matching involves using the identified text to be matched as a matching condition in the query condition name.keyword for keyword filtering, grouping and statistically analyzing the filtered records according to the field type dataType, and taking the type of the group with the largest number of statistics as the semantic field type of the text.
[0074] For example, when filtering employee names by word segmentation, using `match` will perform fuzzy matching on the `name` condition, i.e.:
[0075]
[0076]
[0077] S42: When the matched component type is a single selection, multiple selection, or table, the field matching continues. For single selection or multiple selection, the option values will continue to be identified. For tables, the component type in the table will be identified according to step S31.
[0078] Specifically, when the matched type is a single choice or multiple choice, the options will be matched according to the following rules:
[0079] S421. Based on the data sample whose field type was confirmed in step S41, obtain the options attribute of these data, encapsulate all these options into a Set collection, remove duplicates, and obtain a union of options;
[0080] S422. Accurately match possible options in the OCR recognition data by combining the union set. The sample range of the data to be matched is: the fields after the current matching field. The matching rule is: return the first match, and skip if no match is found.
[0081] When the matched type is a table, the table header fields will be matched, and the matching rules are as follows:
[0082] S423. Based on the data samples whose field types were confirmed in step S41, obtain the tableField attributes of these data, encapsulate all these header fields into a Set collection, remove duplicates, and obtain a union of header fields;
[0083] S424. Accurately match possible options in the OCR recognition data by combining the union set. The sample range of the data to be matched is: the fields after the current matching field. The matching rule is: return the first match, and skip if no match is found.
[0084] S43: When the unmatched component type is a combination of radio button, checkbox, or table, manually determine whether the recognized text is radio button, checkbox, or table, and add other fields to the combination type;
[0085] S44: If matching fails based on steps S41-S43, matching will be performed according to the semantic basic rules. If matching fails based on both the semantic basic rules and steps S41-S43, the component type will default to TEXT.
[0086] Specifically, the basic rules of semantic markup are:
[0087] Recognize text as time-related phrases, such as "birthday," "date," and "month," and identify them as date field types, corresponding to the DATE type of the form component;
[0088] Recognize text as quantity-related phrases, such as "unit price," "quantity," and "number," and identify them as numeric field types, corresponding to the form component type NUM;
[0089] If text is identified as image-related phrases, such as "avatar" or "photo", it will be recognized as an image field type, corresponding to the form component type PICTURE.
[0090] Recognize text as document-related phrases, such as "attachment" or "file," and identify it as an attachment field type, corresponding to the form component type ATTACHMENT;
[0091] Recognize text as phrases such as "name", "ID number", "school", and "address", and identify them as single-line text fields, corresponding to the TEXT form component type;
[0092] Recognize text as self-evaluation or introduction phrases, such as "personal self-evaluation" or "personal introduction," and identify it as a checkbox field type, corresponding to the form component type MULTI_TEXT;
[0093] S5: Calculate the absolute position and width / height of the recognized text in the layout, and calculate the position of the field in the layout by combining the layout preset scheme;
[0094] The preset layout schemes for the form include: 1 / 2 line, 1 / 3 line, 1 / 4 line, 2 / 3 line, 3 / 4 line, and full line. A single line is allowed to have a maximum of 4 components. The relative position of the field in the form layout is calculated based on the text position recognized by OCR.
[0095] Specifically, the form layout calculation steps are as follows:
[0096] S41. Based on the image width imageWidth, obtain the first recognized field, obtain the width attribute value of this field, calculate imageWidth-width. If the calculation result is less than 0, the first field occupies a separate row; otherwise, record this calculation result for the second calculation.
[0097] S42. Get the next field, use the previous calculation result to calculate the width again, until the calculation result is less than or equal to 0 or the number of fields reaches 4. Then perform the layout calculation for the next row. If the result is less than 0, the last field is not included in the current row. If the result is equal to 0, the last field is included in the current row.
[0098] S43. When the obtained field type is TABLE, the layout calculation for the next row is performed directly, and the TABLE occupies a single row. At the same time, the fields in the TABLE do not participate in the position calculation and are directly displayed in the TABLE.
[0099] S6: Arrange the identified form components according to their layout position and proportion to obtain a form preview page. Obtain a component list based on the identified form components. Manually adjust the component types in the component list and edit the form components in the form preview page.
[0100] Specifically, the steps to obtain the form preview interface are as follows:
[0101] S61. After all the recognized text has been matched, return the matched form data to the front, in the following format:
[0102]
[0103]
[0104] S62. After obtaining the form data, the front-end page uses the recognized image as the background image to generate a canvas with the same pixel size as layoutSize. The left side is the canvas, and the right side is the recognized data. Then, it iterates through all field objects in the template, overlaying the recognized text and position onto the canvas, and displays the semantically corrected field names and types in the list on the right. Specifically, once the recognized field information, field layout position information, and field default type information are obtained, this information can be displayed on the form generation editing page. This page is divided into two sections: the left canvas is the original recognized image, and the right side is the recognized data returned from the backend. The operable boxes in the left canvas are associated with the semantically corrected form fields on the right through a unique key. When a box on the left is clicked, the corresponding field on the right will also be highlighted, and when a field on the right is clicked, the box with the corresponding key on the left will also be highlighted.
[0105] Since OCR text recognition can also have errors, user confirmation is required. When the recognized text of a certain key is modified, the semantics will be rematched. When the user manually changes the field type, if it is changed from a non-composite field to a composite field, the composite field will no longer be matched, and the user will need to assemble the composite field himself. If it is changed from a composite field to a non-composite field, the other fields in the composite field will be rematched.
[0106] S7: After confirming that the fields in the form preview page are correct, generate the form page on the form design page, set the form parameters, such as decimal places, required fields, length, etc., and save the form to complete the form creation.
[0107] First, this invention does not require specialized scanning equipment; users can directly take photos with a regular mobile phone and transfer them to a computer for use, making the operation simpler and faster. Regarding image types, this invention supports the recognition of most image formats, such as bmp, jpg, png, and tif. In terms of operation steps, this invention does not require pre-setting webpage form templates; it can automatically process the content recognized in the image into a form style, making operation even simpler. Regarding controls, this invention supports not only input and textarea controls, but also number, date, picture, boolean, select, multi_select, and table controls, providing richer support to meet diverse user needs. It solves the efficiency problem in control type judgment, quickly helping users match suitable control types through big data matching, resulting in higher data recognition accuracy. This invention supports diverse control types, including the recognition of complex sub-table types.
[0108] Secondly, compared with other low-code platforms, this invention uses OCR text recognition technology, which is commonly used in the form data collection stage, rather than the form construction stage. It innovatively combines form construction and OCR technology, which accelerates the form construction speed and expands the application scenarios and boundaries of OCR recognition in the low-code field.
[0109] Specifically, it has the following advantages: (1) Reduces the cost of user information maintenance: Users only need to take a picture of the form and upload it for quick recognition, saving the need to manually enter the information into Excel before importing it into Excel, thus minimizing the time and manpower costs of manual entry;
[0110] (2) Reduce user understanding cost: The process of semantic recognition has been increased. Through automatic recognition, field types are quickly analyzed and matched to help users quickly understand the component types of the form. Users do not need to understand the differences in field types to quickly build the form;
[0111] (3) Saves users time spent on manual setup: Image recognition is especially suitable for forms with many field components. Through OCR and semantic automatic processing, forms can be quickly entered and set up, saving users a lot of time. The setup can be completed quickly with simple operations.
[0112] (4) Automatic identification of big data: Based on the advantages of big data and historical data, it helps users to automatically analyze and process field component types and improve the accuracy of field type matching.
[0113] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A method for quickly building forms based on OCR recognition technology, characterized in that, Includes the following steps: S1: Upload a paper form image through the image upload entry on the form building page. After the image is successfully uploaded, call the OCR service interface to check the brightness and clarity of the image. For images that meet the inspection requirements, call the image recognition interface. For images that do not meet the inspection requirements, take a new photo and upload it. S2: By calling the OCR text recognition service interface, obtain the text data in the returned image. The text data includes image resolution information, recognized text information and absolute position coordinates of the text in the image. If the image does not contain text, recognition fails and return to step S1. S3: Perform semantic matching on the identified text to obtain the corresponding form components; S4: Calculate the absolute position and width / height of the recognized text in the layout, and calculate the position of the field in the layout by combining the layout preset scheme; S5: Arrange the identified form components according to their layout position and proportion to obtain a form preview page. Obtain a component list based on the identified form components. Manually adjust the component types in the component list and edit the form components in the form preview page. S6: After confirming that the fields in the form preview page are correct, generate the form page on the form design page, set the form parameters, and complete the form creation; In step S3, the text semantic matching step includes: S31: Perform precise and fuzzy matching between the recognized text and the field names in the database, obtain the set of form components corresponding to the matched field names, and group and count the form component sets, taking the component type with the most quantity in the group as the type of the text to be matched; S32: When the matched component type is a single selection, multiple selection, or table, the field matching continues. For single selection or multiple selection, the option values will continue to be identified. For tables, the component type in the table will be identified according to step S31. S33: When the unmatched component type is a combination of radio button, checkbox, or table, manually determine whether the recognized text is radio button, checkbox, or table, and add other fields to the combination type; S34: If the matching fails based on steps S31-S33, the matching will be performed according to the semantic basic rules. If the matching fails based on both the semantic basic rules and steps S31-S33, the component type will default to TEXT. In step S31, the exact field matching is as follows: the identified text to be matched is used as the matching condition and entered into the name.keyword in the query condition for keyword filtering. The filtered records are grouped and statistically analyzed according to the field type dataType. The type of the group with the largest number of statistics is taken as the semantic field type of the text. In step S31, the field fuzzy matching is as follows: when exact matching cannot match the data, word segmentation is used for fuzzy matching, and the type of the record with the highest relevance is taken as the type of the text to be matched. If there are multiple records with the highest relevance, the records are grouped according to the field type, and the type of the largest group is taken as the semantic type of the text. In step S32, when the matched type is a single selection or multiple selection, option matching will be performed. The option matching rules are as follows: S321. Based on the data sample whose field type was confirmed in step S31, obtain the options attribute of these data, encapsulate all these options into a Set collection, remove duplicates, and obtain a union of options; S322. Accurately match option values by combining the union set into the OCR recognition data; When the matched type is a table, the table header fields will be matched, and the matching rules are as follows: S323. Based on the data samples whose field types were confirmed in step S31, obtain the tableField attributes of these data, encapsulate all these header fields into a Set collection, remove duplicates, and obtain a union of header fields; S324. Accurately match option values by combining the union set into the OCR recognition data.
2. The method for quickly building a form based on OCR recognition technology according to claim 1, characterized in that, In step S1, an image sharpness evaluation algorithm is used to calculate the image sharpness. After processing the image using the Sobel operator in the Tenengrad function, the gradient values in the horizontal and vertical directions of the image are extracted. If the calculated gradient values are lower than the preset threshold, the image is determined not to meet the inspection requirements.
3. The method for quickly building a form based on OCR recognition technology according to claim 2, characterized in that, In step S4, the preset schemes for form layout include: 1 / 2 line, 1 / 3 line, 1 / 4 line, 2 / 3 line, 3 / 4 line, and full line. A single line is allowed to have a maximum of 4 components. The relative position of the field in the form layout is calculated based on the text position recognized by OCR.
4. The method for quickly building a form based on OCR recognition technology according to claim 3, characterized in that, In step S4, the form layout calculation steps are as follows: S41. Based on the image width imageWidth, obtain the first recognized field, obtain the width attribute value of this field, calculate imageWidth - width. If the calculation result is less than 0, the first field occupies a separate row; otherwise, record this calculation result for the second calculation. S42. Get the next field, use the previous calculation result to calculate the width again, until the calculation result is less than or equal to 0 or the number of fields reaches 4. Then perform the layout calculation for the next row. If the result is less than 0, the last field is not included in the current row. If the result is equal to 0, the last field is included in the current row. S43. When the obtained field type is TABLE, the layout calculation for the next row is performed directly, and the TABLE occupies a single row. At the same time, the fields in the TABLE do not participate in the position calculation and are directly displayed in the TABLE.
5. The method for quickly building a form based on OCR recognition technology according to claim 1, characterized in that, In step S5, the steps for obtaining the form preview interface are as follows: S51. After all the recognized text has been matched, return the matched form data to the front end; S52. After obtaining the form data, the front-end page generates a canvas using the recognized image as the background image, iterates through all field objects, overlays the recognized text and position onto the canvas, and displays the semantically encoded field names and types. The operable boxes in the canvas are associated with the semantically encoded form fields through a unique key.
Citation Information
Patent Citations
Automatic input method and device for paper form, computer device and storage medium
CN109784235A
A form arbitrary region character recognition and information input method
CN109886108A
Text structuring and extracting method for documents
CN113962201A
Semantic mapping of form fields
US20190087463A1