A method, device, equipment and medium for obtaining information
By identifying the target characters in the card certificate image and determining the conversion matrix, adjusting the image to improve the recognition accuracy, the problems of low accuracy of card certificate information recognition and high computational complexity in the prior art are solved, and more efficient information acquisition is achieved .
Patent Information
- Application Number
- CN202111636198.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2041-12-29
AI Technical Summary
In the prior art, the accuracy of card certificate information recognition is low, and the computational complexity of deep learning models leads to inefficient inference.
By identifying the target characters in the image to be identified, the target conversion matrix is determined based on the coordinates of the target characters, the image to be identified is adjusted, and the target information is obtained from the adjusted image.
It improves the accuracy of card information identification, reduces the computational complexity, and improves the efficiency of information acquisition.
Smart Images

Figure CN114299509B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for acquiring information. Background Art
[0002] With the development of technology, it is becoming increasingly common for people to conduct business by taking photos of their ID cards and uploading them. For example, when entering identity information, you can scan your ID card to identify your name, ID number, and other personal information. Another example is when entering financial information, you can scan your credit or savings card to identify the bank account and account number, and so on.
[0003] In the existing technology, when performing card information recognition, the pixel features of the card image are usually used for card information recognition. However, since the image is easily affected by factors such as brightness, angle, noise, color, etc., the accuracy of card recognition in the existing technology is low. In addition, deep learning models with high accuracy often have low reasoning efficiency due to high computational complexity.
[0004] Therefore, how to better identify card information is a technical problem that needs to be solved urgently. Summary of the Invention
[0005] The embodiments of this specification provide a method, apparatus, device, and medium for acquiring information to solve the problem of low recognition accuracy in existing card information recognition methods.
[0006] To solve the above technical problems, the embodiments of this specification are implemented as follows:
[0007] An embodiment of this specification provides a method for obtaining information, including:
[0008] Obtain the image to be recognized;
[0009] Identify a target character in the image to be identified that meets a preset character image feature; the preset character image feature is a feature included in the character image in the template image;
[0010] Determining a target transformation matrix based on the coordinates of the target character;
[0011] adjusting the image to be recognized based on the target transformation matrix to obtain an adjusted image to be recognized;
[0012] Target information is acquired from the adjusted target area of the image to be recognized.
[0013] An embodiment of this specification provides a device for obtaining information, including:
[0014] An image acquisition module, used to acquire an image to be identified;
[0015] A character image recognition module, configured to recognize target characters in the image to be recognized that conform to preset character image features; the preset character image features are features contained in the character image in the template image;
[0016] A matrix determination module, configured to determine a target transformation matrix based on the coordinates of the target character;
[0017] An image adjustment module, configured to adjust the image to be identified based on the target transformation matrix to obtain an adjusted image to be identified;
[0018] The information recognition module is used to obtain target information from the target area of the adjusted image to be recognized.
[0019] An embodiment of this specification provides a device for acquiring information, including:
[0020] at least one processor; and,
[0021] a memory communicatively connected to the at least one processor; wherein,
[0022] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0023] Obtain the image to be recognized;
[0024] Identify a target character in the image to be identified that meets a preset character image feature; the preset character image feature is a feature included in the character image in the template image;
[0025] Determining a target transformation matrix based on the coordinates of the target character;
[0026] adjusting the image to be recognized based on the target transformation matrix to obtain an adjusted image to be recognized;
[0027] Target information is acquired from the adjusted target area of the image to be recognized.
[0028] An embodiment of this specification provides a computer-readable medium having computer-readable instructions stored thereon. The computer-readable instructions can be executed by a processor to implement a method for obtaining information.
[0029] One embodiment of this specification achieves the following beneficial effects:
[0030] In the embodiments of this specification, a target character in an image to be recognized can be identified, and a target transformation matrix for adjusting the image to be recognized can be determined based on the coordinates of the target character to obtain an adjusted image to be recognized, and target information can be obtained from the target area of the adjusted image to be recognized. The image can be adjusted based on the character features in the image, enabling more accurate image matching and thereby improving the accuracy of information acquisition. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0032] Figure 1 A schematic diagram of an application scenario of a method for obtaining information provided in an embodiment of this specification;
[0033] Figure 2 A flowchart of a method for obtaining information provided in an embodiment of this specification;
[0034] Figure 3 A schematic diagram of character association matching provided in an embodiment of this specification;
[0035] Figure 4 A schematic diagram of a template image provided in an example of this specification;
[0036] Figure 5 A swim lane diagram of a method for obtaining information provided in an embodiment of this specification;
[0037] Figure 6 A schematic diagram of the structure of a device for acquiring information provided in an embodiment of this specification;
[0038] Figure 7 This is a schematic diagram of the structure of a device for acquiring information provided in an embodiment of this specification. DETAILED DESCRIPTION
[0039] To make the purpose, technical solutions, and advantages of one or more embodiments of this specification more clear, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in conjunction with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of one or more embodiments of this specification.
[0040] The technical solutions provided by the various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0041] In the prior art, when performing card information recognition, the pixel features of the card image are usually used for card information recognition. Among them, SIFT (Scale-invariant feature transform) features, SURF (Speeded Up Robust Features), FAST (Features from accelerated segment test, corner detection algorithm) features, ORB (Oriented FAST and Rotated BRIEF, corner detection and feature description algorithm) features, etc. are usually used for image registration. These image registration methods have poor robustness, low accuracy, and slow speed, which affects the efficiency and accuracy of image recognition.
[0042] In order to solve the defects in the prior art, this solution provides the following embodiments:
[0043] Figure 1 This is a schematic diagram of an application scenario of a method for obtaining information provided in an embodiment of this specification. Figure 1 As shown, the solution may include an image to be identified 1, a server 2, and an adjusted image to be identified 3, wherein the server 2 can obtain the image to be identified 1, identify the target characters in the image based on image text recognition technology, determine the target transformation matrix for adjusting the image to be identified based on the identified target characters and a pre-generated template image, adjust the image to be identified, obtain the adjusted image to be identified 3, and obtain the required target information from the target area of the adjusted image to be identified 3.
[0044] Next, a method for obtaining information provided in an embodiment of the specification will be described in detail with reference to the accompanying drawings:
[0045] Figure 2 This is a flow chart of a method for obtaining information provided in an embodiment of this specification. From a program perspective, the execution subject of the process can be a program installed on an application server or an application client.
[0046] like Figure 2 As shown, the process may include the following steps:
[0047] Step 202: Obtain an image to be recognized.
[0048] In the embodiments of this specification, the image to be identified may be an image captured or uploaded by a terminal, which may be a mobile phone, a computer, a smart watch, a car computer, etc. The server may obtain the image to be identified captured or uploaded by the terminal.
[0049] Step 204: Identify target characters in the image to be identified that meet preset character image features; the preset character image features are features included in the character image in the template image.
[0050] In the embodiments of this specification, target characters in an image can be recognized based on image text recognition technology, such as OCR (Optical Character Recognition). The target characters can be text information such as words or symbols contained in the image. A template image can be an image pre-stored on a server and can serve as a reference for adjusting the image to be recognized. In actual applications, the template image can be provided by the user or determined by the server based on preset conditions.
[0051] The preset character image features may include features such as the character's font, color, size, and text information. The character image may be an image corresponding to the recognized character in a template image or an image to be recognized. In embodiments of this specification, image registration may be performed based on the target character, and the image to be recognized may be adjusted. The target character may include characters that can be recognized from both the image to be recognized and the template image.
[0052] Step 206: Determine a target transformation matrix based on the coordinates of the target character.
[0053] In actual applications, when recognizing text information in an image, the position information of the image corresponding to each character in the text information in the image to be recognized can also be identified, and the position information of the character can be represented in the form of coordinates.
[0054] Step 208: Adjust the image to be recognized based on the target transformation matrix to obtain an adjusted image to be recognized.
[0055] In the embodiments of this specification, a target transformation matrix may be determined based on the coordinates of the target character, and the image to be recognized may be adjusted so that the angle and size of the image to be recognized after the adjustment are the same as those of the template image. In practical applications, if the deviation between the angle and size of the image to be recognized after the adjustment and the template image is small or within an acceptable range, it can be understood that the angle and size of the image to be recognized after the adjustment are the same as those of the template image.
[0056] Step 210: Acquire target information from the target area of the adjusted image to be recognized.
[0057] In the embodiments of this specification, a target character in an image to be recognized can be identified, and a target transformation matrix for adjusting the image to be recognized can be determined based on the coordinates of the target character to obtain an adjusted image to be recognized, and target information can be obtained from the target region of the adjusted image to be recognized. Image adjustment can be performed based on character features in the image. Because character features are more precise and robust than pixel features, they enable more accurate image matching, improving the accuracy of information acquisition.
[0058] Furthermore, in the embodiments of the present specification, the image to be recognized can be registered and adjusted based on the template image, without the need to train a large number of sample training images for the registration model, which can also reduce costs.
[0059] It should be understood that the order of some steps in the methods described in one or more embodiments of this specification can be interchanged according to actual needs, or some steps can be omitted or deleted.
[0060] based on Figure 2 The present specification also provides some specific implementation plans of the method, which are described below.
[0061] In actual applications, when conducting business transactions, it may be necessary to provide certificate information. In the embodiments of this specification, the information extraction of the certificate can be targeted. Specifically, the image to be recognized may include the card image to be recognized. For example, an ID card, marriage certificate, business license, overseas ID card (English), marriage certificate, real estate certificate, real estate ownership certificate, admission ticket, etc.
[0062] In the embodiments of this specification, the template image may be a card image of the same category as the image to be identified, and information recognition is performed based on the template image of the same category. For example, if the image to be identified is a citizen's ID card, the template image may be a template image derived from the citizen's ID card. Specifically, before identifying the target character in the image to be identified that meets the preset character image characteristics in step 204, the following steps may also be performed:
[0063] A template image corresponding to the image to be identified is determined; the category of the template image is consistent with that of the image to be identified.
[0064] In actual applications, when identifying an image to be identified, the user can select the category of the image to be identified, and the server can also determine the category by itself and determine the template image according to the category of the image to be identified.
[0065] For example, when a user uses a terminal to handle a service, the service requires the user to first provide ID card information and then provide business license information. Assuming that when proceeding to step A, the user is required to provide ID card information, the user can use the terminal to take a photo or scan the ID card. The server obtains the ID card image provided by the user, determines the ID card template image used for registration of the ID card image, and extracts the information from the ID card provided by the user based on the template image. Similarly, assuming that when proceeding to step B, the user is required to provide business license information, the user can also use the terminal to take a photo or scan the business license. The server obtains the business license image provided by the user, determines the business license template image used for registration of the business license image, and extracts the information from the business license provided by the user based on the template image. In actual applications, users can also choose the category of the image to be identified. For example, in step A, the user can first select the ID card as the document to be identified, then take a photo or scan the ID card and provide the ID card image to the server so that the server can identify and extract information.
[0066] In the embodiments of this specification, the template image and the image to be recognized may be associated and matched to determine the target character from the associated and matched characters. Specifically, identifying the target character in the image to be recognized that meets the preset character image features may include:
[0067] Based on the character feature of the first character included in the template image, identifying a second character having the same text information as that corresponding to the first character from the image to be recognized;
[0068] At least part of the second characters is determined as the target characters.
[0069] In practical applications, the first character contained in the template image can be determined using image text recognition technology such as OCR. The first character can be text information commonly included in cards of the same type, and can represent fixed information in cards of the same type. In the embodiments of this specification, the target character can be a character contained in both the template image and the image to be recognized.
[0070] Figure 3 This is a schematic diagram of character association matching provided in the embodiment of this specification. Figure 3As shown, assuming that image 32 to be identified is an ID card image, and template image 31 is a template image of the same category as the image to be identified, character recognition can be performed on both the template image and the image to be identified. The same characters in template image 31 and image 32 can be matched to establish an association between the same characters, that is, an association between the first character and the second character. For example, "Surname" in template image 31 corresponds to "Surname" in image 32 to be identified, and they can be considered a matching pair; and "Live" in template image 31 corresponds to "Live" in image 32 to be identified, and they can be considered a matching pair. In practical applications, all or some of the same characters in the template image and the image to be identified can be matched, and these are not listed here.
[0071] In practical applications, when using image character recognition technology to recognize characters in an image, the coordinates of the recognized characters in the image can also be obtained. In the embodiments of this specification, a target transformation matrix can be obtained based on the character coordinates. Specifically, the target transformation matrix is determined based on the coordinates of the target character in the embodiments of this specification, specifically including:
[0072] Obtaining a first coordinate of the target character in the template image;
[0073] Obtaining a second coordinate of the target character in the image to be recognized;
[0074] The target transformation matrix is obtained based on the first coordinates and the second coordinates.
[0075] In the embodiment of this specification, the target transformation matrix can be obtained according to the formula X=M*U, where X represents the first coordinate of the target character in the template image, M represents the target transformation matrix, and U represents the second coordinate of the target character in the image to be recognized.
[0076] For a two-dimensional plane image, it can be specifically expressed as Among them, the first coordinate X is (x, y), the second coordinate U is (u, v), and the target transformation matrix M is
[0077] Considering that in practical applications, the to-be-recognized image or the template image itself may contain the same characters. For example, a person's name contains the character "生", and the person's ID card image will contain two identical "生", one in "出生" and the other in the name. In this way, when performing character matching, there may be a situation where the "生" in "出生" is matched with the "生" in the name. If the target transformation matrix is calculated using this pair of matching characters, it will be inaccurate and will also affect the recognition of target information. To improve the accuracy of the target transformation matrix and the accuracy of information recognition, in the embodiments of this specification, obtaining the target transformation matrix based on the first coordinate and the second coordinate specifically includes:
[0078] Based on the first coordinate and the second coordinate, obtain a to-be-determined transformation matrix;
[0079] Adjust the to-be-recognized image based on the to-be-determined transformation matrix to obtain a to-be-determined adjusted image;
[0080] Obtain a preset number of third characters in the to-be-determined adjusted image;
[0081] Obtain fourth characters in the template image that are the same as the text information corresponding to the third characters;
[0082] Based on the distance between the coordinates of the third characters in the to-be-determined adjusted image and the coordinates of the fourth characters in the template image, determine whether the to-be-determined transformation matrix is the target transformation matrix.
[0083] In the embodiments of this specification, the accuracy of the transformation matrix obtained based on the first coordinate and the second coordinate can be verified according to the coordinate distance between the third characters and the fourth characters. Furthermore, the correct transformation matrix can be used to adjust the image, and the target information can be obtained more accurately.
[0084] As an implementation manner, in the embodiments of this specification, determining whether the to-be-determined transformation matrix is the target transformation matrix specifically may include:
[0085] Calculate the coordinate distances between each third character and the corresponding fourth character;
[0086] Count the number of third characters whose coordinate distances are less than or equal to the preset distance;
[0087] If the number of characters is greater than or equal to the preset number of characters, determine the to-be-determined transformation matrix as the target transformation matrix.
[0088] In practical applications, the third character and the fourth character may be matching characters, and the coordinate distance between the characters can be calculated based on the coordinate information of the third and fourth characters. The smaller the coordinate distance between the third character and the corresponding fourth character, the more accurate the resulting pending transformation matrix. In the embodiments of this specification, a preset number of characters may be selected for verification calculation. The greater the number of characters whose corresponding coordinate distance is less than or equal to the preset distance, the more accurate the verified pending transformation matrix.
[0089] To further improve the accuracy of verification, the third character in the embodiment of this specification may be a character other than the target character in the to-be-determined adjusted image.
[0090] In practical applications, the number of characters to be verified in the transformation matrix can be set as needed, and can be all characters with a matching relationship, or a portion of the characters. The preset distance and the preset number of characters can also be set according to actual needs and are not specifically limited here. For example, the preset number of characters can be a specific value, or it can be a percentage of the preset number corresponding to the third character. For example, when the number of third characters with a coordinate distance less than or equal to the preset distance is greater than or equal to half of the total number of third characters, the transformation matrix to be determined can be determined to be the target transformation matrix.
[0091] In the embodiments of this specification, the number of target characters can be determined based on the calculation requirements of the conversion matrix. For example, when the template image and the image to be recognized are two-dimensional images, the number of target characters should be greater than or equal to 4.
[0092] In the embodiments of this specification, if the number of third characters whose coordinate distance is less than or equal to the preset distance is less than the preset number of characters, it can be determined that the proposed transformation matrix is not accurate enough and cannot be used as the target transformation matrix. If the proposed transformation matrix cannot be used as the target transformation matrix, characters used to calculate the target transformation matrix can be reselected and calculation and verification can be performed using the reselected characters. This process can be the same as the above process and is not further described here.
[0093] As an implementation method, in the embodiments of this specification, the template image can also be adjusted, and the target transformation matrix can be determined based on the distance between the adjusted target image and the characters in the image to be recognized. Specifically, the target transformation matrix obtained based on the first coordinate and the second coordinate can include:
[0094] Obtaining a to-be-determined transformation matrix based on the first coordinate and the second coordinate;
[0095] Adjusting the template image based on the undetermined transformation matrix to obtain an adjusted template image;
[0096] Obtaining a preset number of third characters in the image to be recognized;
[0097] Acquire a fourth character in the adjusted template image that is identical to the text information corresponding to the third character;
[0098] Based on the distance between the coordinates of the third character in the image to be recognized and the coordinates of the fourth character in the adjusted template image, it is determined whether the undetermined transformation matrix is the target transformation matrix.
[0099] In practical applications, the target characters may at least include the minimum number of characters required to calculate the pending conversion matrix. When determining whether the pending conversion matrix is the target conversion matrix, multiple groups of target characters may be selected, each group of target characters including the minimum number of characters required to calculate the pending conversion matrix, so that multiple pending conversion matrices can be obtained. Then, for each pending conversion matrix, the characters in the image to be recognized or the template image that can meet the pending conversion matrix are calculated, that is, all or other characters in the image to be recognized except the target characters are used as the third character, or all or other characters in the image to be recognized except the target characters that have a matching correspondence with the template image are used as the third character. For each pending conversion matrix, the coordinate distance between each third character and the corresponding fourth character is calculated, and the number of characters whose coordinate distance is less than or equal to the preset distance is counted. The pending conversion matrix with the largest number of characters can be determined as the target conversion matrix.
[0100] In the embodiment of this specification, RANSAC (random sample consensus) can be used to filter out incorrect matching points between the template image and the image to be recognized, and then the target transformation matrix can be calculated using the coordinates of the characters with the correct matching relationship.
[0101] In actual applications, the recognition accuracy of image recognition technologies such as OCR can reach 99%. The above-mentioned method of verifying the transformation matrix can cope with the situation of 50% of incorrect matching points. By verifying the matching accuracy between the template image and the image to be recognized in the embodiment of this specification, it can be more than 97%, which can effectively improve the accuracy of image information recognition.
[0102] In the embodiments of this specification, the template image may contain character information commonly found in images of the same category, so that the template image can be used to identify different images to be recognized within the same category. A target character may be determined from the characters contained in the template image, where the target character is a specific character in the image to be recognized; the specific character may be a character commonly found in different images to be recognized within the same category.
[0103] In practical applications, a template image can be understood as a template corresponding to the image to be recognized, which may contain specific information in specific locations. For example, a template image used to recognize an ID card image may contain information such as "name," "gender," "birthdate," and "citizen ID number."
[0104] In the examples of this specification, a template image can be pre-established, the position information of the target information to be obtained is determined based on the template image, and then the target information in the image to be identified is determined based on the position information. Specifically, the acquisition of target information from the target area of the adjusted image to be identified in the embodiments of this specification can specifically include:
[0105] Determining a target field corresponding to the target information;
[0106] Determining an information display area corresponding to the target field in the template image according to a preset area correspondence relationship; the information display area is used to display description information of the target field; wherein the preset area correspondence relationship includes position information of the target field and the information display area corresponding to the target field;
[0107] determining target coordinates of the display area;
[0108] Determining the area corresponding to the target coordinates in the adjusted image to be recognized as the target area;
[0109] Target information corresponding to the target field is identified from the area corresponding to the target coordinates in the adjusted image to be identified; the target information is information used to describe the target field in the adjusted image to be identified.
[0110] In practical applications, target fields can be determined based on information acquisition requirements to extract the required information from the image to be recognized. For example, when a user is required to provide information such as their name and ID number as found on their ID card when processing a transaction, the target fields could be "Name" or "Citizen ID Number" from the ID card image. The specific target fields can be set based on actual needs and are not specifically limited here.
[0111] In the embodiments of this specification, the image to be recognized can be adjusted based on the target transformation matrix, so that the adjusted image to be recognized has the same size and angle as the template image. In practical applications, the image to be recognized can also be registered to the template image by performing affine transformations, isometric transformations, similarity transformations, or projective transformations based on the characters in the image.
[0112] The template image in the embodiments of this specification can be a user-provided image with clear, squared-off text. Based on user input, a correspondence between the target field and the information display area in the template image can be established, allowing information in the image to be identified to be retrieved based on this correspondence. In practical applications, the template image can be the same card as the image to be identified, or a different card within the same category. For example, the image to be identified could be an image of Zhang San's ID card, and the template image could be an image of Li Si's ID card, or it could be an image of Zhang San's ID card.
[0113] Before obtaining the image to be recognized in the embodiments of this specification, the following steps may also be included:
[0114] Acquire the template image;
[0115] determining a target character in the template image based on a first operation performed by a user on the template image;
[0116] Based on a second operation performed by the user on the template image, determining an information display area corresponding to the target character in the template image; the information display area is used to display description information of the target character;
[0117] The preset area correspondence is obtained according to the correspondence between the target character and the information display area.
[0118] In the examples of this specification, the first operation and the second operation can be selection operations performed by the user. For example, on a terminal page displaying a template image, a user can select, box, long press, or perform other operations on the page. The first operation can determine the target character in the template image and mark it, wherein the area where the target character is located can be marked with a first specified color, such as red. The second operation can determine the descriptive information corresponding to the target character, and mark the information display area where the descriptive information is displayed, wherein the area where the target character is located can be marked with a second specified color, such as blue. The user can be the user who provides the image to be recognized, or a staff member of the system or application.
[0119] Figure 4 This is a schematic diagram of a template image provided in the examples of this specification. Figure 4 As shown, based on the user's first operation, the target character 41 in the template image can be determined, and the area where the target character 41 is located can be marked with a first preset color; based on the user's second operation, the information display area 42 corresponding to the target character 41 in the template image can be determined, and the information display area can be marked with a second preset color. The target character in the template image can be fixed information contained in the same category image, such as Figure 4As shown, the “name”, “gender”, “nationality”, “birth”, “year” and so on marked with a solid frame can mark the area within the solid frame with a first preset color; the description information of the field corresponding to the target character in the template image can be the variable information contained in the category image, such as Figure 4 As shown, “Li Si”, “Male”, “Han”, “1988”, etc. marked with a dotted frame can mark the area within the dotted frame as a second preset color.
[0120] In actual applications, when the user performs the second operation, a character segment filling interface can also be displayed. The user can enter the character segment consisting of the target characters corresponding to the information display area in the character segment filling interface. The server can obtain the character segment corresponding to the information display area, establish a correspondence between the character segment containing the target character and the information display area, and obtain a preset area correspondence. The information display area can be represented by the coordinates of the location of the area. In the embodiment of this specification, the correspondence between the character segment and the information display area can be recorded in the form of a key-value pair. The position information of the information display area can be represented in the form of vertex coordinates. When the information display area is a rectangle, the information display area can be represented by coordinates containing at least a pair of diagonal vertices.
[0121] In the embodiments of this specification, a mask operation can also be performed on the marked template image to obtain an image containing the target character, and then based on the image character recognition technology, the target character and the coordinates corresponding to the target character are obtained, so that the target character and the coordinates of the target character can be used to obtain a transformation matrix for adjusting the image to be recognized.
[0122] In the embodiments of this specification, the image to be identified can be adjusted based on the template image to obtain information in the image to be identified without requiring a large amount of sample training. Compared with deep learning which requires a large amount of sample training, the method provided in the embodiments of this specification only requires a high-quality card image as a template to obtain information in the image to be identified.
[0123] Furthermore, in actual applications, if the image to be recognized is an uncommon card image, such as a licensed veterinarian's qualification certificate or a printed permit, the user's application may not have a process or program for extracting such card information. This requires upgrading the application or using other methods to submit the card information, which can also cause inconvenience to the user. In the embodiments of this specification, a template image provided by the user can be used to create a template image for recognizing the image to be recognized. This allows information extraction from the image to be recognized without modifying the code or updating the application. This allows users to customize the recognition template according to their actual needs and complete image information extraction, resulting in a highly practical and widely applicable solution.
[0124] To more clearly illustrate the method for obtaining information provided in the embodiments of this specification, Figure 5 A swim lane diagram of a method for obtaining information provided in an embodiment of this specification. Figure 5 As shown, the method may include an image acquisition phase, an image adjustment phase, and an information acquisition phase, which may specifically include:
[0125] Step 502: Obtain an image to be recognized;
[0126] Step 504: Determine a template image corresponding to the image to be recognized;
[0127] Step 506: Obtain target characters contained in the image to be recognized and the template image;
[0128] Step 508: determining a target transformation matrix based on the coordinates of the target character in the image to be recognized and the coordinates of the target character in the template image;
[0129] Step 510: adjusting the image to be recognized based on the target transformation matrix to obtain an adjusted image to be recognized;
[0130] Step 512: Determine the information display area corresponding to the target field of the information to be extracted in the template image according to the preset area correspondence relationship;
[0131] Step 514: Determine the coordinate information of the information display area;
[0132] Step 516: Determine the target display area corresponding to the coordinate information in the adjusted image to be recognized;
[0133] Step 518: Acquire target information from the target display area in the adjusted image to be recognized.
[0134] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 6 This is a schematic diagram of a device for obtaining information provided in an embodiment of this specification. Figure 6 As shown, the device may include:
[0135] An image acquisition module 602 is used to acquire an image to be recognized;
[0136] The character recognition module 604 is configured to recognize target characters in the image to be recognized that meet preset character image features; the preset character image features are features contained in the character image in the template image;
[0137] A matrix determination module 606 is configured to determine a target transformation matrix based on the coordinates of the target character;
[0138] An image adjustment module 608 is configured to adjust the image to be recognized based on the target transformation matrix to obtain an adjusted image to be recognized;
[0139] The information recognition module 610 is configured to obtain target information from the target area of the adjusted image to be recognized.
[0140] Based on the same idea, the embodiments of this specification also provide devices corresponding to the above methods.
[0141] Figure 7 This is a schematic diagram of a device for acquiring information provided in an embodiment of this specification. Figure 7 As shown, the device 700 may include:
[0142] at least one processor 710; and,
[0143] A memory 730 in communication with the at least one processor; wherein,
[0144] The memory 730 stores instructions 720 that can be executed by the at least one processor 710. The instructions are executed by the at least one processor 710 to enable the at least one processor 710 to:
[0145] Obtain the image to be recognized;
[0146] Identify a target character in the image to be identified that meets a preset character image feature; the preset character image feature is a feature included in the character image in the template image;
[0147] Determining a target transformation matrix based on the coordinates of the target character;
[0148] adjusting the image to be recognized based on the target transformation matrix to obtain an adjusted image to be recognized;
[0149] Target information is acquired from the adjusted target area of the image to be recognized.
[0150] Based on the same idea, the embodiments of this specification also provide a computer-readable medium corresponding to the above method. The computer-readable medium stores computer-readable instructions, which can be executed by a processor to implement the above method for obtaining information.
[0151] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. Figure 7 As for the device shown, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0152] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures such as diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system onto a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0153] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also understand that in addition to implementing the controller in pure computer-readable program code, the controller can also be implemented in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0154] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0155] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0156] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0157] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0158] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0159] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0160] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0161] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0162] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0163] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0164] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0165] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0166] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A method for obtaining information, comprising: Obtain an image to be recognized; Recognize a target character in the image to be recognized that meets the preset character image features; The preset character image features are features contained in the character image in the template image; Based on the coordinates of the target character, determining a target transformation matrix; Adjusting the image to be recognized based on the target transformation matrix to obtain an adjusted image to be recognized; Acquiring target information from the target area of the adjusted image to be identified; The step of determining a target transformation matrix based on the coordinates of the target character specifically includes: Obtaining a first coordinate of the target character in the template image; Acquire a second coordinate of the target character in the image to be recognized; Based on the first coordinate and the second coordinate, obtaining a transformation matrix to be determined; Adjust the image to be recognized based on the undetermined transformation matrix to obtain an undetermined adjusted image; Obtaining a preset number of third characters in the to-be-determined adjusted image; Acquire a fourth character in the template image that is identical to the text information corresponding to the third character; Based on the distance between the coordinates of the third character in the pending adjusted image and the coordinates of the fourth character in the template image, it is determined whether the pending transformation matrix is the target transformation matrix. 2 . The method according to claim 1 , wherein the image to be identified comprises a card image to be identified.
3. The method according to claim 1, before identifying the target character in the image to be identified that meets the preset character image features, further comprising: Determine a template image corresponding to the image to be recognized; The category of the template image is consistent with that of the image to be identified.
4. The method according to claim 1, wherein the identifying the target character in the image to be identified that meets the preset character image features specifically comprises: Based on the character feature of the first character included in the template image, identifying a second character having the same text information as that corresponding to the first character from the image to be identified; At least part of the second characters are determined as the target characters.
5. According to the method of claim 1, the determining whether the pending transformation matrix is the target transformation matrix specifically comprises: Calculate the coordinate distance between each third character and the corresponding fourth character; Counting the number of third characters whose coordinate distance is less than or equal to the preset distance; If the number of characters is greater than or equal to the preset number of characters, the undetermined conversion matrix is determined as the target conversion matrix. 6 . The method according to claim 1 , wherein the third character is a character other than the target character in the to-be-determined adjusted image.
7. According to the method of claim 1, the target character is a specific character in the image to be recognized; the specific character is a character contained in different images to be recognized of the same category.
8. The method according to claim 1, wherein obtaining target information from the target area of the adjusted image to be identified comprises: Determine a target field corresponding to the target information; Determining the information display area corresponding to the target field in the template image according to the preset area correspondence relationship; The information display area is used to display the description information of the target field; Determining target coordinates of the display area; Determine the area corresponding to the target coordinates in the adjusted image to be identified as the target area; Identify the target information corresponding to the target field from the area corresponding to the target coordinates in the adjusted image to be identified; The target information is information used to describe the target field in the adjusted image to be recognized.
9. The method according to claim 8, before acquiring the image to be identified, further comprising: Acquire the template image; Determining a target character in the template image based on a first operation of the user on the template image; Based on a second operation of the user on the template image, determining an information display area corresponding to the target character in the template image; the information display area is used to display description information of the target character; The preset area correspondence relationship is obtained according to the correspondence relationship between the target character and the information display area.
10. A device for acquiring information, comprising: An image acquisition module, used for acquiring an image to be identified; A character recognition module, used for recognizing a target character in the image to be recognized that meets the preset character image features; The preset character image features are features contained in the character image in the template image; A matrix determination module, used for determining a target transformation matrix based on the coordinates of the target character; An image adjustment module, used for adjusting the image to be identified based on the target transformation matrix to obtain an adjusted image to be identified; An information recognition module, used for acquiring target information from the target area of the adjusted image to be recognized; The matrix determination module is specifically used for: Obtaining a first coordinate of the target character in the template image; Acquire a second coordinate of the target character in the image to be recognized; Based on the first coordinate and the second coordinate, obtaining a transformation matrix to be determined; Adjust the image to be recognized based on the undetermined transformation matrix to obtain an undetermined adjusted image; Obtaining a preset number of third characters in the to-be-determined adjusted image; Acquire a fourth character in the template image that is identical to the text information corresponding to the third character; Based on the distance between the coordinates of the third character in the pending adjusted image and the coordinates of the fourth character in the template image, it is determined whether the pending transformation matrix is the target transformation matrix.
11. A device for acquiring information, comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Obtain an image to be recognized; Recognize the target character in the image to be recognized that meets the preset character image feature; the preset character image feature is the feature contained in the character image in the template image; Based on the coordinates of the target character, determining a target transformation matrix; Adjusting the image to be recognized based on the target transformation matrix to obtain an adjusted image to be recognized; Acquiring target information from the target area of the adjusted image to be identified; The step of determining a target transformation matrix based on the coordinates of the target character specifically includes: Obtaining a first coordinate of the target character in the template image; Acquire a second coordinate of the target character in the image to be recognized; Based on the first coordinate and the second coordinate, obtaining a transformation matrix to be determined; Adjust the image to be recognized based on the undetermined transformation matrix to obtain an undetermined adjusted image; Obtaining a preset number of third characters in the to-be-determined adjusted image; Acquire a fourth character in the template image that is identical to the text information corresponding to the third character; Based on the distance between the coordinates of the third character in the pending adjusted image and the coordinates of the fourth character in the template image, it is determined whether the pending transformation matrix is the target transformation matrix.
12. A computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the method for obtaining information according to any one of claims 1 to 9.
Citation Information
Patent Citations
Target text extraction method and device in certificate, equipment and readable storage medium
CN111126125A
Identity card recognition method in complex scene based on OCR technology
CN111783757A