Search

CN-116580417-B - Method and related device for identifying form data in image

CN116580417BCN 116580417 BCN116580417 BCN 116580417BCN-116580417-B

Abstract

The application discloses a method for identifying form data in an image and a related device, which can be used in the field of image identification; the method comprises the steps of identifying coordinates of a plurality of boundaries in an image to be identified, locating a table in the image to be identified based on the coordinates of the plurality of boundaries and a preset table locating rule, determining the structural type of the located table based on a preset type detection model, and finally identifying data text and data coordinates in the image to be identified, and obtaining structured table data based on the structural type of the table, the coordinates of the plurality of boundaries, the data text and the data coordinates in the located table. Therefore, the method and the device locate the form in the image to be identified through the feature identification, and determine the structure type of the form through the type detection model, so that the structured form data can be accurately and rapidly obtained without being limited by the form display form, and the form data in the image is easier to use.

Inventors

  • LIU YU
  • HU KEYUN
  • CHEN LIANZHONG

Assignees

  • 北京嘉和海森健康科技有限公司

Dates

Publication Date
20260505
Application Date
20230421

Claims (7)

  1. 1. A method for identifying tabular data in an image, the method comprising: Acquiring an image to be identified comprising form data; The method comprises the steps of identifying coordinates of a plurality of boundaries in an image to be identified, locating a table in the image to be identified based on the coordinates of the plurality of boundaries and a preset table locating rule, specifically identifying colors and coordinates of pixel points in the image to be identified to determine the coordinates of the plurality of boundaries in the image to be identified, calculating the degree of intensity of the plurality of boundaries in the image to be identified based on the coordinates of the plurality of boundaries, locating the table in the image to be identified based on a preset line segment clustering rule if the degree of intensity is greater than a preset intensity threshold, locating the table in the image to be identified based on two boundaries with the largest distance among the plurality of boundaries if the degree of intensity is less than or equal to the preset intensity threshold, wherein the boundary is the boundary of the table, and the line segment clustering rule is used for clustering the boundaries; Determining the structure type of the positioned table based on a preset type detection model; The method comprises the steps of identifying data text and data coordinates in an image to be identified, obtaining structured form data based on the structure type of a form, the coordinates of a plurality of boundaries in the form, which are positioned, the data text and the data coordinates, specifically identifying the data text and the data coordinates in the image to be identified, determining classified item coordinates and sub-data coordinates of the form based on the structure type of the form, the coordinates and the data coordinates of a plurality of boundaries in the form, wherein the data comprises classified items and sub-data, and obtaining structured form data based on an intersection set of coordinate ranges of the data text, the classified item coordinates, the sub-data coordinates, the classified item coordinates and the sub-data coordinates in the arrangement direction of the classified items.
  2. 2. The method of claim 1, wherein the identifying the color and coordinates of the pixel points in the image to be identified to determine the coordinates of the plurality of boundaries in the image to be identified comprises: traversing pixel points in the image to be identified, and determining coordinates of a plurality of line segments in the image to be identified based on the colors and the coordinates of the pixel points; And determining the coordinates of a plurality of boundaries in the image to be identified based on the coordinates of the plurality of line segments and a preset boundary enhancement rule, wherein the boundary enhancement rule is used for judging whether the plurality of line segments belong to the same boundary.
  3. 3. The method of claim 1, wherein the identifying the color and coordinates of the pixel points in the image to be identified to determine the coordinates of the plurality of boundaries in the image to be identified comprises: traversing pixel points in the image to be identified, and determining coordinates of a blank area in the image to be identified based on the colors and coordinates of the pixel points; and determining coordinates of a plurality of boundaries in the image to be identified based on the coordinates of the blank area.
  4. 4. A method according to claim 3, wherein said determining coordinates of a plurality of boundaries in said image to be identified based on coordinates of said blank region comprises: determining a first table range in the image to be identified based on the coordinates of the blank area; Identifying a plurality of data coordinates within the first form range, and determining a second form range in the image to be identified based on the spacing distance of the plurality of data coordinates within the first form range; and determining coordinates of a plurality of boundaries in the image to be identified based on the second table range.
  5. 5. The device for identifying the table data in the image is characterized by comprising an acquisition module, a positioning module, a determination module and a structuring module; the acquisition module is used for acquiring an image to be identified, which comprises form data; The positioning module is used for identifying coordinates of a plurality of boundaries in the image to be identified and positioning a table in the image to be identified based on the coordinates of the plurality of boundaries and a preset table positioning rule; The determining module is used for determining the structure type of the positioned form based on a preset type detection model; the structuring module is used for recognizing a data text and a data coordinate in the image to be recognized, obtaining structured form data based on the structure type of the form, the coordinates of a plurality of boundaries in the form positioned, the data text and the data coordinate, specifically recognizing the data text and the data coordinate in the image to be recognized, determining a classified item coordinate and a sub-data coordinate of the form based on the structure type of the form, the coordinates and the data coordinate of a plurality of boundaries in the form positioned, wherein the data comprises a classified item and sub-data, and obtaining structured form data based on the intersection of the data text, the classified item coordinate, the sub-data coordinate, the classified item coordinate and the coordinate range of the sub-data coordinate in the arrangement direction of the classified item; the positioning module comprises a boundary identification unit, a calculation unit and a positioning unit; The boundary identification unit is used for identifying the colors and coordinates of the pixel points in the image to be identified so as to determine the coordinates of a plurality of boundaries in the image to be identified; the computing unit is used for computing the density degree of the plurality of boundaries in the image to be identified based on the coordinates of the plurality of boundaries; The positioning unit is used for positioning the table in the image to be identified based on a preset line segment clustering rule when the density degree is larger than a preset density threshold value, positioning the table in the image to be identified based on two boundaries with the largest distance among the boundaries when the density degree is smaller than or equal to the preset density threshold value, and clustering the boundaries according to the line segment clustering rule.
  6. 6. A computer device, the computer device comprising: a memory and a processor; one or more computer programs stored in the memory, the one or more computer programs comprising instructions which, when executed by the processor, perform the method of identifying tabular data in an image as claimed in any of claims 1-4.
  7. 7. A computer readable storage medium, having stored therein computer instructions which, when run on a computer device, perform the method of identifying tabular data in an image as claimed in any of claims 1-4.

