Character recognition method and device, computer device, storage medium and program product
By decomposing character images and matching feature vectors, the problem of low accuracy in character recognition under interference such as rotation, deformation, and scaling is solved, achieving higher recognition accuracy.
Patent Information
- Application Number
- CN202310370391.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-07
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2043-04-07
AI Technical Summary
Existing character recognition methods have low accuracy when the image containing the character to be recognized is subject to interference such as rotation, deformation, or scaling.
The character recognition result is obtained by decomposing the image of the character to be recognized into multiple sub-bands, determining the first feature vector based on the decomposition coefficients of each sub-band, and comparing it with multiple pre-constructed feature vectors.
It improves the accuracy of character recognition, especially in the presence of interference such as rotation, deformation, and scaling, and can recognize characters more accurately.
Smart Images

Figure CN116403224B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a character recognition method and device, a computer device, a storage medium and a program product. BACKGROUND
[0002] Character recognition is a very active branch in the field of pattern recognition. Character recognition can recognize printed characters on paper and store the recognition result in a computer in the form of text. Character recognition can be applied in the financial field. For example, in the process of binding a bank card, the customer needs to manually input the bank card number and check the bank card number multiple times, which is inconvenient for the customer. Using a digital image processing method to take a photo of the bank card, recognizing the bank card number based on the photo, and automatically filling in the recognized bank card number by the system can improve the efficiency of the customer binding the card.
[0003] Nowadays, character recognition usually adopts a template matching method, that is, first, the to-be-recognized character is preprocessed to make the shape of the character and the template the same, and then the preprocessed to-be-recognized character is matched with the template, and the to-be-recognized character that matches successfully is output.
[0004] However, when the picture in which the to-be-recognized character is located has interference such as rotation, deformation, scaling, etc., the recognition accuracy is low. SUMMARY
[0005] Therefore, it is necessary to provide a character recognition method, device, computer device, storage medium and program product capable of improving the character recognition accuracy in view of the above technical problems.
[0006] In a first aspect, the present application provides a character recognition method. The method comprises:
[0007] decomposing a sub-character image in a to-be-recognized character image to obtain a plurality of sub-bands;
[0008] determining a first feature vector of the sub-character image according to decomposition coefficients of the sub-bands;
[0009] obtaining a character recognition result in the to-be-recognized character image according to the first feature vector and a plurality of feature vectors constructed in advance; the feature vector is a vector determined according to decomposition coefficients of sub-bands of a standard character image.
[0010] In one of the embodiments, the determining a first feature vector of the sub-character image according to the decomposition coefficients of the sub-bands comprises:
[0011] determining a first mean value and a first standard deviation of the decomposition coefficients of the sub-bands according to the decomposition coefficients of the sub-bands;
[0012] A first feature vector of the sub-character image is determined according to the first mean and the first standard deviation of the decomposition coefficients of each sub-band.
[0013] In one embodiment, the first feature vector of the sub-character image is determined according to the first mean and the first standard deviation of the decomposition coefficients of each sub-band, including:
[0014] An initial feature vector is determined according to the first mean and the first standard deviation of the decomposition coefficients of each sub-band.
[0015] The initial feature vector is normalized to obtain the first feature vector.
[0016] In one embodiment, the initial feature vector is normalized to obtain the first feature vector, including:
[0017] A second mean and a second standard deviation of each element in the initial feature vector are determined.
[0018] A difference between each element in the initial feature vector and the second mean is determined.
[0019] The first feature vector is obtained according to the difference between each element and the second mean and the second standard deviation.
[0020] In one embodiment, the character recognition result in the to-be-recognized character image is obtained according to the first feature vector and a plurality of feature vectors constructed in advance, including:
[0021] A distance between the first feature vector and each feature vector is determined according to the first feature vector and the plurality of feature vectors constructed in advance.
[0022] The character recognition result in the to-be-recognized character image is obtained according to the distance between the first feature vector and each feature vector.
[0023] In one embodiment, the character recognition result in the to-be-recognized character image is obtained according to the distance between the first feature vector and each feature vector, including:
[0024] A second feature vector is determined according to the distance between the first feature vector and each feature vector; the second feature vector is a feature vector corresponding to a smallest distance.
[0025] The character recognition result in the to-be-recognized character image is obtained according to the second feature vector and the smallest distance.
[0026] In one embodiment, the character recognition result in the to-be-recognized character image is obtained according to the second feature vector and the smallest distance, including:
[0027] if the minimum distance is less than a preset threshold, obtaining the character in the sub-character image according to the second feature vector;
[0028] determining a first new sub-character image in a first direction according to the position information of the character in the sub-character image and the first preset intercepting distance, and returning to execute the step of decomposing the first new sub-character image to obtain a plurality of sub-bands to obtain the character in the first new sub-character image;
[0029] determining the character recognition result in the to-be-recognized character image according to the character in the sub-character image and the character in each first new sub-character image.
[0030] In one of the embodiments, the obtaining the character recognition result in the to-be-recognized character image according to the second feature vector and the minimum distance comprises:
[0031] if the minimum distance is greater than or equal to a preset threshold, determining a second new sub-character image in a second direction according to the second feature vector and a second preset intercepting distance, and returning to execute the step of decomposing the second new sub-character image to obtain a plurality of sub-bands to obtain the character in the second new sub-character image; the second direction is opposite to the first direction;
[0032] determining a first new sub-character image in the first direction according to the position information of the character in the second new sub-character image and the first preset intercepting distance, and returning to execute the step of decomposing the first new sub-character image to obtain a plurality of sub-bands to obtain the character in the first new sub-character image;
[0033] determining the character recognition result in the to-be-recognized character image according to the character in the sub-character image and the character in each first new sub-character image.
[0034] In one of the embodiments, the method further comprises:
[0035] performing a gray-scale processing on the target image to obtain a gray-scale processed target image;
[0036] determining the to-be-recognized character image according to the gray-scale processed target image.
[0037] In one of the embodiments, the determining the to-be-recognized character image according to the gray-scale processed target image comprises:
[0038] performing a binaryzation processing on the gray-scale processed target image to obtain a first pre-processed image;
[0039] determining a background region and a target region of the first pre-processed image;
[0040] The character image to be recognized is determined based on the background and target regions of the first preprocessed image.
[0041] Secondly, this application also provides a character recognition device. The device includes:
[0042] The decomposition module is used to decompose the sub-character images in the character image to be recognized into multiple sub-bands;
[0043] The first determining module is used to determine the first feature vector of the sub-character image based on the decomposition coefficients of each sub-band;
[0044] The recognition module is used to obtain the character recognition result in the character image to be recognized based on the first feature vector and a plurality of pre-constructed feature vectors; the feature vector is a vector determined based on the decomposition coefficients of each sub-band of the standard character image.
[0045] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the above-described method.
[0046] Fourthly, this application also provides a computer-readable storage medium. This computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.
[0047] Fifthly, this application also provides a computer program product. This computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described methods.
[0048] The aforementioned character recognition methods, apparatus, computer devices, storage media, and computer program products allow the computer device to decompose a sub-character image in a character image to be recognized into multiple sub-bands. Then, based on the decomposition coefficients of each sub-band, a first feature vector of the sub-character image is determined. Based on the first feature vector and multiple pre-constructed feature vectors determined from the decomposition coefficients of each sub-band of a standard character image, the character recognition result in the character image to be recognized is obtained. Traditional techniques employ template matching, where the character to be recognized is first pre-processed to ensure its shape matches the template, and then the pre-processed character is matched against the template. Successfully matched characters are then output. However, this method suffers from low accuracy when the image containing the character to be recognized is subject to rotation, deformation, scaling, or other interference. In this embodiment, the first feature vector is determined using the sub-bands obtained from the sub-character image decomposition. This first feature vector is then compared with multiple pre-constructed feature vectors to obtain the character recognition result in the character image to be recognized, thus improving the accuracy of character recognition. Attached Figure Description
[0049] Figure 1 One of flowcharts of a character recognition method provided by an embodiment of the present application;
[0050] Figure 2 A schematic diagram of wavelet decomposition provided by an embodiment of the present application;
[0051] Figure 3 One of flowcharts of a first feature vector determination method provided by an embodiment of the present application;
[0052] Figure 4 Another flowchart of a first feature vector determination method provided by an embodiment of the present application;
[0053] Figure 5 A third flowchart of a first feature vector determination method provided by an embodiment of the present application;
[0054] Figure 6 One of flowcharts of a character recognition result determination method provided by an embodiment of the present application;
[0055] Figure 7 Another flowchart of a character recognition result determination method provided by an embodiment of the present application;
[0056] Figure 8 A third flowchart of a character recognition result determination method provided by an embodiment of the present application;
[0057] Figure 9 A fourth flowchart of a character recognition result determination method provided by an embodiment of the present application;
[0058] Figure 10 Another flowchart of a character recognition method provided by an embodiment of the present application;
[0059] Figure 11 A flowchart of a to-be-recognized character image determination method provided by an embodiment of the present application;
[0060] Figure 12 A structural block diagram of a character recognition device provided by an embodiment of the present application;
[0061] Figure 13 An internal structure diagram of a computer device in one embodiment. DETAILED DESCRIPTION
[0062] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.
[0063] In the prior art, a character image is usually recognized by a template matching method or an artificial neural network method. When the template matching method is used, the character to be recognized is preprocessed first to make the shape of the character and a template the same, and then the preprocessed character to be recognized is matched with the template, and the character to be recognized that is successfully matched is output. However, when the picture in which the character to be recognized is located has interference such as rotation, deformation, scaling and the like, the recognition accuracy is low. The artificial neural network is prone to problems such as local extreme value, slow convergence speed, difficulty in determining the number of hidden layer nodes and the like in feature extraction, parameter selection, network learning and training, and also leads to low character recognition accuracy.
[0064] In one embodiment, a character recognition method is provided, Figure 1 One of the flowcharts of the character recognition method provided in the embodiments of the present application is shown in Figure 1 The method comprises the following steps:
[0065] S101, decomposing a sub-character image in a character image to be recognized to obtain a plurality of sub-bands.
[0066] The character image to be recognized can include a bank card photo, and the sub-character image can be obtained by the following method:
[0067] The sub-character image is obtained by using a sliding window to intercept the character image to be recognized.
[0068] In the embodiments of the present application, a character image to be recognized containing characters can be input into a computer device, and the computer device can use a decomposition algorithm to decompose a sub-character image in the character image to be recognized at least once to obtain a plurality of sub-bands.
[0069] For example, a character image can be obtained by using a sliding window to intercept an image of a preset area size in a bank card photo, and a base function in a wavelet decomposition algorithm is used to perform four times of wavelet decomposition on the character image to obtain a plurality of sub-bands. Figure 2 A schematic diagram of wavelet decomposition provided in the embodiments of the present application is shown in Figure 2 , which shows a schematic diagram of wavelet decomposition of a character image. L represents low frequency, H represents high frequency, 1 and 2 represent 1-layer and 2-layer decomposition, the character image is decomposed into 4 sub-bands at each scale, LL represents a low frequency sub-band, LH represents a high frequency sub-band along the horizontal direction, HL represents a high frequency sub-band along the vertical direction, and HH represents a high frequency sub-band along the diagonal direction.
[0070] It should be noted that the distance of each sliding of the sliding window can be determined according to the spacing between characters in the character image to be recognized. For example, the character image to be recognized is a bank card photo, and the distance of each sliding can be 50 pixel values.
[0071] In S102, the computer device determines a first feature vector of the sub-character image according to the decomposition coefficients of each sub-band.
[0072] Each sub-band contains at least one decomposition coefficient.
[0073] In the embodiment of the present application, the computer device can multiply the decomposition coefficients of each sub-band by a preset correction coefficient to obtain the corrected decomposition coefficients of each sub-band, and then calculate the mean and standard deviation of the corrected decomposition coefficients of each sub-band. The mean and standard deviation of the corrected decomposition coefficients of each sub-band can be used as the first feature vector.
[0074] In S103, the computer device obtains a character recognition result in the character image to be recognized according to the first feature vector and a plurality of pre-constructed feature vectors. The feature vector is a vector determined according to the decomposition coefficients of each sub-band of a standard character image.
[0075] The plurality of pre-constructed feature vectors can be obtained by using at least one of a variational mode decomposition, a wavelet decomposition algorithm, and a matrix decomposition algorithm.
[0076] In the embodiment of the present application, the computer device can calculate the distances between the first feature vector and the plurality of pre-constructed feature vectors, and then determine the feature vector closest to the first feature vector according to the distances. The character corresponding to the feature vector closest to the first feature vector is output, and the first character is recognized. The computer device can determine the next sub-character image to be recognized in the character image to be recognized, and then execute the steps after the sub-character image is decomposed to obtain a plurality of sub-bands to determine the next character. According to the method, new characters can be obtained continuously, i.e., the character recognition result in the character image to be recognized can be obtained.
[0077] In the character recognition method, the computer device can decompose the sub-character image in the to-be-recognized character image to obtain a plurality of sub-bands, determine a first feature vector of the sub-character image according to the decomposition coefficients of the sub-bands, and obtain a character recognition result in the to-be-recognized character image according to the first feature vector and a plurality of feature vectors that are constructed in advance according to the decomposition coefficients of the sub-bands of the standard character image. In the prior art, a template matching method is used, that is, the to-be-recognized character is preprocessed first to make the shape of the character same as that of a template, and then the preprocessed to-be-recognized character is matched with the template, and the to-be-recognized character that is successfully matched is output. However, when the picture in which the to-be-recognized character is located has interference such as rotation, deformation, scaling and the like, the method can result in low recognition accuracy. In the embodiment of the present application, the sub-bands obtained by decomposing the sub-character image are used to determine the first feature vector, and the first feature vector is compared with the plurality of feature vectors constructed in advance to obtain the character recognition result in the to-be-recognized character image, so that the accuracy of character recognition can be improved.
[0078] In one embodiment, Figure 3 One of the flowcharts of a first feature vector determination method provided in the embodiments of the present application, the present embodiment relates to one possible implementation manner of how to determine the first feature vector of the sub-character image according to the decomposition coefficients of the sub-bands, and on the basis of the above-mentioned embodiment, S102 includes:
[0079] S301, determining a first mean value and a first standard deviation of the decomposition coefficients of the sub-bands according to the decomposition coefficients of the sub-bands.
[0080] In the embodiments of the present application, each sub-band obtained by decomposing the sub-character image in the to-be-recognized character image by using the decomposition algorithm has a decomposition coefficient, and the computer device can calculate the first mean value and the first standard deviation of the decomposition coefficients of the sub-bands according to the decomposition coefficients of the sub-bands.
[0081] For example, the decomposed sub-band can be denoted as ∫ i (x,y)(M×N), i = 1, 2, …, n, where i is the number of wavelet coefficients of the sub-band, (x,y) is a given card number pixel coordinate, M is the number of directions, and N is the number of scales, and then:
[0082]
[0083]
[0084] where ∪ i represents the first mean value of the decomposition coefficients of the sub-bands, and σ i represents the first standard deviation of the decomposition coefficients of the sub-bands.
[0085] S302, determine the first feature vector of the sub-character image according to the first mean and the first standard deviation of the decomposition coefficients of each sub-band.
[0086] In the embodiment of the application, the first mean and the first standard deviation of the decomposition coefficients of each sub-band are multiplied by a preset correction coefficient respectively to obtain the first mean and the first standard deviation of the corrected decomposition coefficients of each sub-band, and the first mean and the first standard deviation of the corrected decomposition coefficients of each sub-band are taken as the feature vector to constitute the first feature vector of the sub-character image.
[0087] In the above embodiment, the first mean and the first standard deviation of the decomposition coefficients of each sub-band are determined according to the decomposition coefficients of each sub-band, and the first feature vector of the sub-character image is determined according to the first mean and the first standard deviation of the decomposition coefficients of each sub-band, so that the features of the sub-character image can be expressed in the form of a vector, and the character recognition accuracy is improved by matching the vector with the vectors in the feature library.
[0088] In one embodiment, Figure 4 A second flowchart of a first feature vector determination method is provided in the embodiment of the application, and the embodiment relates to a possible implementation manner of how to determine the first feature vector of the sub-character image according to the first mean and the first standard deviation of the decomposition coefficients of each sub-band. On the basis of the above embodiment, S302 includes the following steps.
[0089] S401, determine the initial feature vector according to the first mean and the first standard deviation of the decomposition coefficients of each sub-band.
[0090] In the embodiment of the application, the computer device can take the first mean and the first standard deviation of the decomposition coefficients of each sub-band as the feature vector to constitute the initial feature vector of the sub-character image.
[0091] For example, the first mean of the decomposition coefficients of sub-band 1 is u1, the first standard deviation of the decomposition coefficients of sub-band 1 is σ1, the first mean of the decomposition coefficients of sub-band 2 is u2, and the first mean of the decomposition coefficients of sub-band 2 is σ2, which can constitute the initial feature vector T = [u1, σ1, u2, σ2] of the sub-character image.
[0092] S402, normalize the initial feature vector to obtain the first feature vector.
[0093] In the embodiment of the application, the computer device can use at least one of the maximum-minimum normalization method, the standard score normalization method, the L1 normalization method, and the L2 normalization method to normalize the initial feature vector to obtain the normalized initial feature vector, that is, the first feature vector. Each component in the first feature vector is normalized to [-1, 1].
[0094] In the above embodiment, the computer device can determine the initial feature vector according to the first mean and the first standard deviation of the decomposition coefficients of each subband, and then normalize the initial feature vector to obtain the first feature vector. Since the physical meaning and the value range of the first feature vector are different, the normalization of the initial feature vector can reduce the deviation.
[0095] In one embodiment, Figure 5 FIG. 3 is a flowchart of a third embodiment of a method for determining a first feature vector, which relates to a possible implementation of how to normalize an initial feature vector to obtain a first feature vector. In the above embodiment, S402 includes the following steps.
[0096] S501: Determine the second mean and the second standard deviation of each element in the initial feature vector.
[0097] In the embodiment, the second mean of each element in the initial feature vector and the second standard deviation of each element in the initial feature vector can be calculated.
[0098] Specifically, taking the above example, the initial feature vector T of the sub-character image is [u1, σ1, u2, σ2], and the first mean m and the first standard deviation σ of each element in T can be calculated according to the initial feature vector.
[0099] S502: Determine the difference between each element in the initial feature vector and the second mean.
[0100] In the embodiment, the difference between each element in the initial feature vector and the second mean is calculated.
[0101] S503: Obtain the first feature vector according to the difference between each element and the second mean and the second standard deviation.
[0102] In the embodiment, the ratio of the difference between each element and the second mean to the second standard deviation can be calculated, and the obtained ratios can constitute the first feature vector.
[0103] For example, taking the steps of S502 and S503 as an example, the initial feature vector is [∫1, ∫2,.... ∫ N ], the mean m and the first standard deviation σ are calculated, and then:
[0104]
[0105] The first feature vector is [F1, F2,.... F N ].
[0106] In the above embodiment, the second mean value and the second standard deviation of each element in the initial feature vector are determined, the difference between each element in the initial feature vector and the second mean value is determined, and then the first feature vector is obtained according to the difference between each element and the second mean value and the second standard deviation. The normalization can reduce the influence of the super large or super small elements on the element value distribution. Since the physical meaning and the value range of the first feature vector are different, the normalization of the initial feature vector can reduce the deviation.
[0107] In one embodiment, Figure 6 One of the flowcharts of a character recognition result determination method provided in the embodiments of the present application, the present embodiment relates to a possible implementation manner of how to obtain the character recognition result in the to-be-recognized character image according to the first feature vector and the plurality of pre-constructed feature vectors. On the basis of the above embodiment, S103 includes:
[0108] S601, determining the distance between the first feature vector and each feature vector according to the first feature vector and the plurality of pre-constructed feature vectors.
[0109] The plurality of pre-constructed feature vectors can be the plurality of pre-constructed feature vectors obtained by extracting features by using the wavelet decomposition algorithm. For example, the N target images can be manually segmented to obtain a plurality of character images, and then the character images are filtered by using a wavelet filter to extract features of one scale and four angles. Then, the features are reduced in dimension by using the principal component analysis method, and then linear discriminant dimension reduction is performed to obtain the plurality of pre-constructed feature vectors.
[0110] In the embodiments of the present application, the computer device can calculate the distance between the first feature vector and the plurality of pre-constructed feature vectors by using at least one of the Euclidean distance algorithm, the Manhattan distance algorithm and the Mahalanobis distance algorithm, to determine the distance between the first feature vector and each feature vector.
[0111] S602, obtaining the character recognition result in the to-be-recognized character image according to the distance between the first feature vector and each feature vector.
[0112] In the embodiments of the present application, the computer device can determine the distance smaller than the preset distance threshold by calculating the distance between the first feature vector and each feature vector, and obtain the character in the sub-character image according to the feature vector corresponding to the distance. In this way, the character recognition result in the to-be-recognized character image can be obtained.
[0113] In the above embodiment, the computer device can determine distances between the first feature vector and each feature vector according to the first feature vector and the plurality of pre-constructed feature vectors, obtain the character recognition result in the to-be-recognized character image according to the distances between the first feature vector and each feature vector, and improve the efficiency of character recognition and obtain a more accurate character recognition result.
[0114] In one embodiment, Figure 7 A flowchart of a character recognition result determination method provided in the embodiment of the present application is shown in FIG. 2. The embodiment relates to a possible implementation manner of how to obtain a character recognition result in a to-be-recognized character image according to distances between a first feature vector and each feature vector. In the above embodiment, S602 includes:
[0115] S701, determining a second feature vector according to distances between the first feature vector and each feature vector; the second feature vector is a feature vector corresponding to a minimum distance.
[0116] In the embodiment of the present application, the computer device can determine a feature vector corresponding to a minimum distance according to distances between the first feature vector and each feature vector.
[0117] S702, obtaining a character recognition result in a to-be-recognized character image according to the second feature vector and the minimum distance.
[0118] In the embodiment of the present application, the minimum distance can be multiplied by a preset correction coefficient to obtain a corrected minimum distance. If the corrected minimum distance is less than a preset threshold, it is considered that there is a character at this position, and then a character in a sub-character image can be obtained according to the second feature vector. The to-be-recognized image is intercepted to obtain a new sub-character image, and the steps of S101 to S103 are performed on the new sub-character image.
[0119] It should be noted that if the to-be-recognized image is a card number image, the recognition ends when the recognized character is greater than or equal to 19 digits. Alternatively, the recognition ends when the sum of the current position of the sliding window and 20 pixel values is greater than or equal to the width of the card number image.
[0120] In the above embodiment, the computer device determines a second feature vector according to distances between the first feature vector and each feature vector; the second feature vector is a feature vector corresponding to a minimum distance. Then, a character recognition result in a to-be-recognized character image is obtained according to the second feature vector and the minimum distance, which can improve the accuracy of character recognition.
[0121] In one embodiment, Figure 8FIG. 3 is a flowchart of a third embodiment of a method for determining a character recognition result according to the present application. The third embodiment relates to a possible implementation of how to obtain a character recognition result in a to-be-recognized character image according to the second feature vector and the smallest distance. The S702 in the above embodiment includes the following steps.
[0122] S801, if the smallest distance is smaller than the preset threshold, obtaining a character in the sub-character image according to the second feature vector.
[0123] In the embodiment of the present application, if the smallest distance is smaller than the preset threshold, the character corresponding to the second feature vector is taken as the character in the sub-character image.
[0124] S802, determining a first new sub-character image in the first direction according to the position information of the character in the sub-character image and the first preset intercepting distance, and returning to execute the step of decomposing the first new sub-character image to obtain a plurality of sub-bands to obtain the character in the first new sub-character image.
[0125] The first preset intercepting distance can be a distance moved by a sliding window.
[0126] In the embodiment of the present application, the current position of the character in the sub-character image is determined according to the position information of the character in the sub-character image. The first new sub-character image is obtained by moving the current position to the first direction by the first preset intercepting distance. Then, the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed to obtain the character in the first new sub-character image.
[0127] S803, determining a character recognition result in the to-be-recognized character image according to the character in the sub-character image and the characters in the first new sub-character images.
[0128] In the embodiment of the present application, since the character in the sub-character image and the characters in the first new sub-character images are obtained, the character in the sub-character image and the characters in the first new sub-character images are the characters in the to-be-recognized character image.
[0129] In the above embodiment, if the smallest distance is smaller than the preset threshold, the character in the sub-character image is obtained according to the second feature vector. The first new sub-character image in the first direction is determined according to the position information of the character in the sub-character image and the first preset intercepting distance. Then, the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is returned to be executed to obtain the character in the first new sub-character image. Finally, the character recognition result in the to-be-recognized character image is determined according to the character in the sub-character image and the characters in the first new sub-character images. The efficiency of character recognition is improved, and a more accurate character recognition result is obtained.
[0130] In one embodiment, Figure 9 FIG. 4 is a flowchart of a character recognition result determination method according to an embodiment of the present application. The embodiment relates to a possible implementation of how to obtain a character recognition result in a to-be-recognized character image according to a second feature vector and a minimum distance. Based on the above embodiment, S702 includes:
[0131] S901, if the minimum distance is greater than or equal to a preset threshold, a second new sub-character image is determined according to the second feature vector and a second preset intercepting distance along a second direction, and the step of decomposing the second new sub-character image to obtain a plurality of sub-bands is executed to obtain a character in the second new sub-character image; the second direction is opposite to the first direction.
[0132] The second preset intercepting distance can be a distance moved by a sliding window, and the second preset intercepting distance can be determined according to a character size. For example, if the character size is about 43 pixel values, the second preset intercepting distance can be 40 pixel values. The second direction can be opposite to the first direction.
[0133] In the embodiment of the present application, if the minimum distance is greater than or equal to the preset threshold, it is considered that the sub-character image does not have a corresponding character. Then, the sliding window can be used to slide the second preset intercepting distance in the second direction at a position corresponding to the second feature vector, to obtain a second new sub-character image. The step of decomposing the second new sub-character image to obtain a plurality of sub-bands is executed until a new minimum distance is less than the preset threshold. Then, a character expressed by a vector corresponding to the new minimum distance is a character in the second new sub-character image. The character in the second new sub-character image is obtained by this method.
[0134] S902, a first new sub-character image is determined according to position information of the character in the second new sub-character image and the first preset intercepting distance along the first direction, and the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed to obtain a character in the first new sub-character image.
[0135] In the embodiment of the present application, the computer device can determine a current position of the character in the second new sub-character image according to the position information of the character in the second new sub-character image. The first new sub-character image is obtained by moving the current position to the first direction by the first preset intercepting distance. Then, the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed to obtain the character in the first new sub-character image.
[0136] S903, a character recognition result in the to-be-recognized character image is determined according to the character in the sub-character image and the characters in the first new sub-character images.
[0137] In the embodiment of the present application, since the character in the sub-character image and the character in each first new sub-character image are obtained, the character in the sub-character image and the character in the first new sub-character image are the character in the to-be-recognized character image.
[0138] In the above embodiment, if the minimum distance is greater than or equal to the preset threshold, the second new sub-character image is determined along the second direction according to the second feature vector and the second preset intercepting distance, and the step of decomposing the second new sub-character image to obtain a plurality of sub-bands is executed to obtain the character in the second new sub-character image. The first new sub-character image is determined along the first direction according to the position information of the character in the second new sub-character image and the first preset intercepting distance, and the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed to obtain the character in the first new sub-character image. The character recognition result in the to-be-recognized character image is determined according to the character in the sub-character image and the character in each first new sub-character image, wherein the second direction is opposite to the first direction. The efficiency of character recognition can be improved, and a more accurate character recognition result can be obtained.
[0139] In one embodiment, Figure 10 A flowchart of a character recognition method provided in another embodiment of the present application is shown in FIG. 2. Based on the above embodiment, the method further includes the following steps.
[0140] S1001, performing gray-scale processing on a target image to obtain a target image after gray-scale processing.
[0141] In the embodiment of the present application, the computer device can use the OpenCV technology to perform gray-scale processing on the target image to obtain the target image after gray-scale processing.
[0142] It should be noted that the target image usually photographed or saved is a color image. When processing the target image, three color components are processed respectively, and the calculation amount is large and the calculation time is long. The gray-scale image can represent the morphological features of the target image, and the storage space occupied by the gray-scale image is smaller than that of the color image.
[0143] S1002, determining a to-be-recognized character image according to the target image after gray-scale processing.
[0144] In the embodiment of the present application, the computer device can directly use the target image after gray-scale processing as the to-be-recognized character image.
[0145] In the embodiment of the present application, the target image after gray-scale processing is obtained by performing gray-scale processing on the target image, and then the to-be-recognized character image is determined according to the target image after gray-scale processing, which can reduce the subsequent calculation time and the occupation of storage space.
[0146] In one embodiment,Figure 11 A flowchart of a method for determining a character image to be recognized is provided in an embodiment of the present application. The embodiment relates to a possible implementation manner for determining a character image to be recognized according to a target image after grayscale processing. In the above embodiment, S1002 includes:
[0147] S1101, performing binarization processing on the target image after grayscale processing to obtain a first preprocessed image.
[0148] In the embodiment of the present application, the computer device can perform binarization processing on the target image after grayscale processing by using the maximum inter-class variance algorithm to obtain the image after binarization processing, that is, the first preprocessed image.
[0149] Specifically, binarization refers to converting an image into an image containing only two pixel values, which are represented by 255 and 0 for white and black, respectively. The implementation manner of binarization is to calculate a threshold value by a function, and set the pixel value of a pixel point higher than the threshold value to 255 and the pixel value of a pixel point lower than the threshold value to 0. The maximum inter-class variance algorithm can be used for binarization processing.
[0150] For selection of the threshold value, first set an initial binarization classification threshold value as T, which divides the image into two categories A and B; set the total number of pixels as N, wherein the number of pixels in category A is NA, and the number of pixels in category B is NB; set the number of pixels of each grayscale level as Ni, and the probability of the pixel grayscale level i is Set the total grayscale level of the image as L-1, and there is Then, the average values of categories A and B are MA and MB, respectively. Then, the average value of the entire image is M = PA × MA + PB × MB, and the inter-class variance between categories A and B is σ 2 = PA × (MA-M) 2 + PB × (MB-M) 2 The greater the value of σ 2 , the better the binarization classification effect of the image, and the threshold value T that can maximize σ 2 can be found and set as the binarization processing threshold value of the image.
[0151] S1102, determining a background region and a target region of the first preprocessed image.
[0152] In the embodiment of the present application, the computer device can perform contour extraction on the first preprocessed image to determine the background region and the target region of the first preprocessed image.
[0153] S1103, determining a character image to be recognized according to the background region and the target region of the first preprocessed image.
[0154] In the embodiments of the present application, the computer device can determine the to-be-recognized character image as the target region according to the background region and the target region of the first preprocessed image.
[0155] Optionally, the to-be-recognized character image can be normalized, that is, the to-be-recognized image is converted according to a certain standard so as to have a consistent size.
[0156] In the above embodiments, the first preprocessed image is obtained by performing the binarization processing on the target image after the grayscale processing, the background region and the target region of the first preprocessed image are determined, and the to-be-recognized character image is determined according to the background region and the target region of the first preprocessed image. The above method can eliminate irrelevant information in the target image, restore useful real information, enhance the detectability of relevant information, and simplify data to the maximum extent. Further, the above method can improve the accuracy of character recognition.
[0157] It should be understood that, although each step in the flowchart involved in the above embodiments is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in the above embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.
[0158] Based on the same inventive concept, the embodiments of the present application also provide a character recognition device for implementing the above-mentioned character recognition method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, and therefore the specific limitations in one or more character recognition device embodiments provided below can refer to the limitations of the character recognition method in the above text, which will not be described here again.
[0159] In one embodiment, a character recognition device is provided, Figure 12 A structural block diagram of a character recognition device provided for the embodiments of the present application is shown in Figure 12 The character recognition device 1200 includes a decomposition module 1201, a first determination module 1202, and an identification module 1203, wherein:
[0160] The decomposition module 1201 is configured to decompose the sub-character images in the to-be-recognized character image to obtain a plurality of sub-bands.
[0161] The first determining module 1202 is configured to determine a first feature vector of the sub-character image according to the decomposition coefficients of the sub-bands.
[0162] The recognition module 1203 is configured to obtain a character recognition result in the to-be-recognized character image according to the first feature vector and a plurality of feature vectors constructed in advance; the feature vector is a vector determined according to the decomposition coefficients of the sub-bands of a standard character image.
[0163] In an embodiment, the determining module 1202 includes:
[0164] The first determining sub-module is configured to determine a first mean value and a first standard deviation of the decomposition coefficients of the sub-bands according to the decomposition coefficients of the sub-bands.
[0165] The second determining sub-module is configured to determine the first feature vector of the sub-character image according to the first mean value and the first standard deviation of the decomposition coefficients of the sub-bands.
[0166] In an embodiment, the second determining sub-module includes:
[0167] The first determining unit is configured to determine an initial feature vector according to the first mean value and the first standard deviation of the decomposition coefficients of the sub-bands.
[0168] The second determining unit is configured to perform normalization processing on the initial feature vector to obtain the first feature vector.
[0169] In an embodiment, the second determining unit is specifically configured to determine a second mean value and a second standard deviation of each element in the initial feature vector; determine a difference value between each element in the initial feature vector and the second mean value; and obtain the first feature vector according to the difference value between each element and the second mean value and the second standard deviation.
[0170] In an embodiment, the recognition module 1203 includes:
[0171] The third determining sub-module is configured to determine distances between the first feature vector and the plurality of feature vectors constructed in advance according to the first feature vector and the plurality of feature vectors.
[0172] The fourth determining sub-module is configured to obtain the character recognition result in the to-be-recognized character image according to the distances between the first feature vector and the plurality of feature vectors.
[0173] In an embodiment, the fourth determining sub-module includes:
[0174] The third determining unit is configured to determine a second feature vector according to the distances between the first feature vector and the plurality of feature vectors; the second feature vector is a feature vector corresponding to a minimum distance.
[0175] The fourth determining unit is configured to obtain a character recognition result in the character image to be recognized according to the second feature vector and the smallest distance.
[0176] In one embodiment, the fourth determining unit comprises:
[0177] The first determining sub-unit is configured to obtain a character in the sub-character image according to the second feature vector if the smallest distance is smaller than the preset threshold.
[0178] The second determining sub-unit is configured to determine a first new sub-character image along a first direction according to position information of the character in the sub-character image and the first preset intercepting distance, and return to execute the step of decomposing the first new sub-character image to obtain a plurality of sub-bands to obtain a character in the first new sub-character image.
[0179] The third determining sub-unit is configured to determine a character recognition result in the character image to be recognized according to the character in the sub-character image and the characters in the first new sub-character images.
[0180] In one embodiment, the fourth determining unit comprises:
[0181] The fourth determining sub-unit is configured to determine a second new sub-character image along a second direction according to the second feature vector and a second preset intercepting distance if the smallest distance is greater than or equal to the preset threshold, and return to execute the step of decomposing the second new sub-character image to obtain a plurality of sub-bands to obtain a character in the second new sub-character image; the second direction is opposite to the first direction.
[0182] The fifth determining sub-unit is configured to determine a first new sub-character image along a first direction according to position information of the character in the second new sub-character image and the first preset intercepting distance, and return to execute the step of decomposing the first new sub-character image to obtain a plurality of sub-bands to obtain a character in the first new sub-character image.
[0183] The sixth determining sub-unit is configured to determine a character recognition result in the character image to be recognized according to the character in the sub-character image and the characters in the first new sub-character images.
[0184] In one embodiment, the character recognition device 1200 further comprises:
[0185] The second determining module is configured to perform a grayscale processing on the target image to obtain a target image processed by the grayscale processing.
[0186] The third determining module is configured to determine a character image to be recognized according to the target image processed by the grayscale processing.
[0187] In one embodiment, the third determining module is specifically configured to perform a binarization processing on the target image after the grayscale processing to obtain a first preprocessed image; determine a background region and a target region of the first preprocessed image; and determine the character image to be recognized according to the background region and the target region of the first preprocessed image.
[0188] The modules in the character recognition apparatus can be implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so as to be invoked and executed by a processor to perform operations corresponding to the modules.
[0189] In one embodiment, a computer device is provided, which can be a server. An internal structure diagram of the computer device can be as shown in FIG. 8. Figure 13 The computer device includes a processor, a memory, and a network interface connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store data. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a character recognition method.
[0190] Those skilled in the art can understand that Figure 13 The structure shown in FIG. 8 is only a block diagram of part of the structure related to the scheme of the present application, and does not limit the computer device to which the scheme of the present application is applied. Specifically, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0191] In one embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program. The processor executes the computer program to implement the following steps:
[0192] performing decomposition on the sub-character image in the character image to be recognized to obtain a plurality of sub-bands;
[0193] determine a first feature vector of the sub-character image according to the decomposition coefficients of the sub-bands;
[0194] obtain a character recognition result in the character image to be recognized according to the first feature vector and a plurality of feature vectors constructed in advance; the feature vector is a vector determined according to the decomposition coefficients of the sub-bands of a standard character image.
[0195] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0196] According to the decomposition coefficients of each subband, a first mean value and a first standard deviation of the decomposition coefficients of each subband are determined;
[0197] According to the first mean value and the first standard deviation of the decomposition coefficients of each subband, a first feature vector of the sub-character image is determined.
[0198] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0199] According to the first mean value and the first standard deviation of the decomposition coefficients of each subband, an initial feature vector is determined;
[0200] The initial feature vector is normalized to obtain the first feature vector.
[0201] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0202] A second mean value and a second standard deviation of each element in the initial feature vector are determined;
[0203] The difference between each element in the initial feature vector and the second mean value is determined;
[0204] According to the difference between each element and the second mean value and the second standard deviation, the first feature vector is obtained.
[0205] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0206] According to the first feature vector and a plurality of feature vectors constructed in advance, a distance between the first feature vector and each feature vector is determined;
[0207] According to the distance between the first feature vector and each feature vector, a character recognition result in the to-be-recognized character image is obtained.
[0208] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0209] According to the distance between the first feature vector and each feature vector, a second feature vector is determined; the second feature vector is a feature vector corresponding to the smallest distance;
[0210] According to the second feature vector and the smallest distance, the character recognition result in the to-be-recognized character image is obtained.
[0211] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0212] If the smallest distance is smaller than a preset threshold, a character in the sub-character image is obtained according to the second feature vector.
[0213] According to the position information of the characters in the sub-character image and the first preset intercepting distance, a first new sub-character image is determined along a first direction, and the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed again to obtain the characters in the first new sub-character image.
[0214] According to the characters in the sub-character image and the characters in each first new sub-character image, a character recognition result in the to-be-recognized character image is determined.
[0215] In an embodiment, when the processor executes the computer program, the following steps are also implemented:
[0216] If the smallest distance is greater than or equal to a preset threshold, a second new sub-character image is determined along a second direction according to the second feature vector and a second preset intercepting distance, and the step of decomposing the second new sub-character image to obtain a plurality of sub-bands is executed again to obtain the characters in the second new sub-character image; the second direction is opposite to the first direction.
[0217] According to the position information of the characters in the sub-character image and the first preset intercepting distance, a first new sub-character image is determined along a first direction, and the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed again to obtain the characters in the first new sub-character image.
[0218] According to the characters in the sub-character image and the characters in each first new sub-character image, a character recognition result in the to-be-recognized character image is determined.
[0219] In an embodiment, when the processor executes the computer program, the following steps are also implemented:
[0220] The target image is subjected to a grayscale processing to obtain a grayscale-processed target image.
[0221] According to the grayscale-processed target image, a to-be-recognized character image is determined.
[0222] In an embodiment, when the processor executes the computer program, the following steps are also implemented:
[0223] The grayscale-processed target image is subjected to a binaryzation processing to obtain a first pre-processed image.
[0224] The background region and the target region of the first pre-processed image are determined.
[0225] According to the background region and the target region of the first pre-processed image, a to-be-recognized character image is determined.
[0226] In an embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the following steps are implemented.
[0227] decomposing the sub-character image in the to-be-recognized character image to obtain a plurality of sub-bands;
[0228] determining a first feature vector of the sub-character image according to the decomposition coefficients of the sub-bands;
[0229] obtaining a character recognition result in the to-be-recognized character image according to the first feature vector and a plurality of feature vectors constructed in advance; the feature vector is a vector determined according to the decomposition coefficients of the sub-bands of a standard character image.
[0230] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0231] determining a first mean value and a first standard deviation of the decomposition coefficients of the sub-bands according to the decomposition coefficients of the sub-bands;
[0232] determining the first feature vector of the sub-character image according to the first mean value and the first standard deviation of the decomposition coefficients of the sub-bands.
[0233] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0234] determining an initial feature vector according to the first mean value and the first standard deviation of the decomposition coefficients of the sub-bands;
[0235] performing normalization processing on the initial feature vector to obtain the first feature vector.
[0236] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0237] determining a second mean value and a second standard deviation of each element in the initial feature vector;
[0238] determining a difference value between each element in the initial feature vector and the second mean value;
[0239] obtaining the first feature vector according to the difference value between each element and the second mean value and the second standard deviation.
[0240] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0241] determining distances between the first feature vector and each feature vector according to the first feature vector and the plurality of feature vectors constructed in advance;
[0242] obtaining the character recognition result in the to-be-recognized character image according to the distances between the first feature vector and each feature vector.
[0243] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0244] According to the distance between the first feature vector and each feature vector, a second feature vector is determined; the second feature vector is a feature vector corresponding to the smallest distance;
[0245] According to the second feature vector and the smallest distance, a character recognition result in the character image to be recognized is obtained.
[0246] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0247] If the smallest distance is smaller than a preset threshold, a character in the sub-character image is obtained according to the second feature vector;
[0248] According to the position information of the character in the sub-character image and the first preset cutting distance, a first new sub-character image is determined along a first direction, and the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed again to obtain a character in the first new sub-character image;
[0249] According to the character in the sub-character image and the characters in the first new sub-character images, a character recognition result in the character image to be recognized is determined.
[0250] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0251] If the smallest distance is smaller than a preset threshold, a character in the sub-character image is obtained according to the second feature vector;
[0252] According to the position information of the character in the sub-character image and the first preset cutting distance, a first new sub-character image is determined along a first direction, and the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed again to obtain a character in the first new sub-character image;
[0253] According to the character in the sub-character image and the characters in the first new sub-character images, a character recognition result in the character image to be recognized is determined.
[0254] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0255] The target image is subjected to a grayscale processing to obtain a grayscale-processed target image;
[0256] According to the grayscale-processed target image, a character image to be recognized is determined.
[0257] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0258] The grayscale-processed target image is subjected to a binaryzation processing to obtain a first pre-processed image;
[0259] determine a background region and a target region of the first pre-processed image;
[0260] determine a character image to be recognized according to the background region and the target region of the first pre-processed image.
[0261] In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the following steps:
[0262] decompose the sub-character image in the character image to be recognized to obtain a plurality of sub-bands;
[0263] determine a first feature vector of the sub-character image according to the decomposition coefficients of the sub-bands;
[0264] obtain a character recognition result in the character image to be recognized according to the first feature vector and a plurality of feature vectors constructed in advance; the feature vector is a vector determined according to the decomposition coefficients of the sub-bands of a standard character image.
[0265] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0266] determine a first mean value and a first standard deviation of the decomposition coefficients of the sub-bands according to the decomposition coefficients of the sub-bands;
[0267] determine the first feature vector of the sub-character image according to the first mean value and the first standard deviation of the decomposition coefficients of the sub-bands.
[0268] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0269] determine an initial feature vector according to the first mean value and the first standard deviation of the decomposition coefficients of the sub-bands;
[0270] normalize the initial feature vector to obtain the first feature vector.
[0271] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0272] determine a second mean value and a second standard deviation of each element in the initial feature vector;
[0273] determine a difference value of each element in the initial feature vector from the second mean value;
[0274] obtain the first feature vector according to the difference value of each element from the second mean value and the second standard deviation.
[0275] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0276] According to the first feature vector and the plurality of feature vectors, distances between the first feature vector and each feature vector are determined;
[0277] According to the distances between the first feature vector and each feature vector, a character recognition result in the to-be-recognized character image is obtained.
[0278] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0279] According to the distances between the first feature vector and each feature vector, a second feature vector is determined; the second feature vector is a feature vector corresponding to the smallest distance;
[0280] According to the second feature vector and the smallest distance, a character recognition result in the to-be-recognized character image is obtained.
[0281] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0282] If the smallest distance is smaller than a preset threshold, a character in the sub-character image is obtained according to the second feature vector;
[0283] According to the position information of the character in the sub-character image and the first preset intercepting distance, a first new sub-character image is determined along a first direction, and the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed again to obtain a character in the first new sub-character image;
[0284] According to the character in the sub-character image and the characters in each first new sub-character image, a character recognition result in the to-be-recognized character image is determined.
[0285] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0286] If the smallest distance is smaller than a preset threshold, a character in the sub-character image is obtained according to the second feature vector;
[0287] According to the position information of the character in the sub-character image and the first preset intercepting distance, a first new sub-character image is determined along a first direction, and the step of decomposing the first new sub-character image to obtain a plurality of sub-bands is executed again to obtain a character in the first new sub-character image;
[0288] According to the character in the sub-character image and the characters in each first new sub-character image, a character recognition result in the to-be-recognized character image is determined.
[0289] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0290] The target image is subjected to a grayscale processing to obtain a grayscale-processed target image;
[0291] According to the target image after the greying processing, a to-be-recognized character image is determined.
[0292] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0293] The target image after the greying processing is binarized to obtain a first pre-processed image;
[0294] A background region and a target region of the first pre-processed image are determined;
[0295] According to the background region and the target region of the first pre-processed image, a to-be-recognized character image is determined.
[0296] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.
[0297] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0298] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application.
[0299] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A character recognition method characterized by, The method includes: A sliding window is used to crop the image of the character to be recognized, thus obtaining a sub-character image from the image of the character to be recognized; The sub-character image is decomposed to obtain multiple sub-bands; The first feature vector of the sub-character image is determined based on the decomposition coefficients of each sub-band; Based on the first feature vector and a plurality of pre-constructed feature vectors, the distance between the first feature vector and each of the feature vectors is determined; the feature vector is a vector determined based on the decomposition coefficients of each sub-band of the standard character image. A second feature vector is determined based on the distance between the first feature vector and each of the other feature vectors; the second feature vector is the feature vector corresponding to the smallest distance. If the minimum distance is less than a preset threshold, then the character in the sub-character image is obtained according to the second feature vector; based on the position information of the character in the sub-character image and the first preset truncation distance, a first new sub-character image is determined along the first direction, and the process of decomposing the first new sub-character image to obtain multiple sub-bands is returned to obtain the character in the first new sub-character image; based on the character in the sub-character image and the character in each of the first new sub-character images, the character recognition result in the character image to be recognized is determined; If the minimum distance is greater than or equal to a preset threshold, then based on the second feature vector and the second preset interception distance, a second new sub-character image is determined along the second direction, and the process returns to the step of decomposing the second new sub-character image to obtain multiple sub-bands, so as to obtain the characters in the second new sub-character image; the second direction is opposite to the first direction; Based on the position information of the characters in the second new sub-character image and the first preset cropping distance, a first new sub-character image is determined along the first direction, and the process of decomposing the first new sub-character image to obtain multiple sub-bands is returned to obtain the characters in the first new sub-character image. Based on the characters in the sub-character images and the characters in each of the first new sub-character images, the character recognition result in the character image to be recognized is determined.
2. The method of claim 1, wherein, Determining the first feature vector of the sub-character image based on the decomposition coefficients of each sub-band includes: Based on the decomposition coefficients of each subband, determine the first mean and first standard deviation of the decomposition coefficients of each subband; The first feature vector of the sub-character image is determined based on the first mean and first standard deviation of the decomposition coefficients of each sub-band.
3. The method of claim 2, wherein, Determining the first feature vector of the sub-character image based on the first mean and first standard deviation of the decomposition coefficients of each sub-band includes: The initial feature vector is determined based on the first mean and the first standard deviation of the decomposition coefficients of each sub-band; The initial feature vector is normalized to obtain the first feature vector.
4. The method of claim 3, wherein, The normalization process for the initial feature vector to obtain the first feature vector includes: Determine the second mean and second standard deviation of each element in the initial feature vector; Determine the difference between each element in the initial feature vector and the second mean; The first feature vector is obtained according to differences between the elements and the second mean value and the second standard deviation.
5. The method of claim 1, wherein, The method further comprises: performing a grayscale processing on the target image to obtain a grayscale-processed target image; determining the to-be-recognized character image according to the grayscale-processed target image.
6. The method of claim 5, wherein, The determining the to-be-recognized character image according to the grayscale-processed target image comprises: performing a binarization processing on the grayscale-processed target image to obtain a first pre-processed image; determining a background region and a target region of the first pre-processed image; determining the to-be-recognized character image according to the background region and the target region of the first pre-processed image.
7. A character recognition apparatus for implementing the character recognition method according to any one of claims 1 to 6, characterized by, The device comprises: a decomposition module configured to decompose a sub-character image in a to-be-recognized character image to obtain a plurality of sub-bands; a first determination module configured to determine a first feature vector of the sub-character image according to decomposition coefficients of the sub-bands; a recognition module configured to obtain a character recognition result in the to-be-recognized character image according to the first feature vector and a plurality of feature vectors pre-constructed; the feature vectors are vectors determined according to decomposition coefficients of sub-bands of standard character images. 8.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-7. The processor executes the computer program to implement the steps of the method in any one of claims 1 to 6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
Citation Information
Patent Citations
User identity recognition method and device based on handwritten signature and terminal equipment
CN110751024A
Image recognition method and device, computer equipment and storage medium
CN111914834A