Image correction method, device and server
Through the method of feature matching and image correction processing, the linear distortion problem of incomplete text contour edges in the prior art is solved, and accurate correction and efficient recognition effects are achieved in various scenarios.
Patent Information
- Application Number
- CN202110546305.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-19
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2041-05-19
AI Technical Summary
When dealing with linear distortion, the text contour in the image is required to be complete, and the text contour edges in the image cannot be effectively handled, resulting in the incomplete linear distortion correction being impossible.
By acquiring the target image, preset feature processing is performed to obtain the target feature set, feature matching is obtained with reference feature sets, and image correction is performed on the target image to eliminate linear distortion.
In many different types of linear distortion scenarios, the linear distortion in the target image is accurately and efficiently eliminated, and the target image with better effect is obtained, which improves the accuracy of subsequent OCR recognition.
Smart Images

Figure CN113516599B_ABST
Abstract
Description
Technical Field
[0001] This specification belongs to the field of artificial intelligence technology, and in particular to an image correction method, device and server. Background Art
[0002] In some business processing scenarios, customers often need to fill out relevant text documents (for example, account opening application documents, etc.) and provide them to business processing personnel. Business processing personnel will first take an image containing the text file, and then perform image recognition (for example, OCR optical character recognition) on the image to extract relevant text information for data entry. However, due to factors such as the shooting method, shooting equipment, and shooting environment, the images taken by business processing personnel for subsequent OCR recognition often have linear distortion, which affects the accuracy of subsequent OCR recognition.
[0003] Based on the existing image correction methods, it is usually necessary to first determine the edge corner points of the text contour in the image, and then rely on the edge corner points of the text contour to correct the linear distortion.
[0004] However, the above method requires that the text contour in the image must be complete during implementation. In many linear distortion scenarios, the edges of the text contour may be lost, which makes it impossible to accurately and effectively correct linear distortion based on existing image correction methods.
[0005] To address the above problems, no effective solution has been proposed yet. Summary of the invention
[0006] This specification provides an image correction method, device and server, which can be effectively applied to a variety of different types of linear distortion scenarios, and can accurately and efficiently eliminate linear distortion in a target image to obtain a corrected target image with better effect.
[0007] An image correction method provided in an embodiment of the present specification includes:
[0008] Obtain a target image containing target text;
[0009] Performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes a plurality of stable features;
[0010] According to the target feature set and the reference feature set, a matching feature set is obtained by feature matching; wherein the reference feature set is a feature set obtained by performing preset feature processing based on a reference image containing a reference text; and the matching feature set includes a plurality of matching feature pairs;
[0011] According to the matching feature set, image correction processing is performed on the target image to eliminate linear distortion in the target image.
[0012] In some embodiments, the target text includes at least one of the following: a contract text, an account opening application text, and a receipt text.
[0013] In some embodiments, performing preset feature processing on the target image to obtain a target feature set includes:
[0014] According to the target image, a Gaussian pyramid about the target image is established;
[0015] Determine and generate a corresponding difference image according to the change data of pixel values between adjacent layer images in the Gaussian pyramid to construct a corresponding Gaussian difference pyramid;
[0016] According to the Gaussian difference pyramid, the same features between different difference images are screened out as stable features to establish the target feature set.
[0017] In some embodiments, establishing a Gaussian pyramid about the target image according to the target image includes:
[0018] The SIFI algorithm based on the Gaussian pyramid scale space model is used to extract features of the target image, and multiple images of different scales are obtained by downsampling.
[0019] A preset Gaussian kernel function is called to perform filtering processing on the multiple images of different scales to obtain a Gaussian pyramid for the target image.
[0020] In some embodiments, obtaining a matching feature set by feature matching according to the target feature set and the reference feature set includes:
[0021] A preset search algorithm is called to process the target feature set and the reference feature set, and target features and reference features whose similarities meet the requirements are respectively searched from the target feature set and the reference feature set to form corresponding matching feature pairs, so as to obtain the matching feature set.
[0022] In some embodiments, the preset search algorithm includes: a fast nearest neighbor search algorithm.
[0023] In some embodiments, obtaining a matching feature set by feature matching according to the target feature set and the reference feature set includes:
[0024] Calling a preset search algorithm to process the target feature set and the reference feature set, searching for two reference features with the highest similarity to the target features in the target feature set from the reference feature set, combining them, and obtaining a plurality of initial matching feature pairs; wherein the initial matching feature pairs include one target feature and two reference features;
[0025] Calculate the similarity distance between the two reference features and the target feature in the initial matching feature pair;
[0026] According to the similarity distance between the two reference features in the initial matching feature pair and the target feature, a corresponding valid matching feature pair is established to obtain the matching feature set.
[0027] In some embodiments, establishing a corresponding valid matching feature pair according to the similarity distance between the two reference features in the initial matching feature pair and the target feature includes:
[0028] The current valid matching feature pair is established according to the similarity distance between the two reference features in the current initial matching feature pair and the target feature in the following manner:
[0029] According to the similarity distances between the two reference features in the current initial matching feature pair and the target feature, a ratio of the similarity distances is calculated;
[0030] Detecting whether the ratio of the similarity distance is greater than a preset first threshold, or less than a preset second threshold; wherein the preset first threshold is greater than the preset second threshold;
[0031] When it is determined that the ratio of the similarity distances is greater than a preset first threshold, or less than a preset second threshold, a reference feature with a smaller similarity distance to the target feature is selected from the two reference features and combined with the target feature as a corresponding valid matching feature pair.
[0032] In some embodiments, after detecting whether the ratio of the similarity distance is greater than a preset first threshold, or less than a preset second threshold, the method further includes:
[0033] When it is determined that the ratio of the similarity distances is less than or equal to a preset first threshold and greater than or equal to a preset second threshold, the current initial matching feature pair is eliminated.
[0034] In some embodiments, performing image correction processing on the target image according to the matching feature set includes:
[0035] According to the matching feature set, a homography matrix mapping the target image to the reference image is obtained by data fitting;
[0036] The target image is linearly transformed using the homography matrix.
[0037] In some embodiments, after performing image correction on the target image according to the matching feature set, the method further includes:
[0038] Slicing the corrected target image according to a target format rule matching the target text to obtain a plurality of sliced images;
[0039] Image recognition is performed on the multiple slice images respectively to obtain target text information.
[0040] The embodiment of this specification also provides an image correction device, including:
[0041] An acquisition module, used for acquiring a target image containing a target text;
[0042] A processing module, used for performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes a plurality of stable features;
[0043] A matching module, configured to obtain a matching feature set by feature matching based on the target feature set and the reference feature set; wherein the reference feature set is a feature set obtained by performing preset feature processing based on a reference image containing a reference text; and the matching feature set includes a plurality of matching feature pairs;
[0044] The correction module is used to perform image correction processing on the target image according to the matching feature set to eliminate linear distortion in the target image.
[0045] An embodiment of the present specification also provides a server, including a processor and a memory for storing processor executable instructions, wherein when the processor executes the instructions, it implements: acquiring a target image containing target text; performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes multiple stable features; obtaining a matching feature set through feature matching based on the target feature set and a reference feature set; wherein the reference feature set is a feature set obtained by performing preset feature processing on a reference image containing reference text; the matching feature set includes multiple matching feature pairs; performing image correction processing on the target image based on the matching feature set to eliminate linear distortion in the target image.
[0046] The embodiments of the present specification also provide a computer storage medium having computer instructions stored thereon, which when executed implement: acquiring a target image containing target text; performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes a plurality of stable features; obtaining a matching feature set by feature matching based on the target feature set and a reference feature set; wherein the reference feature set is a feature set obtained by performing preset feature processing on a reference image containing reference text; the matching feature set includes a plurality of matching feature pairs; performing image correction processing on the target image based on the matching feature set to eliminate linear distortion in the target image.
[0047] The present specification provides an image correction method, device and server. Before implementation, the corresponding reference feature set can be constructed by performing preset feature processing on a standard reference image containing a reference text. During implementation, the preset feature processing can be performed on the target image to be processed containing the target text to extract stable features with good stability for linear transformation to construct the corresponding target feature set. Then, according to the target feature set and the reference feature set, a matching feature set containing multiple matching feature pairs can be obtained by feature matching. The target image can be corrected using the matching feature set. Thus, the method can be effectively applied to a variety of different types of linear distortion scenes (including scenes with incomplete edges of text contours), accurately and efficiently eliminating linear distortion in the target image, and obtaining a corrected target image with better effect. Subsequently, based on the corrected target image, OCR recognition can be performed more accurately to improve OCR recognition accuracy and obtain target text information with relatively small errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of this specification, the drawings required for use in the embodiments will be briefly introduced below. The drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0049] Figure 1 is a schematic diagram of an embodiment of the structural composition of a system using the image correction method provided by the embodiments of this specification;
[0050] Figure 2 is a schematic diagram of an embodiment of an image correction method provided by an embodiment of this specification, in a scenario example;
[0051] Figure 3 is a schematic diagram of an embodiment of an image correction method provided by an embodiment of this specification, in a scenario example;
[0052] Figure 4 is a flowchart of an image correction method provided by an embodiment of this specification;
[0053] Figure 5 It is a schematic diagram of the structure of a server provided by an embodiment of this specification;
[0054] Figure 6 is a schematic diagram of the structure of an image correction device provided by an embodiment of the present specification;
[0055] Figure 7 It is a schematic diagram of an embodiment of applying the image correction method provided by the embodiments of this specification in a scene example. DETAILED DESCRIPTION
[0056] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. 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 creative work should fall within the scope of protection of this specification.
[0057] The present invention provides an image correction method, which can be applied to a system including a server and a terminal device. Figure 1 The server and the terminal device may be connected via wired or wireless means to perform specific data interaction.
[0058] In this embodiment, the server may specifically include a background server applied to one side of the network platform and capable of realizing functions such as data transmission and data processing. Specifically, the server may be, for example, an electronic device having data calculation, storage and network interaction functions. Alternatively, the server may also be a software program running in the electronic device to provide support for data processing, storage and network interaction. In this embodiment, the number of servers included in the server is not specifically limited. The server may specifically be one server, or several servers, or a server cluster formed by several servers.
[0059] In this embodiment, the terminal device may specifically include a front-end electronic device applied to the user side, with a built-in or externally connected camera, capable of realizing functions such as data collection and data transmission. Specifically, the terminal device may be, for example, a smart phone, a monitor, a computer connected to a camera, etc. Alternatively, the terminal device may also be a software application that can be run in the above electronic devices. For example, it may be a monitoring APP running on a smart phone, etc.
[0060] In this embodiment, for the banking business handling scenario, the terminal device may be a surveillance camera deployed near the counter in the banking business handling hall, and the server may be a cloud server of the bank data center network platform. The customer is currently preparing to open an account at the bank.
[0061] Specifically, the customer can currently fill out a specific account opening application form under the guidance of the bank staff, and provide the paper version of the account opening application form to the bank staff.
[0062] Correspondingly, after receiving the account opening application form provided by the customer, the bank staff can first use a surveillance camera to shoot the account opening application form to obtain a target image containing the text of the account opening application form (as the target text).
[0063] The surveillance camera can send the above target image to the cloud server via wired or wireless means, so that the cloud server can subsequently perform targeted OCR recognition on the target image, extract the target text information that the bank is concerned about in the account opening application form, and electronically archive it.
[0064] See also Figure 2 As shown in the figure. Due to the influence of factors such as the camera shooting angle and the placement of the account opening application form, the account opening application form text in the target image directly captured by the surveillance camera is rotated to a certain extent, resulting in linear distortion. This type of linear distortion will have a significant impact on the subsequent OCR recognition accuracy.
[0065] Therefore, in order to improve the subsequent OCR recognition accuracy, after receiving the target image sent by the surveillance camera, the cloud server can first perform image correction on the target image to eliminate linear distortion in the target image.
[0066] When performing image correction, the cloud server can perform preset feature processing on the target image to obtain a corresponding target feature set.
[0067] Specifically, the cloud server can first use the SIFI algorithm based on the Gaussian pyramid scale space model to extract features of the target image, and obtain multiple images of different scales by downsampling; and call the preset Gaussian kernel function to filter the multiple images of different scales to obtain the Gaussian pyramid of the target image. The preset Gaussian kernel function can specifically refer to a Gaussian kernel function with a gradually increasing smoothing coefficient (variance) and a scale-invariant characteristic.
[0068] Then, the cloud server can calculate and generate corresponding differential images layer by layer according to the change data of pixel values between adjacent layer images in the Gaussian pyramid to construct the corresponding Gaussian differential pyramid. Among them, each differential image in the Gaussian differential pyramid contains relatively comprehensive and rich edge features of the target image account opening application text.
[0069] Then, the cloud server can screen out the same features (e.g., common features) between multiple (e.g., 4) different differential images based on the Gaussian difference pyramid as stable features that can maintain stability at different scales; and combine the above multiple stable features to obtain a corresponding target feature set.
[0070] After obtaining the target feature set, the cloud server may obtain a corresponding matching feature set through feature matching based on the target feature set and the reference feature set.
[0071] Specifically, the cloud server can first detect and determine that the target text contained in the target image is the account opening application text; and then find a reference feature set that matches the account opening application text. The reference feature set is a feature set obtained by pre-processing a reference image containing the reference text through a preset feature; the reference text can specifically be the account opening application text; the reference image can specifically be an image containing the account opening application text and without linear distortion; the reference feature set can specifically include multiple stable features obtained based on the reference image.
[0072] Next, the cloud server can call a preset search algorithm (for example, a fast nearest neighbor search algorithm) to search the reference feature set to find two features from the reference feature set that have the highest similarity to each stable feature contained in the target feature set (which can be recorded as target features: ri) as reference features, which are recorded as: fi_t1 and fi_t2 respectively. Among them, the similarity between fi_t1 and ri is higher than the similarity between fi_t2 and ri. And combine the target feature ri with the corresponding two reference features fi_t1 and fi_t2 to obtain an initial matching feature pair, which can be expressed as: (fi_t1-ri-fi_t2). In this way, the cloud server can process the reference feature set and the target feature set by calling the preset search algorithm to obtain multiple initial matching feature pairs.
[0073] Taking into account that there are often some invalid pseudo-matching feature pairs with relatively large errors among the above-mentioned multiple initial matching feature pairs, the cloud server can process the above-mentioned multiple initial matching feature pairs separately, so as to further obtain corresponding effective matching feature pairs with relatively small errors based on the above-mentioned initial matching feature pairs, and construct corresponding matching feature sets.
[0074] Take the processing of any current initial matching feature pair (fi_t1-ri-fi_t2) among multiple initial matching feature pairs as an example. The cloud server can respectively calculate the similarity distances between the target feature ri in the current initial matching feature pair and the two reference features (fi_t1 and fi_t2), which are recorded as: di_1 and di_2 respectively. Among them, di_1 represents the similarity distance between ri and fi_t1, and di_2 represents the similarity distance between ri and fi_t2. The cloud server can calculate the ratio of the similarity distance between the above two similarity distances as di_1 / di_2; and compare the ratio of the similarity distances with a preset second threshold (for example, ratio_threshold). Among them, the value of the above preset second threshold can specifically be a value greater than or equal to 0.6 and less than or equal to 0.7.
[0075] When it is determined through comparison that the ratio of the similarity distances is less than the preset second threshold, it can be determined that in a statistical sense, the difference in the similarity distances between the two reference features and the target feature in the current initial matching feature pair is large, and does not meet the situation of false matching. Further, it can be determined whether the value of the similarity distance di_1 with the smaller value of the two similarity distances is small enough, for example, less than the preset distance threshold.
[0076] When it is determined that di_1 is less than a preset distance threshold, it can be determined that: based on the current initial matching feature pair, a corresponding valid matching feature pair can be further extracted.
[0077] Specifically, the reference feature fi_t1 corresponding to di_1 can be extracted from the current initial feature matching pair and combined with the target feature ri to obtain the corresponding valid matching feature pair, which is recorded as (fi_t1-ri).
[0078] Thus, the processing of the current initial matching feature pair is completed, and the corresponding valid matching feature pair is obtained; then the next initial matching feature pair is obtained and processed.
[0079] On the contrary, when it is determined through comparison that the ratio of the similarity distances is greater than or equal to the preset second threshold, it can be judged that in a statistical sense, the difference in the similarity distances between the two reference features and the target features in the current initial matching feature pair is small, which meets the situation of pseudo matching. It can be determined that based on the current initial matching feature pair, the corresponding effective matching feature pair cannot be further extracted.
[0080] Therefore, the current initial matching feature pair can be eliminated from multiple initial matching feature pairs, and then the next initial matching feature pair can be obtained and processed.
[0081] According to the above method, by processing multiple initial matching feature pairs, a corresponding multiple valid matching feature pairs can be obtained; and multiple valid matching feature pairs are combined to obtain a corresponding matching feature set.
[0082] After obtaining the above-mentioned matching feature set, the cloud server can effectively utilize relatively more diverse and rich stable features based on the matching feature set, rather than relying solely on a single feature such as the edge corner points of the contour, to perform corresponding image correction processing on the target image.
[0083] Specifically, the cloud server can first obtain the homography matrix mapping the target image to the reference image through data fitting according to the matching feature set, which can be recorded as H. Among them, the inverse matrix H' of the above homography matrix can be regarded as the distortion model of the target image with linear distortion relative to the standard reference image without linear distortion.
[0084] In addition, during the fitting process, the cloud server can also use the RANSAC algorithm to filter out interfering data with errors to ensure the robustness of the fitting and improve the accuracy of the obtained homography matrix.
[0085] Next, the cloud server can use the above homography matrix to perform linear transformation processing on the target image to eliminate the linear distortion in the original target image, complete the image correction processing on the target image, and obtain a corrected target image with linear distortion eliminated. Figure 3 Compared with the original target image, the corrected target image has obviously eliminated the linear distortion introduced by the shooting angle rotation.
[0086] Furthermore, the cloud server can find a preset layout rule that matches the text of the account opening application as the target layout rule. Then, according to the target layout rule, the corrected target image is sliced to obtain multiple slice images. Then, the cloud server can perform targeted OCR recognition on the multiple slice images to extract the target text information related to the customer in the account opening application text that the bank is concerned about.
[0087] Finally, the cloud server can electronically archive the target text information in the bank's customer database, thereby completing the complete account opening application process for the customer.
[0088] See also Figure 4 As shown, the embodiment of this specification provides an image correction method. Among them, the method is specifically applied to the server side. When implemented specifically, the method may include the following contents:
[0089] S401: Acquire a target image containing a target text;
[0090] S402: performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes a plurality of stable features;
[0091] S403: Obtaining a matching feature set by feature matching according to the target feature set and the reference feature set; wherein the reference feature set is a feature set obtained by performing preset feature processing based on a reference image containing a reference text; and the matching feature set includes a plurality of matching feature pairs;
[0092] S404: performing image correction processing on the target image according to the matching feature set to eliminate linear distortion in the target image.
[0093] Through the above embodiment, the target image is first subjected to preset feature processing to obtain a target feature set containing stable features about the target text in the target image; then the target feature set is matched with a reference feature set obtained based on a standard reference image to obtain a matching feature set containing multiple matching feature pairs; and then, the target image can be corrected using relatively diverse and rich stable features according to the matching feature set. Thus, it can be effectively applied to various different types of linear distortion scenes (including scenes where the edge corners of the text outline are incomplete or missing), accurately and efficiently eliminating the linear distortion in the target image, and obtaining a corrected target image with better effect.
[0094] In some embodiments, the target image can be specifically understood as image data containing target text. When acquiring the target image, a photo of the target text can be taken by a device with a built-in or external camera as the target image. It is also possible to capture a screenshot containing the target text from the video data as the target image, etc. Of course, the above-listed methods for acquiring the target image are only schematic illustrations. In specific implementation, other suitable acquisition methods can also be used to acquire the target image according to the specific application scenario.
[0095] In some embodiments, the target image may be an image data containing target text and having linear distortion to be corrected. The linear distortion may be understood as an image error introduced by an image acquisition method. The linear distortion may interfere with subsequent image recognition and text information extraction of the target image, thereby affecting the accuracy of text information extraction.
[0096] In some embodiments, the linear distortion introduced by different image acquisition methods often varies greatly. Specifically, the above linear distortion may include: when using a fixed acquisition device such as a scanner or a high-definition camera to acquire a target image, due to the difference in the placement of the target text, the linear distortion introduced is manifested as 2D displacement, 2D rotation, etc.; the above linear distortion may also include: when using a handheld acquisition device such as a mobile phone or a camera to acquire a target image, due to the difference in the angle of the shooting surface of the handheld acquisition device relative to the front view surface, the linear distortion introduced is manifested as 3D perspective deflection, etc.
[0097] In some linear distortion scenarios, sometimes the text outline in the image is incomplete, or the edge corners of the text outline are missing. Existing methods often need to extract and rely on the edge corners of the text outline in the image to build a corresponding distortion model to correct the image. For the above-mentioned linear distortion scenarios, the existing methods are obviously not applicable. In addition, based on the existing methods, for different linear distortions, different distortion models often need to be constructed separately for specific correction. That is, based on the existing methods, it is also impossible to construct and use a unified distortion model to correct a variety of different linear distortions. The image correction method provided in the embodiments of this specification can better solve the above problems by effectively utilizing relatively diverse and rich stable features, rather than relying solely on the edge corners of the text outline. This will be explained in detail later.
[0098] In some embodiments, the target text may specifically refer to a text based on a template mode. Specifically, the target text may include at least one of the following: a contract text, an account opening application text, a receipt text, etc. Of course, it should be noted that the target texts listed above are only schematic illustrations. During specific implementation, according to specific application scenarios and processing requirements, the target text may also include other types of texts, such as financial statement texts, resume texts, archive texts, etc. This specification does not limit this.
[0099] Through the above embodiments, the image correction method provided in this specification can be applied to effectively process a variety of target images containing different target texts to eliminate linear distortion in the various target images.
[0100] In some embodiments, the target text may further include: a certificate containing text characters, which may be a semi-printed certificate, such as a driving license, a real estate certificate, etc., or a one-shot certificate, such as an identity card, a social security card, etc.
[0101] In some embodiments, the target feature set may be specifically understood as a feature set including multiple stable features extracted from the target image, wherein the stable features may also be referred to as anchor features, which may be specifically understood as features having good stability and invariance to linear transformations.
[0102] Specifically, for a target image containing a target text, the above-mentioned stable features may be printed characters or patterns. Figure 2 As shown, the above-mentioned stable features can specifically be a printed header, characters in a printed table, a printed identification pattern (for example, a related logo), etc.
[0103] In some embodiments, the above-mentioned preset feature processing is performed on the target image to obtain a target feature set. When implemented specifically, it may include the following contents:
[0104] S1: According to the target image, a Gaussian pyramid is established for the target image;
[0105] S2: Determine and generate a corresponding difference image according to the change data of pixel values between adjacent layer images in the Gaussian pyramid to construct a corresponding Gaussian difference pyramid;
[0106] S3: According to the Gaussian difference pyramid, the same features between different difference images are screened out as stable features to establish the target feature set.
[0107] Through the above embodiments, stable features with good stability to linear transformation can be extracted from the target image efficiently and accurately to establish a corresponding target feature set.
[0108] In some embodiments, the above-mentioned establishment of a Gaussian pyramid regarding the target image based on the target image may include the following contents during specific implementation: extracting features of the target image using a SIFI algorithm based on a Gaussian pyramid scale space model, and performing downsampling to obtain multiple images of different scales; calling a preset Gaussian kernel function to filter the multiple images of different scales to obtain a Gaussian pyramid regarding the target image.
[0109] Through the above embodiments, a Gaussian pyramid of the target image including multiple scale images can be efficiently and accurately constructed based on the target image.
[0110] In some embodiments, the preset Gaussian kernel function may specifically refer to a Gaussian kernel function with a gradually increasing smoothing coefficient (variance) and a scale-invariant characteristic.
[0111] The above-mentioned SIFI (Scale-invariant feature transform) algorithm may specifically refer to a local feature description operator based on scale-invariant feature transform, which has scale invariance and can detect key points in an image. Specifically, by processing an image using the above-mentioned SIFI algorithm, local features that remain invariant to rotation, scaling, and brightness changes, and also maintain a certain degree of stability to perspective changes, affine transformations, and noise can be found from the image.
[0112] In some embodiments, the above-mentioned screening out the same features between different difference images according to the Gaussian difference pyramid as stable features may include: screening out the same features commonly contained in at least a preset number of difference images according to the Gaussian difference pyramid as stable features. The value of the above-mentioned preset number may be 2, 3, or other integers greater than 1.
[0113] In some embodiments, the reference feature set may be specifically understood as a feature set including multiple stable features extracted from a reference image. The reference image may specifically be an image including a reference text and having no linear distortion, which can be used as a reference benchmark. The reference text may specifically be a text having the same typesetting format as the target text. Specifically, for example, in the case where the target image is an image including the text of an account opening application form, the reference image may be a benchmark image including the text of an account opening application form and having no linear distortion.
[0114] In some embodiments, before implementation, an image containing reference text and without linear distortion may be obtained as a reference image; the reference image is subjected to preset feature processing to obtain the reference feature set. The process of performing preset feature processing on the reference image may refer to the above-mentioned embodiment of performing preset feature processing on the target image. This specification does not elaborate on this.
[0115] In some embodiments, the above-mentioned obtaining a matching feature set through feature matching based on the target feature set and the reference feature set may include the following contents during specific implementation: calling a preset search algorithm to process the target feature set and the reference feature set, and searching for target features and reference features whose similarities meet the requirements from the target feature set and the reference feature set respectively to form corresponding matching feature pairs to obtain the matching feature set.
[0116] Through the above embodiments, the target feature set and the reference feature set can be comprehensively utilized to establish a matching feature set that includes stable features shared by the target image and the reference image.
[0117] In some embodiments, the matching feature set may specifically include a plurality of matching feature pairs, wherein each matching feature pair includes: a stable feature in the target feature set (referred to as the target feature), and a stable feature in the reference feature set (referred to as the reference feature) that matches the target feature.
[0118] In some embodiments, the above-mentioned preset search algorithm may specifically include: a fast nearest neighbor search algorithm.
[0119] Through the above-mentioned embodiment, by using the fast nearest neighbor search algorithm, corresponding matching feature pairs can be searched out based on the target feature set and the reference feature set relatively more efficiently to construct a matching feature set.
[0120] In some embodiments, the above-mentioned obtaining a matching feature set by feature matching based on the target feature set and the reference feature set may include the following contents during specific implementation:
[0121] S1: calling a preset search algorithm to process the target feature set and the reference feature set, searching for two reference features with the highest similarity to the target features in the target feature set from the reference feature set, combining them, and obtaining a plurality of initial matching feature pairs; wherein the initial matching feature pairs include one target feature and two reference features;
[0122] S2: Calculate the similarity distance between the two reference features and the target feature in the initial matching feature pair;
[0123] S3: According to the similarity distance between the two reference features in the initial matching feature pair and the target feature, a corresponding valid matching feature pair is established to obtain the matching feature set.
[0124] Through the above embodiment, the initial matching feature pairs can be constructed first, and then by calculating and based on the similarity distance between the reference feature and the target feature, the initial matching feature pairs with false matches can be identified and eliminated, and effective matching feature pairs with relatively high accuracy and small errors can be established; then, based on the above effective matching feature pairs, a matching feature set with relatively higher accuracy and relatively better effect can be constructed.
[0125] In some embodiments, the above-mentioned establishing a corresponding valid matching feature pair according to the similarity distance between the two reference features in the initial matching feature pair and the target feature may include the following contents during specific implementation: establishing a current valid matching feature pair according to the similarity distance between the two reference features in the current initial matching feature pair and the target feature in the following manner:
[0126] S1: Calculate the ratio of similarity distances between the two reference features and the target feature in the current initial matching feature pair;
[0127] S2: Detect whether the ratio of the similarity distance is greater than a preset first threshold, or less than a preset second threshold;
[0128] S3: When it is determined that the ratio of the similarity distances is greater than a preset first threshold value, or less than a preset second threshold value, a reference feature having a smaller similarity distance with the target feature is selected from the two reference features, and the reference feature is combined with the target feature as a corresponding valid matching feature pair.
[0129] Through the above embodiments, statistical characteristics can be used more effectively to identify and eliminate pseudo-matching feature pairs from multiple initial matching feature pairs; then, based on the eliminated initial matching feature pairs, effective matching feature pairs with higher accuracy and less error are constructed.
[0130] In some embodiments, the above-mentioned preset first threshold value and the preset second threshold value may specifically be values other than 1. Specifically, the above-mentioned preset second threshold value may specifically be a value greater than or equal to 0.6 and less than or equal to 0.7. The above-mentioned preset first threshold value may specifically be a value greater than or equal to 1.2 and less than or equal to 1.5. Of course, the above-mentioned preset first threshold value and preset second threshold value are only schematic illustrations. In specific implementation, the above-mentioned preset first threshold value and preset second threshold value may be flexibly set according to specific circumstances and accuracy requirements.
[0131] In some embodiments, after detecting whether the ratio of the similarity distances is greater than a preset first threshold, or less than a preset second threshold, the method may also include the following contents when it is specifically implemented: when it is determined that the ratio of the similarity distances is less than or equal to the preset first threshold, and greater than or equal to the preset second threshold, the current initial matching feature pair is eliminated.
[0132] Through the above embodiments, statistical characteristics can be used to accurately detect and eliminate pseudo-matching feature pairs, thereby avoiding errors introduced by using pseudo-matching feature pairs.
[0133] In some embodiments, the image correction processing of the target image according to the matching feature set may include the following when implemented:
[0134] S1: According to the matching feature set, a homography matrix mapping the target image to the reference image is obtained by data fitting;
[0135] S2: Using the homography matrix, perform linear transformation processing on the target image.
[0136] Through the above embodiments, the characteristics of the diverse and rich stable features contained in the matching feature set can be effectively utilized, and the linear distortion existing in the original target image can be eliminated by performing corresponding linear transformation processing on the target image, thereby realizing the correction of the target image and obtaining a corrected target image with better effect and higher accuracy.
[0137] In some embodiments, after performing image correction on the target image according to the matching feature set, the method may further include the following when implemented:
[0138] S1: Slicing the corrected target image according to a target layout rule matching the target text to obtain a plurality of sliced images;
[0139] S2: Performing image recognition on the multiple slice images respectively to obtain target text information.
[0140] Through the above embodiments, the corrected target image can be fully utilized to perform more accurate slicing processing to obtain multiple slice images; and then by performing targeted image recognition (for example, OCR recognition) on the slice images, the target text information of interest can be extracted more accurately from the target image.
[0141] In some embodiments, during specific implementation, preset layout rules corresponding to multiple different types of texts can be configured in advance according to the typesetting formats of multiple different types of texts. During specific implementation, a matching preset layout rule can be found from multiple preset layout rules according to the text type of the target text as the target layout rule.
[0142] Then, the corrected target image can be accurately sliced according to the target layout rules to obtain sliced images corresponding to multiple different content identifiers. For example, for an account opening application document, after slicing according to the target layout rules, the following sliced images can be obtained: a first sliced image corresponding to the content identifier "basic customer information", a second sliced image corresponding to the content identifier "opening bank information", and a third sliced image corresponding to the content identifier "account opening requirements", etc.
[0143] In some embodiments, after multiple slice images are obtained through slice processing, the specific implementation may also include: according to business needs, determining the content identifier of the slice image where the text character of interest is located, recording it as the target content identifier; according to the target content identifier, retrieving the content identifiers of multiple slice images to find a slice image that matches the target content identifier as the target slice image; and then only performing targeted image recognition processing on the target slice image to extract the required target text information. This can avoid performing image recognition processing on all slice images, reduce the amount of data processing, and improve data processing efficiency.
[0144] In some embodiments, before implementation, multiple corresponding OCR recognition models can be trained for slice images of multiple content identifiers. After obtaining multiple slice images, multiple OCR recognition models can be specifically called to process the corresponding slice images respectively, so that the corresponding text information can be accurately identified and extracted from each slice image to obtain target text information about the target text.
[0145] In some embodiments, after acquiring the target image, the method may further include: detecting whether there is linear distortion in the target text in the target image. When it is determined that there is linear distortion in the target text in the target image, the method provided in this specification may be triggered to perform corresponding image correction on the target image. On the contrary, when it is determined that there is no linear distortion in the target text in the target image, the corrected target image may be sliced according to the target layout rules that match the target text to obtain a corresponding plurality of slice images; and then targeted image recognition may be performed on each of the plurality of slice images to extract the target text information.
[0146] In some embodiments, after determining through detection that the target text in the target image has linear distortion, the method may further include: determining the text characters in the target text that do not need to be paid attention to according to the target layout rules and business requirements that match the target text; and then shielding the text characters in the target text in the target image that do not need to be paid attention to according to the target layout rules, to obtain the shielded target image for subsequent image correction processing. In this way, before performing the image correction processing, the text characters in the target text in the target image that do not need to be paid attention to can be shielded and filtered out to avoid the interference introduced by such text characters.
[0147] As can be seen from the above, based on the image correction method provided in the embodiment of this specification, for a target image containing a target text based on a printing mode and having linear distortion, before specific implementation, a corresponding reference feature set can be constructed in advance through preset feature processing based on a standard reference image containing a reference text; during specific implementation, the target image to be corrected containing the target text can be first subjected to preset feature processing to extract stable features that are stable and unchanged for linear transformation to construct a corresponding target feature set; then, based on the target feature set and the reference feature set, a matching feature set containing multiple matching feature pairs can be obtained through feature matching; and image correction processing is performed on the target image according to the matching feature set. Thus, it can be effectively applied to a variety of different types of linear distortion scenes, accurately and efficiently eliminate linear distortion in the target image, and obtain a corrected target image with better effect; and then, based on the above-mentioned corrected target image, OCR recognition can be more accurately performed in the future to improve the OCR recognition accuracy and obtain target text information with higher accuracy.
[0148] The embodiments of the present specification also provide a server, including a processor and a memory for storing processor executable instructions, wherein the processor can perform the following steps according to the instructions when implemented: acquiring a target image containing target text; performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes a plurality of stable features; obtaining a matching feature set by feature matching based on the target feature set and a reference feature set; wherein the reference feature set is a feature set obtained by performing preset feature processing on a reference image containing reference text; the matching feature set includes a plurality of matching feature pairs; performing image correction processing on the target image according to the matching feature set to eliminate linear distortion in the target image.
[0149] In order to complete the above instructions more accurately, refer to Figure 5As shown, the embodiment of this specification also provides another specific server, wherein the server includes a network communication port 501, a processor 502 and a memory 503, and the above structures are connected through internal cables so that each structure can perform specific data interaction.
[0150] The network communication port 501 can be specifically used to obtain a target image containing a target text.
[0151] The processor 502 can be specifically used to perform preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes multiple stable features; based on the target feature set and the reference feature set, a matching feature set is obtained through feature matching; wherein the reference feature set is a feature set obtained by performing preset feature processing based on a reference image containing reference text; the matching feature set includes multiple matching feature pairs; based on the matching feature set, image correction processing is performed on the target image to eliminate linear distortion in the target image.
[0152] The memory 503 may be specifically used to store corresponding instruction programs.
[0153] In this embodiment, the network communication port 501 can be a virtual port that is bound to different communication protocols so that different data can be sent or received. For example, the network communication port can be a port responsible for web data communication, a port responsible for FTP data communication, or a port responsible for email data communication. In addition, the network communication port can also be a physical communication interface or communication chip. For example, it can be a wireless mobile network communication chip, such as GSM, CDMA, etc.; it can also be a Wifi chip; it can also be a Bluetooth chip.
[0154] In this embodiment, the processor 502 may be implemented in any appropriate manner. For example, the processor may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) executable by the (micro)processor, a logic gate, a switch, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, etc. This specification does not limit this.
[0155] In this embodiment, the memory 503 may include multiple levels. In a digital system, anything that can store binary data can be a memory; in an integrated circuit, a circuit with a storage function but no physical form is also called a memory, such as RAM, FIFO, etc.; in a system, a storage device with a physical form is also called a memory, such as a memory stick, TF card, etc.
[0156] The embodiments of the present specification also provide a computer storage medium based on the above-mentioned image correction method, wherein the computer storage medium stores computer program instructions, which, when executed, implement: acquiring a target image containing target text; performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set contains a plurality of stable features; obtaining a matching feature set through feature matching based on the target feature set and a reference feature set; wherein the reference feature set is a feature set obtained by performing preset feature processing on a reference image containing reference text; the matching feature set contains a plurality of matching feature pairs; performing image correction processing on the target image based on the matching feature set to eliminate linear distortion in the target image.
[0157] In this embodiment, the storage medium includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a cache, a hard disk (HDD), or a memory card. The memory may be used to store computer program instructions. The network communication unit may be an interface for network connection communication set in accordance with the standard specified by the communication protocol.
[0158] In this embodiment, the functions and effects specifically implemented by the program instructions stored in the computer storage medium can be explained in comparison with other implementations and will not be described in detail here.
[0159] See also Figure 6 As shown, at the software level, the embodiment of this specification also provides an image correction device, which may specifically include the following structural modules:
[0160] The acquisition module 601 may be specifically used to acquire a target image containing a target text;
[0161] The processing module 602 may be specifically used to perform preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes a plurality of stable features;
[0162] The matching module 603 may be specifically configured to obtain a matching feature set by feature matching according to the target feature set and the reference feature set; wherein the reference feature set is a feature set obtained by performing a preset feature processing based on a reference image containing a reference text; and the matching feature set includes a plurality of matching feature pairs;
[0163] The correction module 604 may be specifically configured to perform image correction processing on the target image according to the matching feature set to eliminate linear distortion in the target image.
[0164] It should be noted that the units, devices or modules described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described separately by functions divided into various modules. Of course, when implementing this specification, the functions of each module can be implemented in the same or more software and / or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the 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.
[0165] It can be seen from the above that the image correction device provided in the embodiments of this specification can be effectively applied to a variety of different types of linear distortion scenes, accurately and efficiently eliminate the linear distortion in the target image, and obtain a corrected target image with better effect.
[0166] For a specific scenario example, see Figure 7 As shown, the image correction method provided in the embodiment of this specification can be used to write a corresponding algorithm program to automatically perform image correction on the account opening application form image collected at the bank counter to eliminate linear distortion in the image.
[0167] The above algorithm program may specifically include the following parts:
[0168] 1) Initialization part: used to obtain and use the reference account opening application image R_img (for example, reference image) to construct a corresponding feature vector set F_R (for example, reference feature set).
[0169] 2) Input part: used to input and process the original account opening application image I_img (eg, target image) to be processed.
[0170] 3) Output section: used to output the processed corrected image O_img (for example, the corrected target image).
[0171] When using the above algorithm program to specifically process the input original account opening application form image, in the initialization stage, by using the SIFT feature algorithm interface of the image library (for performing preset feature processing), the feature vector set F_R that remains stable for linear transformation can be extracted from the reference account opening application form image R_img.
[0172] Furthermore, it can refer to Figure 7 As shown, processing the original account opening application form image can specifically include the following contents:
[0173] Step 1: By calling the SIFT feature algorithm interface of the image library (for performing preset feature processing), extract the feature set F_I (for example, the target feature set) of the input original account opening application form picture I_img.
[0174] Step 2: By calling the KNN algorithm of the image library, obtain two nearest neighbors fi_t1 and fi_t2 (for example, two reference features) of each feature ri (for example, the target feature) in the feature set F_R of the reference account opening application form image R_img. Among them, di_1 < di_2.
[0175] Step 3: Calculate the Euclidean distance (for example, the similarity distance) di_1 between the feature ri and fi_t1, and the Euclidean distance di_2 between ri and fi_t2.
[0176] Step 4: According to the formula: di_1 / di_2 < ratio_threshold (for example, the preset second threshold), determine the validity of the matching feature pair. If di_1 / di_2 < ratio_threshold holds, then determine that ri and fi_t1 are valid feature matching pairs (for example, valid matching feature pairs), and ri and fi_t1 can be added to the valid feature matching pair set F_M (for example, the matching feature set).
[0177] In this step, through verification, it is found that: when ratio_threshold is set to 0.6 - 0.7, relatively good results can be obtained.
[0178] Step 5: By calling the homography matrix fitting interface of the image library, fit the homography matrix H that maps the image to be processed to the reference image according to F_M. And during the fitting process, the RANSAC algorithm can also be used to filter out interference points to ensure the robustness of the fitting.
[0179] Step 6: Apply a linear transformation H to the account opening application image I_img to be processed (to perform linear transformation processing), and obtain an output O_img, which is a corrected image (for example, a corrected target image).
[0180] Through the above scenario examples, based on the above algorithm program, it is possible to automatically correct various linear distortion interference situations such as rotation, displacement, scaling, and three-dimensional angle deflection in the picture containing the account opening application, and it can effectively and automatically be compatible with various plane distortions and three-dimensional perspective distortions, providing a unified and universal correction processing method. Different from the previous method of correction based on the corner points of the contour edge, this algorithm program is still effective even when the image of the account opening application loses contour information due to severe distortion. In addition, this algorithm program can effectively process images of the account opening application obtained by various acquisition methods including mobile phone photography and scanning. The algorithm design idea is simple, easy to use, and has good versatility and robustness.
[0181] Furthermore, the above algorithm program can specifically use opencv as the underlying image library, providing a well-encapsulated calling method. The specific implementation and use process may include: (1) Initializing the construction interface and passing in the storage path of the reference account opening application image file. And setting the hyperparameter ratio_threshold. It has been verified that in the account opening application scenario, setting ratio_threshold to 0.6~0.7 can achieve good results; (2) Calling the correction processing interface, passing in the storage path of the account opening application image file to be processed, and the returned output image is the corrected image. Therefore, the above algorithm program can be used to efficiently correct the image to obtain a correction result that eliminates linear distortion.
[0182] Although the present specification provides method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent a unique execution order. When the device or client product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. The first, second, etc. words are used to represent the name, and do not represent any particular order.
[0183] Those skilled in the art also know that, in addition to implementing the controller in a purely computer-readable program code, the controller can be made to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices for implementing various functions included therein 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 for implementing the method and structures within the hardware component.
[0184] This specification 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, classes, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media including storage devices.
[0185] Through the description of the above embodiments, it can be known that those skilled in the art can clearly understand that the present specification can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present specification can essentially be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in each embodiment of the present specification or some parts of the embodiments.
[0186] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. This specification can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0187] Although the present specification is described through embodiments, those skilled in the art will appreciate that there are many modifications and changes to the present specification without departing from the spirit of the present specification, and it is intended that the appended claims include these modifications and changes without departing from the spirit of the present specification.
Claims
1. An image correction method, characterized in that: include: Acquire a target image containing target text; wherein the target image has linear distortion, and the target text includes text based on a template printing mode; Performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes a plurality of stable features; the stable features are features that are stable and invariant to linear transformation; According to the target feature set and the reference feature set, a matching feature set is obtained by feature matching; wherein the reference feature set is a feature set obtained by performing preset feature processing based on a reference image containing a reference text; the matching feature set includes a plurality of matching feature pairs; the reference image is an image containing a reference text and having no linear distortion; the reference text is a text having the same typesetting format as the target text; According to the matching feature set, the target image is subjected to image correction processing to eliminate linear distortion in the target image; wherein the linear distortion includes image errors introduced by the image acquisition method; the linear distortion specifically includes linear distortion manifested as 2D displacement, 2D rotation, and / or linear distortion manifested as 3D perspective deflection.
2. The method according to claim 1, characterized in that: The target text includes at least one of the following: a contract text, an account opening application text, and a receipt text.
3. The method according to claim 2, characterized in that Performing preset feature processing on the target image to obtain a target feature set includes: According to the target image, a Gaussian pyramid about the target image is established; Determine and generate a corresponding difference image according to the change data of pixel values between adjacent layer images in the Gaussian pyramid to construct a corresponding Gaussian difference pyramid; According to the Gaussian difference pyramid, the same features between different difference images are screened out as stable features to establish the target feature set.
4. The method according to claim 3, characterized in that According to the target image, a Gaussian pyramid about the target image is established, including: The SIFI algorithm based on the Gaussian pyramid scale space model is used to extract features of the target image, and multiple images of different scales are obtained by downsampling. A preset Gaussian kernel function is called to perform filtering processing on the multiple images of different scales to obtain a Gaussian pyramid for the target image.
5. The method according to claim 2, characterized in that: According to the target feature set and the reference feature set, a matching feature set is obtained by feature matching, including: A preset search algorithm is called to process the target feature set and the reference feature set, and target features and reference features whose similarities meet the requirements are respectively searched from the target feature set and the reference feature set to form corresponding matching feature pairs, so as to obtain the matching feature set.
6. The method according to claim 5, characterized in that The preset search algorithm includes: a fast nearest neighbor search algorithm.
7. The method according to claim 6, characterized in that According to the target feature set and the reference feature set, a matching feature set is obtained by feature matching, including: Calling a preset search algorithm to process the target feature set and the reference feature set, searching for two reference features with the highest similarity to the target features in the target feature set from the reference feature set, combining them, and obtaining a plurality of initial matching feature pairs; wherein the initial matching feature pairs include one target feature and two reference features; Calculate the similarity distance between the two reference features and the target feature in the initial matching feature pair; According to the similarity distance between the two reference features in the initial matching feature pair and the target feature, a corresponding valid matching feature pair is established to obtain the matching feature set.
8. The method according to claim 7, characterized in that According to the similarity distance between the two reference features in the initial matching feature pair and the target feature, a corresponding valid matching feature pair is established, including: The current valid matching feature pair is established according to the similarity distance between the two reference features in the current initial matching feature pair and the target feature in the following manner: According to the similarity distances between the two reference features in the current initial matching feature pair and the target feature, a ratio of the similarity distances is calculated; Detecting whether the ratio of the similarity distance is greater than a preset first threshold, or less than a preset second threshold; wherein the preset first threshold is greater than the preset second threshold; When it is determined that the ratio of the similarity distances is greater than a preset first threshold, or less than a preset second threshold, a reference feature with a smaller similarity distance to the target feature is selected from the two reference features and combined with the target feature as a corresponding valid matching feature pair.
9. The method according to claim 8, characterized in that After detecting whether the ratio of the similarity distance is greater than a preset first threshold, or less than a preset second threshold, the method further includes: When it is determined that the ratio of the similarity distances is less than or equal to a preset first threshold and greater than or equal to a preset second threshold, the current initial matching feature pair is eliminated.
10. The method according to claim 2, characterized in that According to the matching feature set, image correction processing is performed on the target image, including: According to the matching feature set, a homography matrix mapping the target image to the reference image is obtained by data fitting; The target image is linearly transformed using the homography matrix.
11. The method according to claim 2, characterized in that After performing image correction on the target image according to the matching feature set, the method further includes: Slicing the corrected target image according to a target format rule matching the target text to obtain a plurality of sliced images; Image recognition is performed on the multiple slice images respectively to obtain target text information.
12. An image correction device, characterized in that: include: An acquisition module, used for acquiring a target image containing a target text; wherein the target image has linear distortion, and the target text includes text based on a template printing mode; A processing module, used for performing preset feature processing on the target image to obtain a target feature set; wherein the target feature set includes a plurality of stable features; the stable features are features that are stable and invariant to linear transformation; A matching module, for obtaining a matching feature set by feature matching according to the target feature set and the reference feature set; wherein the reference feature set is a feature set obtained by performing a preset feature processing based on a reference image containing a reference text; the matching feature set includes a plurality of matching feature pairs; the reference image is an image containing a reference text and having no linear distortion; the reference text is a text having the same typesetting format as the target text; A correction module is used to perform image correction processing on the target image according to the matching feature set to eliminate linear distortion in the target image; wherein the linear distortion includes image errors introduced by the image acquisition method; the linear distortion specifically includes linear distortion manifested as 2D displacement, 2D rotation, and / or linear distortion manifested as 3D perspective deflection.
13. A server, characterized in that: The method comprises a processor and a memory for storing processor-executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 11 when executing the instructions.
14. A computer storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed, the steps of the method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Method for extracting spatial feature information based on SIFT scale
CN109145929A
Image recognition method and device, computer equipment and storage medium
CN111414914A