Description

Method and related device for identifying form data in image Technical Field The present application relates to the field of image recognition technologies, and in particular, to a method and an apparatus for recognizing table data in an image. Background Forms are often used to organize and organize data, and various forms are widely adopted by people in communication, scientific research, data analysis and other activities. In many cases, the form exists in the form of an image, and the form data cannot be directly edited, and is difficult to extract and use. At present, an OCR (Optical Character Recognition ) technology is generally used to recognize an image containing form data, so that text information in the form is converted into text which can be copied and pasted, so that the text information in the form is input to a position of a required application through copy and paste, and the form data in the image is used in the process of performing activities such as data analysis and the like. However, compared with the traditional manual input, the method omits the step of manual typing, and is still time-consuming and labor-consuming. Thus, how to make the table data in the image easier to use becomes a current urgent problem to be solved. Disclosure of Invention Based on the above problems, the present application provides a method and related device for identifying form data in an image, which can make the form data in the image easier to be used. The embodiment of the application discloses the following technical scheme: in a first aspect, the present application provides a method for identifying form data in an image, the method comprising: Acquiring an image to be identified comprising form data; recognizing coordinates of a plurality of boundaries in the image to be recognized, and positioning a form in the image to be recognized based on the coordinates of the plurality of boundaries and a preset form positioning rule; Determining the structure type of the positioned table based on a preset type detection model; and identifying a data text and data coordinates in the image to be identified, and obtaining structured form data based on the structure type of the form, the coordinates of a plurality of boundaries in the positioned form, the data text and the data coordinates. Optionally, the identifying coordinates of a plurality of boundaries in the image to be identified, and locating the form in the image to be identified based on the coordinates of the plurality of boundaries and a preset form locating rule includes: Identifying the color and coordinates of pixel points in the image to be identified to determine the coordinates of a plurality of boundaries in the image to be identified; Calculating the density degree of the multiple boundaries in the image to be identified based on the coordinates of the multiple boundaries; if the density degree is larger than a preset density threshold value, positioning a table in the image to be identified based on a preset line segment clustering rule; And if the density degree is smaller than or equal to a preset density threshold value, positioning the table in the image to be identified based on the two boundaries with the largest distance among the boundaries. Optionally, the identifying the color and coordinates of the pixel points in the image to be identified to determine the coordinates of the multiple boundaries in the image to be identified includes: traversing pixel points in the image to be identified, and determining coordinates of a plurality of line segments in the image to be identified based on the colors and the coordinates of the pixel points; And determining the coordinates of a plurality of boundaries in the image to be identified based on the coordinates of the plurality of line segments and a preset boundary enhancement rule. Optionally, the identifying the color and coordinates of the pixel points in the image to be identified to determine the coordinates of the multiple boundaries in the image to be identified includes: traversing pixel points in the image to be identified, and determining coordinates of a blank area in the image to be identified based on the colors and coordinates of the pixel points; and determining coordinates of a plurality of boundaries in the image to be identified based on the coordinates of the blank area. Optionally, the determining, based on the coordinates of the blank area, coordinates of a plurality of boundaries in the image to be identified includes: determining a first table range in the image to be identified based on the coordinates of the blank area; Identifying a plurality of data coordinates within the first form range, and determining a second form range in the image to be identified based on the spacing distance of the plurality of data coordinates within the first form range; and determining coordinates of a plurality of boundaries in the image to be identified based on the second table ran