Information extraction method, device, terminal device and computer readable storage medium
By dividing the image into multiple grids, and quickly finding target information using the positional relationship between the grids, the problem of low information extraction efficiency in the prior art is solved, and efficient image information extraction is achieved.
Patent Information
- Application Number
- CN202110570167.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-25
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2041-05-25
AI Technical Summary
When extracting information from an image, the prior art requires traversing every character in the image, resulting in large data processing volume and low information extraction efficiency.
By dividing the image to be processed into multiple grids, using the relative position relationship between the grids, quickly find target information related to the position of the mark information, avoiding traversing each character.
This greatly reduces the amount of data processing, improves the efficiency of information extraction, and achieves the rapid and accurate extraction of target information from the image.
Smart Images

Figure CN113343797B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular, relates to an information extraction method, apparatus, terminal device and computer-readable storage medium. Background Art
[0002] With the advent of the paperless era, more and more data in life are stored in the form of images, such as electronic invoices, electronic insurance policies, etc. When it is necessary to obtain the target information, the common method is to perform image processing on the data image. For example: if you need to obtain the name of the insured in the electronic insurance policy, you need to extract the text corresponding to the insured's name from the image of the electronic insurance policy.
[0003] In the prior art, when extracting information from an image, it is usually necessary to traverse each character in the image to search for the target information. This method has a large amount of data processing and low information extraction efficiency. Summary of the invention
[0004] The embodiments of the present application provide an information extraction method, apparatus, terminal device and computer-readable storage medium, which can effectively improve the efficiency of information extraction.
[0005] In a first aspect, an embodiment of the present application provides an information extraction method, comprising:
[0006] Acquire marking information in the image to be processed, where the marking information is an image element determined according to a preset marking rule;
[0007] Dividing the image to be processed into a plurality of grids according to a preset division rule;
[0008] According to the relative positions between the grids, target information having a preset positional relationship with the marking information in the image to be processed is extracted.
[0009] In the embodiment of the present application, the image to be processed is divided into multiple grids, and the relative position relationship between the divided grids is implied. The position relationship between each image element in the image to be processed can be established through the relative position between the grids; thus, after the marking information in the image to be processed is determined, the target information related to the position of the marking information can be quickly found according to the position relationship between the image elements. Through the above method, when extracting information from the image, there is no need to traverse each character in the image, and it is only necessary to determine the position of the target information to be extracted according to the divided grids, which greatly reduces the amount of data processing and effectively improves the efficiency of information extraction.
[0010] In a possible implementation manner of the first aspect, extracting target information having a preset positional relationship with the marking information in the image to be processed according to the relative positions between the grids includes:
[0011] Determine a first target grid to which the marking information belongs from the multiple grids;
[0012] Determining, according to the relative positions between the grids, a second target grid among the plurality of grids that has the preset positional relationship with the first target grid;
[0013] The target information belonging to the second target grid in the image to be processed is extracted.
[0014] In a possible implementation manner of the first aspect, determining, from the multiple grids, a first target grid to which the marking information belongs includes:
[0015] Determine a target boundary grid among the multiple grids, wherein the target boundary grid is a grid to which the boundary pixel point of the marking information belongs;
[0016] The first target grid is determined according to the target boundary grid.
[0017] In a possible implementation manner of the first aspect, determining a target boundary grid among the multiple grids includes:
[0018] Acquire the image resolution of the image to be processed;
[0019] Determine a grid resolution according to the image resolution and the preset division rule;
[0020] Obtaining the image coordinates of the boundary pixel points of the marking information in the image to be processed;
[0021] The target boundary grid is determined according to the image coordinates and the grid resolution.
[0022] In a possible implementation manner of the first aspect, determining the first target grid according to the target boundary grid includes:
[0023] Determine a target grid area surrounded by the target boundary grid;
[0024] A grid contained in the target grid area is determined as the first target grid.
[0025] In a possible implementation manner of the first aspect, determining a target grid area enclosed by the target boundary grid includes:
[0026] Determine a first grid column number, a second grid column number, a first grid row number, and a second grid row number, wherein the first grid column number is the column number of the rightmost grid in the target boundary grid in the horizontal direction among the multiple grids, the second grid column number is the column number of the leftmost grid in the target boundary grid in the horizontal direction among the multiple grids, the first grid row number is the row number of the uppermost grid in the target boundary grid in the vertical direction among the multiple grids, and the second grid row number is the row number of the lowermost grid in the target boundary grid in the vertical direction among the multiple grids;
[0027] The target grid area is determined according to the first grid column number, the second grid column number, the first grid row number, and the second grid row number.
[0028] In a possible implementation manner of the first aspect, determining, according to the relative positions between the grids, a second target grid having the preset position relationship with the first target grid among the multiple grids includes:
[0029] Identifying image elements contained in each of the plurality of grids in the image to be processed;
[0030] Correct the first target grid according to the image elements respectively included in the plurality of grids to obtain a corrected first target grid;
[0031] The second target grid having the preset position relationship with the corrected first target grid is determined among the plurality of grids.
[0032] In a possible implementation manner of the first aspect, after extracting target information having a preset position relationship with the marking information in the image to be processed according to the relative positions between the grids, the method further includes:
[0033] Determine a third target grid to which the target information in the image to be processed belongs;
[0034] Comparing the second target grid with the third target grid;
[0035] If the comparison results are consistent, it means that the extracted target information is correct;
[0036] If the comparison results are inconsistent, the target information is re-extracted according to the second target grid and the third target grid.
[0037] In a second aspect, an embodiment of the present application provides an information extraction device, including:
[0038] A marking acquisition unit, used to acquire marking information in the image to be processed, wherein the marking information is an image element determined according to a preset marking rule;
[0039] A grid division unit, used for dividing the image to be processed into a plurality of grids according to a preset division rule;
[0040] The information extraction unit is used to extract target information having a preset position relationship with the marking information in the image to be processed according to the relative positions between the grids.
[0041] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements an information extraction method as described in any one of the first aspects above when executing the computer program.
[0042] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and wherein the computer program, when executed by a processor, implements an information extraction method as described in any one of the first aspects above.
[0043] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the information extraction method described in any one of the above-mentioned first aspects.
[0044] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 It is a flowchart of the information extraction method provided in the embodiment of the present application;
[0047] Figure 2 is a schematic diagram of an image to be processed provided by an embodiment of the present application;
[0048] Figure 3 is a schematic diagram of grid division provided in an embodiment of the present application;
[0049] Figure 4is a structural block diagram of an information extraction device provided in an embodiment of the present application;
[0050] Figure 5 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0052] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0053] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting" depending on the context.
[0054] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0055] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.
[0056] See also Figure 1 , is a flowchart of the information extraction method provided in the embodiment of the present application. As an example but not a limitation, the method may include the following steps:
[0057] S101, obtaining marking information in an image to be processed.
[0058] The marking information is an image element determined according to a preset marking rule.
[0059] Image elements can be text, images, graphics or symbols, etc., and any content presented in the image to be processed can be used as an element.
[0060] Optionally, the preset marking rule may be: determining preset information in the identified image to be processed as the marking information, wherein the preset information is a preset image element in the image to be processed.
[0061] In practical applications, before information extraction, image recognition processing has usually been performed on the image to be processed, that is, image elements such as text or characters in the image to be processed have been recognized. Figure 2 , is a schematic diagram of an image to be processed provided in an embodiment of the present application. If the preset information is a rectangular frame (i.e., a graphic), then the marking information is Figure 2 If the preset information is "name of the insured" (i.e., text), the marked information is the text "name of the insured".
[0062] S102: Divide the image to be processed into a plurality of grids according to a preset division rule.
[0063] The position of each grid is determined by a preset division rule. It can be divided equally or non-equally. For the convenience of calculation, it is preferred to use equal-distance division. This is more convenient when determining the position of each grid. The more grids are divided, the more accurate the position of the image element is determined later, but the amount of data processing is also greater, and there may be a situation where one image element occupies multiple grids. Therefore, it is necessary to set the preset division rule according to the actual situation.
[0064] For example, see Figure 3 , is a schematic diagram of grid division provided in the embodiment of the present application. Figure 3 As shown in the figure, the image to be processed is an electronic insurance policy. The upper left vertex of the electronic insurance policy is determined as the coordinate origin. The vertical downward direction (i.e., the height direction downward) from the coordinate origin is determined as the positive direction of the y axis. The horizontal rightward direction (i.e., the width direction right) from the coordinate origin is determined as the positive direction of the x axis. Then, n lines are divided along the x axis and the y axis respectively, and (n+1)(n+1) grids can be obtained. Figure 3 As shown, when n=9, the electronic policy is divided into 10×10 grids.
[0065] In practical applications, when the image to be processed is stored in a computer, the computer can usually only perceive the character information and coordinate information of the image elements, but cannot perceive the positional relationship between the image elements. In the embodiment of the present application, by dividing the grids, the image elements are added to each grid, so that the positional relationship between the image elements in the image to be processed can be added through the distance relationship between the grids.
[0066] S103. Extract target information in the image to be processed that has a preset positional relationship with the marked information according to the relative positions between the grids.
[0067] As described in S102, after dividing the image to be processed into multiple grids, there are relative positional relationships between these grids. For example, the position of a grid in the image to be processed and the positions of the grids adjacent to this grid (such as above, below, left, and right). By using the relative positions between the grids, the positional relationships between various image elements in the image to be processed can be established. In this way, after determining the marked information in the image to be processed, the target information related to the position of the marked information can be quickly found according to the positional relationships between the image elements.
[0068] In one embodiment, S103 may include the following steps:
[0069] S31. Determine the first target grid to which the marked information belongs from multiple grids.
[0070] S32. According to the relative positions between the grids, determine the second target grids in the multiple grids that have the preset positional relationship with the first target grid.
[0071] S33. Extract the target information in the image to be processed that belongs to the second target grids.
[0072] Among them, the first target grid may contain at least one grid. As Figure 3 shown, when the marked information is a rectangular frame enclosing "Zhang San", the first target grid is the grid in the 2nd row and 3rd column. At this time, the first target grid contains one grid. When the marked information is the words "Name of the Insured", the first target grid is the grid in the 2nd row and 1st column and the grid in the 2nd row and 2nd column. At this time, the first target grid contains 2 grids.
[0073] In one embodiment, for the above S31 step, the method of determining the first target grid to which the marked information belongs from multiple grids may include:
[0074] Determine the coordinates of the boundary pixel points of the marked information in the image to be processed to obtain the boundary coordinates of the marked information; determine the image area occupied by the marked information according to the boundary coordinates of the marked information; determine the position of each grid in the image to be processed according to the grid division rules and the resolution of the image to be processed; determine the grids included in the image area according to the position of each grid in the image to be processed to obtain the first target grid.
[0075] Generally, the resolution (number of horizontal pixels × number of vertical pixels) of the image to be processed is known. Therefore, after dividing the grid, the resolution of each grid and the position of each grid in the image to be processed can be determined according to the preset division rules of the grid and the resolution of the image to be processed.
[0076] The position of the grid can be determined by the four vertices of the grid. For example: Figure 3 As shown, the resolution of the image to be processed is 1000×800, equally divided into 10×10 grids. The resolution of each grid is 100×80 (1000÷10 = 100, 800÷10 = 80). The four vertices of the grid in the first row and the first column are (0,0), (0,100), (80,0), and (80,100) respectively. And so on, the position of each grid can be determined.
[0077] The above method determines the first target grid from the perspective of image coordinates. It is also possible to determine the first target grid from the perspective of the grid. Specifically, in another embodiment, the method for determining the first target grid may include:
[0078] Determine the target boundary grids among multiple grids, where the target boundary grids are the grids to which the boundary pixel points of the marking information belong; determine the first target grid according to the target boundary grids.
[0079] The target boundary grids may include the grids to which each boundary pixel point on the marking information belongs; for example, if there are 10 boundary pixel points on the marking information, then the grids to which these 10 boundary pixel points belong are all target boundary grids. The target boundary grids may also include the grids to which the boundary pixel points sampled from the marking information belong; for example, if there are 10 boundary pixel points on the marking information, 5 boundary pixel points are sampled from these 10 boundary pixel points, and the grids to which the sampled 5 boundary pixel points belong are determined as the target boundary grids.
[0080] Exemplarily, if the shape of the marking information is a regular polygon (such as a rectangle, a rhombus, etc.), preferably, the grids to which the vertices of the image element belong can be determined as the target boundary grids. If as Figure 3 In the example, the marking information is the words "insured's name", then the grid to which the left boundary pixel point of the word "bei" belongs and the grid to which the right pixel point of the word "ming" belongs are determined as the target boundary grids.
[0081] Optionally, an implementation manner for determining the target boundary grids among multiple grids may be:
[0082] Obtain the image resolution of the image to be processed; determine the grid resolution according to the image resolution and the preset division rule; obtain the image coordinates of the boundary pixel points of the marking information in the image to be processed; determine the target boundary grid according to the image coordinates and the grid resolution.
[0083] For example, assuming that the resolution of the image to be processed is 3000×1500 (3000 horizontal pixels and 1500 vertical pixels), the image to be processed includes 10×10 grids, the preset division rule is equidistant division, and the image coordinates of the boundary pixel points on the marking information are (347,310); using the above method, the resolution of each grid is 300×150 (3000 / 10=300, 1500 / 10=150), that is, each grid contains 300 pixels in the horizontal direction and 150 pixels in the vertical direction; then determine the target boundary grid as: That is, the grid of row 3 and column 2. Among them, Of course, the rounding up operation can also be adopted, which is not specifically limited here.
[0084] If all boundary pixels on the marking information belong to the same target boundary grid, it means that all the marking information is located in one grid, and the target boundary grid is the first target grid to which the marking information belongs. However, in actual applications, due to different grid division rules, different boundary pixels on the marking information may belong to different grids, indicating that the marking information belongs to multiple grids. In this case, it is necessary to determine all the first target grids to which the marking information belongs based on the target boundary grid. The details are as follows.
[0085] Optionally, after determining a target boundary grid among multiple grids, an implementation manner of determining a first target grid according to the target boundary grid is:
[0086] Determine a target grid area surrounded by target boundary grids; and determine the grids contained in the target grid area as first target grids.
[0087] The target grid area may be a grid area including the target boundary grid; or may be a grid area excluding the target boundary grid but surrounded by the target boundary grid.
[0088] Furthermore, one implementation method of determining the target grid area surrounded by the target boundary grid is:
[0089] The first grid column number, the second grid column number, the first grid row number, and the second grid row number are determined, and the target grid area is determined according to the first grid column number, the second grid column number, the first grid row number, and the second grid row number.
[0090] Among them, the first grid column number is the column number of the rightmost grid in the target boundary grid in the horizontal direction among the multiple grids, the second grid column number is the column number of the leftmost grid in the horizontal direction among the multiple grids, the first grid row number is the row number of the topmost grid in the target boundary grid in the vertical direction among the multiple grids, and the second grid row number is the row number of the bottommost grid in the target boundary grid in the vertical direction among the multiple grids.
[0091] Exemplarily, taking the marking information as a rectangular box as an example, the coordinates of the four vertices of the rectangular box in the image to be processed are (619,722), (619,761), (759,761) and (759,722), among which (759,722) belongs to [13,7] (indicating the grid of the 13th row and 7th column), (619,722) belongs to [13,8], (759,761) belongs to [16,7], and (619,761) belongs to [16,8]. That is, the target boundary grids of the marking information are [13,7], [13,8], [16,7] and [16,8]. Among the above four target boundary grids, the grid farthest to the right in the horizontal direction belongs to 8 columns among the multiple grids, the grid farthest to the left belongs to 7 columns among the multiple grids, the grid farthest to the top in the vertical direction belongs to 13 rows among the multiple grids, and the grid farthest to the bottom belongs to 16 rows among the multiple grids; therefore, it can be determined that the first target grids to which the marking information belongs are [13,8], [14,8], [15,8], [16,8], [13,7], [14,7], [15,7], and [16,7].
[0092] In practical applications, the goal of information extraction is to obtain target information related to the position of the marking information. In the prior art, it is usually necessary to traverse each image element in the image to be processed to search for target information related to the position of the marking information. This method has a large amount of data processing and low processing efficiency. In order to solve the above problems, in an embodiment of the present application, the positional relationship between the marking information and the target information can be established through a grid, and then the position of the second target grid to which the target information belongs can be determined through the first target grid to which the marking information belongs, which is equivalent to determining the position of the target information in the image to be processed, avoiding traversing each image element, and effectively improving the processing efficiency. The specific method is as follows.
[0093] In one embodiment, a second target grid having a preset position relationship with the first target grid among the plurality of grids is determined according to the relative positions between the grids.
[0094] The preset position relationship in the embodiment of the present application refers to the relationship mapped according to the position parameter information of the divided grids. The preset position relationship may be the position occupied by the first target grid; in this case, the second target grid having the preset position relationship with the first target grid is the first target grid, that is, the first target grid and the second target grid overlap. For example: Figure 3 In the electronic insurance policy shown, when the marking information is a rectangular frame, the grid corresponding to the position occupied by the grid to which the rectangular frame belongs (i.e., the first target grid) is determined as the second target grid. The preset position relationship can also be a position adjacent to the first target grid; in this case, the second target grid having a preset position relationship with the first target grid is a grid adjacent to the first target grid (such as a grid on the right / left side of the first target grid, etc.). For example, Figure 3 In the electronic insurance policy shown, when the marking information is the words "name of the insured", it is usually for obtaining the text content behind these words. Therefore, at least one grid to the right of the first target grid to which these words belong can be determined as the second target grid.
[0095] After the first target grid is obtained according to step S31, a second target grid having a preset position relationship with the first target grid can be directly determined. In order to more accurately determine the correspondence between the image elements and the grids in the image to be processed, in one embodiment, the first target grid can also be corrected, and then the second target grid can be determined based on the corrected first target grid. The details are as follows.
[0096] S32, determining a second target grid having the preset position relationship with the first target grid among the multiple grids, may include the following steps:
[0097] Identify image elements contained in each of the multiple grids in the image to be processed; correct the first target grid according to the image elements contained in each of the multiple grids to obtain a corrected first target grid; and determine a second target grid in the multiple grids that has a preset positional relationship with the corrected first target grid.
[0098] Step S31 is equivalent to determining the grid to which the image element belongs, and the above steps are equivalent to determining the image elements contained in the grid, that is, equivalent to reverse traversal to find the image elements contained in each grid. In this way, the first target grid is corrected, which can effectively avoid the problem of inaccurate first target grid caused by calculation errors, thereby helping to improve the accuracy of text extraction.
[0099] Optionally, the correction method may be: according to the image elements respectively contained in the multiple grids, determine the grid containing the marking information to obtain the fourth target grid; if the fourth target grid contains all the first target grids, keep the original first target grid; if the first target grid contains all the fourth target grids, determine the fourth target grid as the corrected first target grid; if the first target grid and the fourth target grid have an intersection, determine the intersection of the first target grid and the fourth target grid as the corrected first target grid.
[0100] Exemplarily, assuming that the image elements contained in each of the multiple grids are: grid [1,1] contains image element a, [1,2] contains image element a, [2,1] contains image element b, and [2,2] contains image element c. Assuming that the label information is a, the fourth target grid is [1,1] and [1,2].
[0101] If it is determined according to S31 that the first target grid to which a belongs is [1,1] and [1,2], that is, the fourth target grid contains all the first target grids, then the corrected first target grids are still [1,1] and [1,2].
[0102] If the first target grid to which a belongs determined according to S31 is [1,1], [1,2] and [2,1], that is, the first target grid contains all the fourth target grids, then the corrected first target grid is the fourth target grids [1,1] and [1,2].
[0103] If the first target grid to which a belongs determined according to S102 is [1,1], that is, the first target grid and the fourth target grid have an intersection, then the corrected first target grid is the intersection [1,1] of the first target grid and the fourth target grid.
[0104] Several examples of step S33 (extracting target information belonging to the second target grid in the image to be processed) are introduced below.
[0105] Taking the marking information as a rectangular frame as an example, the elements in the rectangular frame are the target information to be extracted. In this case, according to the method in S31, the first target grid to which the rectangular frame belongs can be obtained, and the first target grid can be determined as the second target grid, and the target information in the second target grid can be extracted (equivalent to extracting the image elements in the grid to which the rectangular frame belongs).
[0106] Taking the words "name of the insured" as an example, the purpose of information extraction is to obtain "Zhang San" corresponding to "name of the insured", that is, the target information is the words "Zhang San". In this case, the first target grid described by the words "name of the insured" can be obtained according to the method in S31. Since the name is usually after the title, at least one grid to the right of the first target grid can be determined as the second target grid, and then the target information in the second target grid can be advanced to extract "Zhang San".
[0107] Sometimes, we can only determine the positional relationship between the first target grid and the second target grid, but we cannot determine the number of second target grids. For example, in the above example, we can only determine that "Zhang San" is to the right of "Name of the Insured Person", that is, the right side of the first target grid is the second target grid, but we cannot determine which grids to the right of the first target grid are the second target grids, which may easily lead to more or less content of the extracted second target elements.
[0108] In order to solve the above problems and improve the accuracy of information extraction, in one embodiment, after S103, the extracted information can be further confirmed to improve the accuracy of information extraction. Specifically, after S103, the information extraction method can also include the following steps:
[0109] Determine the third target grid to which the target information in the image to be processed belongs; compare the second target grid and the third target grid; if the comparison result is consistent, it means that the extracted target information is correct; if the comparison result is inconsistent, re-extract the target information according to the second target grid and the third target grid.
[0110] The method for calculating the third target grid to which the target information belongs is the same as the method for calculating the first target grid to which the marking information belongs in S31. For details, please refer to the description in S31, which will not be repeated here.
[0111] Using the above method is equivalent to testing the extracted target information, which further improves the accuracy of information extraction.
[0112] In the embodiment of the present application, the image to be processed is divided into multiple grids, and the relative position relationship between the divided grids is implied. The position relationship between each image element in the image to be processed can be established through the relative position between the grids; thus, after the marking information in the image to be processed is determined, the target information related to the position of the marking information can be quickly found according to the position relationship between the image elements. Through the above method, when extracting information from the image, there is no need to traverse each character in the image, and it is only necessary to determine the position of the target information to be extracted according to the divided grids, which greatly reduces the amount of data processing and effectively improves the efficiency of information extraction.
[0113] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0114] Corresponding to the information extraction method described in the above embodiment, Figure 4 This is a structural block diagram of the information extraction device provided in an embodiment of the present application. For the sake of convenience of explanation, only the parts related to the embodiment of the present application are shown.
[0115] Reference Figure 4 , the device comprises:
[0116] The marking acquisition unit 41 is used to acquire marking information in the image to be processed, where the marking information is an image element determined according to a preset marking rule;
[0117] A grid division unit 42, used for dividing the image to be processed into a plurality of grids according to a preset division rule;
[0118] The information extraction unit 43 is used to extract the target information having a preset position relationship with the marking information in the image to be processed according to the relative positions between the grids.
[0119] Optionally, the information extraction unit 43 includes:
[0120] The first grid determination module is used to determine a first target grid to which the marking information belongs from the multiple grids.
[0121] The second grid determining module is used to determine a second target grid among the multiple grids that has the preset position relationship with the first target grid.
[0122] An information extraction module is used to extract the target information belonging to the second target grid in the image to be processed.
[0123] Optionally, the first grid determination module is further used for:
[0124] Determine a target boundary grid among the multiple grids, wherein the target boundary grid is a grid to which the boundary pixel point of the marking information belongs; and determine the first target grid according to the target boundary grid.
[0125] Optionally, the first grid determination module is further used for:
[0126] Obtain the image resolution of the image to be processed; determine the grid resolution according to the image resolution and the preset division rule; obtain the image coordinates of the boundary pixel points of the marking information in the image to be processed; and determine the target boundary grid according to the image coordinates and the grid resolution.
[0127] Optionally, the first grid determination module is further used for:
[0128] Determine a target grid area surrounded by the target boundary grid; and determine the grid contained in the target grid area as the first target grid.
[0129] Optionally, the first grid determination module is further used for:
[0130] Determine a first grid column number, a second grid column number, a first grid row number, and a second grid row number, wherein the first grid column number is the column number of the rightmost grid in the target boundary grid in the horizontal direction among the multiple grids, the second grid column number is the column number of the leftmost grid in the target boundary grid in the horizontal direction among the multiple grids, the first grid row number is the row number of the uppermost grid in the target boundary grid in the vertical direction among the multiple grids, and the second grid row number is the row number of the lowermost grid in the target boundary grid in the vertical direction among the multiple grids; determine the target grid area according to the first grid column number, the second grid column number, the first grid row number, and the second grid row number.
[0131] Optionally, the second grid determination module is further used for:
[0132] Identify the image elements contained in each of the multiple grids in the image to be processed; correct the first target grid according to the image elements contained in each of the multiple grids to obtain the corrected first target grid; determine a second target grid among the multiple grids that has a preset positional relationship with the corrected first target grid.
[0133] Optionally, the device 4 further comprises:
[0134] The comparison unit 44 is used to determine a third target grid to which the target information in the image to be processed belongs, after extracting the target information having a preset positional relationship with the marking information in the image to be processed according to the relative positions between the grids; compare the second target grid with the third target grid; if the comparison results are consistent, it indicates that the extracted target information is correct; if the comparison results are inconsistent, re-extract the target information according to the second target grid and the third target grid.
[0135] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0136] in addition, Figure 4The information extraction device shown may be a software unit, a hardware unit, or a combination of software and hardware units built into an existing terminal device, or may be integrated into the terminal device as an independent widget, or may exist as an independent terminal device.
[0137] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0138] Figure 5 Schematic diagram of the structure of the terminal device provided in the embodiment of the present application. Figure 5 As shown, the terminal device 5 of this embodiment includes: at least one processor 50 ( Figure 5 Only one is shown in the figure) a processor, a memory 51, and a computer program 52 stored in the memory 51 and executable on the at least one processor 50, wherein when the processor 50 executes the computer program 52, the steps in any of the above-mentioned information extraction method embodiments are implemented.
[0139] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that Figure 5 It is only an example of the terminal device 5 and does not constitute a limitation on the terminal device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0140] The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0141] In some embodiments, the memory 51 may be an internal storage unit of the terminal device 5, such as a hard disk or memory of the terminal device 5. In other embodiments, the memory 51 may also be an external storage device of the terminal device 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the terminal device 5. The memory 51 is used to store an operating system, an application program, a boot loader, data, and other programs, such as the program code of the computer program. The memory 51 may also be used to temporarily store data that has been output or is to be output.
[0142] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0143] An embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0144] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the device / terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0145] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0146] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0147] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0148] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0149] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An information extraction method, characterized in that: include: Acquire marking information in the image to be processed, where the marking information is an image element determined according to a preset marking rule; Dividing the image to be processed into a plurality of grids according to a preset division rule, and adding image elements to each grid by dividing the plurality of grids; Extracting target information having a preset positional relationship with the marking information in the image to be processed according to the relative positions between the grids, wherein after the image to be processed is divided into a plurality of grids, there is a relative positional relationship between the grids, and the relative positions between the grids can be used to establish the positional relationship between the image elements in the image to be processed; The step of extracting target information having a preset position relationship with the marking information in the image to be processed according to the relative positions between the grids includes: Determine a first target grid to which the marking information belongs from the multiple grids; Determining, according to the relative positions between the grids, a second target grid among the plurality of grids that has the preset positional relationship with the first target grid; The target information belonging to the second target grid in the image to be processed is extracted.
2. The information extraction method according to claim 1, characterized in that: The step of determining, from the plurality of grids, a first target grid to which the marking information belongs, comprises: Determine a target boundary grid among the multiple grids, wherein the target boundary grid is a grid to which the boundary pixel point of the marking information belongs; The first target grid is determined according to the target boundary grid.
3. The information extraction method according to claim 2, characterized in that: The determining of a target boundary grid among the plurality of grids comprises: Acquire the image resolution of the image to be processed; Determine a grid resolution according to the image resolution and the preset division rule; Obtaining the image coordinates of the boundary pixel points of the marking information in the image to be processed; The target boundary grid is determined according to the image coordinates and the grid resolution.
4. The information extraction method according to claim 2, characterized in that: The determining the first target grid according to the target boundary grid comprises: Determine a target grid area surrounded by the target boundary grid; A grid contained in the target grid area is determined as the first target grid.
5. The information extraction method according to claim 4, characterized in that: The determining of the target grid area surrounded by the target boundary grid includes: Determine a first grid column number, a second grid column number, a first grid row number, and a second grid row number, wherein the first grid column number is the column number of the rightmost grid in the target boundary grid in the horizontal direction among the multiple grids, the second grid column number is the column number of the leftmost grid in the target boundary grid in the horizontal direction among the multiple grids, the first grid row number is the row number of the uppermost grid in the target boundary grid in the vertical direction among the multiple grids, and the second grid row number is the row number of the lowermost grid in the target boundary grid in the vertical direction among the multiple grids; The target grid area is determined according to the first grid column number, the second grid column number, the first grid row number, and the second grid row number.
6. The information extraction method according to claim 4, characterized in that: The determining, according to the relative positions between the grids, a second target grid among the plurality of grids that has the preset position relationship with the first target grid comprises: Identify image elements contained in each of the plurality of grids in the image to be processed; Correcting the first target grid according to the image elements respectively included in the plurality of grids to obtain a corrected first target grid; The second target grid having the preset position relationship with the corrected first target grid is determined among the plurality of grids.
7. The information extraction method according to any one of claims 1 to 6, characterized in that: After extracting target information having a preset position relationship with the marking information in the image to be processed according to the relative positions between the grids, the method further includes: Determine a third target grid to which the target information in the image to be processed belongs; Comparing the second target grid with the third target grid; If the comparison results are consistent, it means that the extracted target information is correct; If the comparison result is inconsistent, the target information is re-extracted according to the second target grid and the third target grid.
8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Information extraction method and, device and , equipment and storage medium
CN111652176A