Graphic verification code recognition method, device, computer equipment and storage medium
By numerical processing and feature matching of the graph verification code, the problem of low recognition efficiency of graph verification code in the prior art is solved, and an efficient recognition process is realized.
Patent Information
- Application Number
- CN202010921075.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-04
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2040-09-04
AI Technical Summary
The existing graphic verification code recognition method requires storing a large number of character pictures in the character library, resulting in large storage space and low recognition efficiency.
By numerical extraction of the input verification code image, a sample library is generated, and character images are divided from the image to be identified according to pixel judgment and numerical rules, numerical processing is performed to obtain character features, and matching the sample library to obtain verification code information.
It greatly reduces the storage space requirements of the sample library and improves the recognition efficiency of graphic verification codes.
Smart Images

Figure CN112035821B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition technology, and belongs to application scenarios related to smart city image recognition, and in particular to a method, device, computer equipment and storage medium for recognizing a graphic verification code. Background Art
[0002] Large enterprises will be involved in testing the program during the program development process. When performing login tests on the program, the corresponding verification code information needs to be entered according to the provided graphic verification code. The verification code characters contained in the graphic verification code can be identified through image recognition technology to obtain the corresponding verification code information. However, the existing graphic verification code recognition method requires a large number of character images to be stored in the character library, and the recognition of the graphic verification code is completed by matching the character images. This recognition method requires a large amount of storage space for the character library, and the image matching process takes a lot of time, which affects the efficiency of recognizing the graphic verification code. Therefore, the existing technical methods have the problem of low recognition efficiency when recognizing the verification image. Summary of the invention
[0003] The embodiments of the present invention provide a method, device, computer equipment and storage medium for recognizing a graphic verification code, aiming to solve the problem of low recognition efficiency when recognizing a verification image in the prior art methods.
[0004] In a first aspect, an embodiment of the present invention provides a method for identifying a graphic verification code, which includes:
[0005] If a verification code image set input by a user is received, all verification code images contained in the verification code image set are numerically extracted according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, wherein the sample library includes multiple verification characters and character template features corresponding to each verification character;
[0006] If an image to be identified is received from a management server, a target pixel corresponding to the image to be identified is determined according to a pixel determination rule in the image processing rule;
[0007] Segmenting the target pixel to obtain a character image containing a single character according to a preset image adjustment rule and the position information of the target pixel;
[0008] Numerizing the character pixels in each of the character images according to the numerization rule in the image processing rule to obtain the character features corresponding to each of the character images;
[0009] Acquire verification code information matching the character feature in the sample library according to a preset matching rule and the character feature, wherein the verification code information includes at least one verification character;
[0010] A combination of the identification information of the image to be identified and the verification code information is fed back to the management server as verification information corresponding to the image to be identified.
[0011] In a second aspect, an embodiment of the present invention provides a graphical verification code recognition device, which includes:
[0012] A sample library construction unit is used for, upon receiving a verification code image set input by a user, performing numerical extraction on all verification code images contained in the verification code image set according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, wherein the sample library includes a plurality of verification characters and a character template feature corresponding to each verification character;
[0013] a target pixel determination unit, configured to determine a target pixel corresponding to the image to be identified according to a pixel determination rule in the image processing rule if an image to be identified is received from the management server;
[0014] A character image acquisition unit, used for segmenting the target pixel to obtain a character image containing a single character according to a preset image adjustment rule and the position information of the target pixel;
[0015] A character feature acquisition unit, configured to digitize the character pixels in each of the character images according to the digitization rule in the image processing rule to obtain a character feature corresponding to each of the character images;
[0016] A verification code information acquisition unit, configured to acquire verification code information matching the character feature in the sample library according to a preset matching rule and the character feature, wherein the verification code information includes at least one verification character;
[0017] The verification information feedback unit is used to feed back the combination of the identification information of the image to be identified and the verification code information to the management server as the verification information corresponding to the image to be identified.
[0018] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the graphic verification code recognition method described in the first aspect when executing the computer program.
[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the graphic verification code recognition method described in the first aspect above.
[0020] The embodiment of the present invention provides a method, device, computer equipment and storage medium for recognizing a graphic verification code. According to the image processing rules, the input verification code image is digitized and extracted to obtain a sample library, the corresponding target pixel is determined from the image to be recognized from the management server, the character image containing a single character is segmented from the target pixel, the character image is digitized to obtain the character feature corresponding to each character image, the verification code information matching the character feature in the sample library is obtained according to the matching rule, and the verification information containing the verification code information is fed back to the management server. Through the above method, a sample library stored in a digitized form can be obtained, and the image to be recognized is recognized based on the obtained sample library to obtain the verification code information. Compared with the use of character pictures for image verification code recognition, the storage space occupied by the sample library can be greatly reduced, and the efficiency of recognizing graphic verification codes can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of a flow chart of a method for recognizing a graphical verification code provided by an embodiment of the present invention;
[0023] Figure 2 A schematic diagram of an application scenario of the method for recognizing a graphic verification code provided by an embodiment of the present invention;
[0024] Figure 3 A diagram showing the effect of using the method for recognizing a graphic verification code provided by an embodiment of the present invention;
[0025] Figure 4 A schematic diagram of a sub-process of a method for recognizing a graphic verification code provided by an embodiment of the present invention;
[0026] Figure 5 A schematic diagram of another sub-process of the method for recognizing a graphic verification code provided by an embodiment of the present invention;
[0027] Figure 6 A schematic diagram of another sub-process of the method for recognizing a graphic verification code provided by an embodiment of the present invention;
[0028] Figure 7 A schematic diagram of another sub-process of the method for recognizing a graphic verification code provided by an embodiment of the present invention;
[0029] Figure 8 A schematic diagram of another sub-process of the method for recognizing a graphic verification code provided by an embodiment of the present invention;
[0030] Fig. 9 A schematic diagram of another sub-process of the method for recognizing a graphic verification code provided by an embodiment of the present invention;
[0031] Fig.10 A schematic block diagram of a graphical verification code recognition device provided by an embodiment of the present invention;
[0032] Fig.11 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0033] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0035] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0036] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0037] See also Figure 1 and Figure 2 , Figure 1 is a flow chart of a method for recognizing a graphic verification code provided by an embodiment of the present invention, Figure 2Schematic diagram of the application scenario of the graphic verification code recognition method provided in an embodiment of the present invention. The graphic verification code recognition method is applied to a user terminal 10. The method is executed by an application software installed in the user terminal 10. The user terminal 10 communicates with at least one management server 20. The user can input a verification code image set into the user terminal 10 and create a sample library. If an image to be recognized is received from any management server 20, the user terminal 10 can recognize the image to be recognized through the sample library to obtain the corresponding verification information containing the verification code information and feed it back to the management server 20, thereby completing the process of recognizing the image to be recognized. The user terminal 10 is a terminal device used to execute the graphic verification code recognition method to recognize the image to be recognized and obtain the verification code information, such as a desktop computer, a laptop computer, a tablet computer or a mobile phone, and the management server 20 is an enterprise terminal that can send the image to be recognized to the user terminal 10. Figure 1 As shown, the method includes steps S110 to S160.
[0038] S110. If a verification code image set input by a user is received, all verification code images contained in the verification code image set are numerically extracted according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, wherein the sample library includes multiple verification characters and character template features corresponding to each verification character.
[0039] If a verification code image set input by a user is received, all verification code images contained in the verification code image set are numerically extracted according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, and the sample library contains multiple verification characters and character template features corresponding to each verification character. Among them, the user is the user of the user terminal, and the user can be a tester in the enterprise who performs login testing on the program. In order to identify the image to be identified from the management server, the user needs to first input the verification code image set to construct a sample library, and accurately identify the image to be identified through the constructed sample library. The image processing rules include pixel judgment rules and numerical rules. The verification code image set contains multiple verification code images and a verification character matching the verification code image. The verification code image is an image containing the verification character. The verification character is a specific character information contained in the image. The verification character can be the character information obtained by manually identifying the image containing the verification character. The verification character can be one or more of uppercase letters, lowercase letters, Arabic numerals and Chinese characters. Specifically, a verification character may include a matching image in the verification code image set, and a verification character may also correspond to multiple images. Different fonts have different ways of writing a verification character.
[0040] For example, there are multiple images corresponding to the verification character "five" and multiple fonts, and each image corresponds to one font. Each image contains image information of "five" written in one font. Then, multiple images corresponding to "five" and multiple different fonts can be added to the verification code image set; increasing the number of images that match the verification character can significantly improve the accuracy of identifying the verification image to be identified.
[0041] The sample library is a library for storing sample information used to identify the verification image to be identified. The sample library contains multiple verification characters and one or more character template features that match each verification character.
[0042] For example, the four images corresponding to the verification character "five" are digitized respectively, and each image can obtain a corresponding character template feature, so four character template features corresponding to "five" can be obtained in the end, that is, the obtained sample library contains four character template features corresponding to the verification character "five".
[0043] According to the pixel judgment rules in the image processing rules, the valid pixels corresponding to each verification code image can be obtained, and the valid image corresponding to the valid pixels can be obtained by cropping according to the position information of the valid pixels. According to the digitization rules, the valid pixels contained in the valid image are digitized to obtain the character template features corresponding to each verification code image. The character template features are the numerical information used to reflect the features of the valid pixels. The character template features are matched and stored to obtain the sample library.
[0044] In one embodiment, if Figure 4 As shown, step S110 includes sub-steps S111, S112 and S113.
[0045] S111 , determining valid pixels corresponding to each verification code image in the verification code image set according to image information and pixel judgment rules of each verification code image.
[0046] The valid pixels corresponding to each verification code image in the verification code image set are determined according to the image information and pixel judgment rules of each verification code image. The pixel judgment rules include grayscale rules and grayscale thresholds. The verification code image contains a number of pixels, each pixel contains a corresponding pixel value in the image, and the pixel value corresponding to the pixel is the image information corresponding to the image. The pixel judgment rule is the rule information for judging the pixel value of each pixel. The valid pixels corresponding to the image can be determined according to the pixel values of the pixels contained in the verification code image and the pixel judgment rule. Specifically, if the verification code image is a color image, each pixel in the color image corresponds to a pixel value in the three color channels of red (R), green (G), and blue (B) corresponding to RGB; if the verification code image is a grayscale image, each pixel in the grayscale image corresponds to a pixel value in the black color channel. The pixel values are all represented by non-negative integers, and their value range is [0, 255]. Taking the black color channel as an example, if the pixel value of a pixel is 0, it means that the color of the pixel is black. If the pixel value of a pixel is 255, it means that the color of the pixel is white. If the pixel value is other values, it means that the color of the pixel is a specific grayscale between white and black.
[0047] In one embodiment, if Figure 5 As shown, step S111 includes sub-steps S1111, S1112 and S1113.
[0048] S1111. Grayscale each verification code image according to the grayscale rule to obtain a grayscale image matching each verification code image; S1112. Determine whether the grayscale value of the pixels contained in the grayscale image is greater than the grayscale threshold to obtain pixels whose grayscale value is not greater than the grayscale threshold; S1113. Determine whether each pixel whose grayscale value is not greater than the grayscale threshold is isolated to remove the isolated pixels from the pixels whose grayscale value is not greater than the grayscale threshold to obtain the valid pixels.
[0049] If the verification code image is not a grayscale image, the image can be grayscaled using the grayscale rule to obtain a corresponding grayscale image. The grayscale rule can convert the pixel value corresponding to RGB of each pixel point into a pixel value corresponding to the black color channel. If the verification code image is a grayscale image, grayscale processing is not required. Figure 3 The effect diagram of the method for recognizing a graphic verification code provided by an embodiment of the present invention is shown in FIG. Figure 3-(a). Determine whether the pixel value of each pixel in the grayscale image is greater than the grayscale threshold, and obtain all pixels that are not greater than the grayscale threshold. For example, if the grayscale threshold is 80, the pixel value of each pixel can be judged to obtain pixels whose pixel values are not greater than 80; since the effective information that can be identified from the image is a pixel block formed by connecting multiple pixels, the pixel block formed by connecting multiple pixels in the image can be used as a valid pixel. Specifically, it is determined whether each pixel that is not greater than the grayscale threshold is isolated, that is, whether each pixel is connected to other pixels whose pixel values are not greater than the grayscale threshold. If they are connected, the judgment result is that the pixel is not isolated; if they are not connected, the judgment result is that the pixel is isolated. The isolated pixels can be eliminated to obtain valid pixels. The image corresponding to the obtained valid pixels is shown as follows. Figure 3 -(b) as shown.
[0050] S112: Extracting a valid image including the valid pixels according to the position information of the valid pixels in each of the images.
[0051] According to the position information of the effective pixels in each of the images, an effective image containing the effective pixels is extracted. Specifically, the coordinate value of each effective pixel in the image is the position information of the effective pixel. According to the position information of the effective pixel, an effective image containing the effective pixel can be extracted from the image. The obtained effective image is as follows: Figure 3 -(c) as shown.
[0052] In one embodiment, step S112 includes sub-steps: determining a rectangular boundary of a valid pixel according to position information of the valid pixel in the image; extracting a corresponding rectangular image from the valid pixel according to the rectangular boundary; and binarizing the rectangular image to obtain a valid image containing only black and white.
[0053] A rectangular boundary corresponding to the effective pixels is determined according to the position information of the effective pixels in the image. The rectangular boundary is a rectangular frame determined according to the coordinate values of the outermost effective pixels among the effective pixels. A rectangular image is extracted from the effective pixels according to the rectangular boundary. The rectangular image contains all the effective pixels. The rectangular image is binarized, all the effective pixels are changed to black, and other pixels in the rectangular image are changed to white, that is, the obtained effective image contains only two colors, black and white.
[0054] S113, digitizing each of the valid images according to the digitization rule to obtain character template features corresponding to each of the verification code images.
[0055] Each of the valid images is digitized according to the digitization rule to obtain the character template features corresponding to each of the verification code images. The digitization rule is the rule information for digitizing the valid image. After the valid image is digitized, the character template features corresponding to the valid image can be obtained. The character template features are feature information that quantitatively represents the features of the verification code image through numerical values. The character template features include a size array and a coordinate array. The size array is used to represent the size of the valid image, and the coordinate array can be used to represent the coordinate value of each valid pixel in the valid image.
[0056] In one embodiment, if Figure 6 As shown, step S113 includes sub-steps S1131, S1132 and S1133.
[0057] S1131. Obtain the size information of a valid image, and generate a size array corresponding to the size information according to the digitization rule; S1132. Obtain the coordinate information of all valid pixels in the valid image, and generate a coordinate array corresponding to each valid pixel according to the digitization rule and the coordinate information; S1133. Use the size array and all the coordinate arrays as character template features of a verification code image corresponding to the valid image.
[0058] For example, the size information of a valid image is: 25 pixels long and 15 pixels wide, then the size array corresponding to the valid image is {25, 15}; if a valid pixel in the valid image is located in the 3rd row and 7th column, then the coordinate array corresponding to the valid pixel is {3, 7}.
[0059] S120: If an image to be identified is received from a management server, a target pixel corresponding to the image to be identified is determined according to a pixel determination rule in the image processing rule.
[0060] If an image to be identified is received from the management server, the target pixel corresponding to the image to be identified is determined according to the pixel judgment rule in the image processing rule. When a user logs in to a web page or mailbox through a user terminal, the management server will send the image to be identified to the user terminal. The image to be identified is a graphic verification code to be identified. The graphic verification code consists of one or more verification code characters. The pixels in the image to be identified can be judged and the corresponding target pixels can be obtained according to the pixel judgment rule in the image processing rule. The pixel judgment rule includes a grayscale rule and a grayscale threshold.
[0061] In one embodiment, step S120 includes sub-steps: graying the image to be identified according to the graying rule to obtain a gray image to be identified that matches the image to be identified; judging whether the gray value of the pixels contained in the gray image to be identified is greater than the gray threshold to obtain pixels whose gray value is greater than the gray threshold; judging whether each pixel whose gray value is greater than the gray threshold is isolated to remove the isolated pixels from the pixels whose gray value is greater than the gray threshold to obtain the target pixel. Specifically, the method of obtaining the corresponding target pixel from the image to be identified is the same as the method of obtaining the corresponding valid pixel from the verification code image, which will not be described in detail here.
[0062] S130 , segmenting the target pixel to obtain a character image containing a single character according to a preset image adjustment rule and the position information of the target pixel.
[0063] According to the preset image adjustment rules and the position information of the target pixels, a character image containing a single character is segmented from the target pixels. Specifically, according to the position information of each pixel in the target pixels, a segmented image containing a single character can be segmented from the target pixels, and the segmented image can be adjusted according to the image adjustment rules to obtain a character image containing only a single character, that is, according to the number of characters contained in the target pixels, a plurality of character images equal to the number of characters can be obtained.
[0064] In one embodiment, if Figure 7 As shown, step S130 includes sub-steps S131, S132 and S133.
[0065] S131. Acquire a pixel block formed by connecting a plurality of pixels in the target pixel according to the position information of each pixel in the target pixel; each of the pixel blocks includes a character.
[0066] A pixel block formed by connecting multiple pixels in the target pixel is obtained according to the position information of each pixel in the target pixel; each of the pixel blocks contains a character. Since a single character is a pixel block formed by connecting multiple pixels, a pixel block with multiple pixels connected is used as a pixel block corresponding to a character according to the position information of the target pixel.
[0067] S132 , extracting a segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel.
[0068] A segmented image corresponding to each pixel block is extracted based on the position of the pixel block in the target pixel. Specifically, a rectangular boundary corresponding to a certain pixel block can be determined based on the position of the pixel block in the target pixel. The rectangular boundary is a rectangular frame determined based on the coordinate values of the outermost pixels in the pixel block. A segmented image corresponding to the pixel block is extracted from the target pixel based on the rectangular boundary.
[0069] S133: Adjust the segmented images according to the image adjustment rule to obtain a character image corresponding to each segmented image.
[0070] The segmented images are adjusted according to the image adjustment rules to obtain character images corresponding to each of the segmented images. Specifically, the segmented images can be adjusted according to feature information such as the size of the segmented images to obtain character images corresponding to each of the segmented images. Specifically, the image adjustment rules include one or more of enlargement, reduction, cropping and rotation, and the adjusted character images are images that meet the image adjustment rules.
[0071] S140 , digitizing the character pixels in each of the character images according to the digitization rule in the image processing rule to obtain character features corresponding to each of the character images.
[0072] According to the digitization rule in the image processing rule, the character pixels in each of the character images are digitized to obtain the character features corresponding to each of the character images. According to the digitization rule, that is, the rule information for digitizing the character pixels contained in the character image, after digitizing a character image, the character features corresponding to the character image can be obtained. The character features are the feature information that quantitatively represents the features of the character image through numerical values. The character features also include a size array and a coordinate array. The size array is used to represent the size of the character image, and the coordinate array can be used to represent the coordinate value of each character pixel in the character image.
[0073] In one embodiment, step S140 includes sub-steps: obtaining size information of a character image, and generating a size array corresponding to the size information according to the digitization rule; obtaining coordinate information of all character pixels in the character image, and generating a coordinate array corresponding to each character pixel according to the digitization rule and the coordinate information; and using the size array and all the coordinate arrays as character features corresponding to the character image.
[0074] The method of obtaining the corresponding character features from the character image is the same as the method of obtaining the corresponding character template features from the valid image, which will not be described in detail here.
[0075] S150: Acquire verification code information matching the character feature in the sample library according to a preset matching rule and the character feature, wherein the verification code information includes at least one verification character.
[0076] According to the preset matching rules and the character features, the verification code information matching the character features in the sample library is obtained, and the verification code information includes at least one verification character. Specifically, the number of character images included in the image to be recognized is equal to the number of verification characters in the verification code information, and each character image corresponds to a character feature. According to the matching rules, a verification character corresponding to each character feature in the sample library can be obtained, and the verification code information corresponding to the image to be recognized can be obtained by combining the obtained verification characters.
[0077] In one embodiment, if Figure 8 As shown, step S150 includes sub-steps S151 and S152.
[0078] S151. Acquire a verification character corresponding to each of the character features in the sample library according to the matching rule.
[0079] According to the matching rule, a verification character corresponding to each character feature in the sample library is obtained. The matching rule includes a size threshold, a pixel density calculation formula and a density threshold. The size threshold is the threshold information used to determine whether the size ratio of the character feature matches the size ratio of the character template feature. The size ratio can be calculated according to the numerical value in the size array. If the difference between the size ratio of the character feature and the size ratio of the character template feature is not greater than the size threshold, the two match, otherwise the two do not match; the pixel density calculation formula is a calculation formula used to obtain the character feature or the character template feature to calculate and obtain the corresponding pixel density. If the pixel density corresponding to the character feature is large, it indicates that the character image corresponding to the character feature contains more character pixels per unit area, otherwise it indicates that the character image corresponding to the character feature contains fewer character pixels per unit area; the density threshold is the threshold information used to determine whether the pixel density of the character feature matches the pixel density of the character template feature. If the difference between the pixel density of the character feature and the pixel density of the character template feature is not greater than the density threshold, the two match, otherwise the two do not match.
[0080] According to the above method, the character template features that meet the conditions are screened to form a second feature set corresponding to a character feature, the matching degree between each character template feature in the second feature set and the character feature is calculated, and a character template feature with the highest matching degree with the character feature is screened, and a verification character of the character template feature is further obtained as the verification character of the character feature. According to the above method, a verification character corresponding to each character feature can be obtained.
[0081] In one embodiment, if Fig. 9 As shown, step S151 includes sub-steps S1511, S1512, S1513 and S1514.
[0082] S1511. Acquire, according to the size threshold, character template features in the sample library whose size ratio matches the size ratio of one of the character features to obtain a first feature set.
[0083] For example, the size array of a character feature is {25, 15}, the size array of a character template feature in the sample library is {20, 10}, and the size threshold is 0.3; the size ratio of the character feature is 1.6667, and the size ratio of the character template feature is 2. The difference between the two size ratios is 0.3333, which is greater than the size threshold. In this case, the character template feature does not match the character feature.
[0084] S1512. Calculate the first pixel density of the character feature and the second pixel density of each character template feature in the first feature set according to the pixel density calculation formula.
[0085] The calculation of pixel density is explained by taking character features as an example. The number of coordinate arrays contained in the character feature is obtained and divided by the product of the values in the size array to obtain the pixel density of the character feature. The pixel density calculation formula can be expressed as:
[0086] M = N / (C1 × C2) (1);
[0087] Among them, M is the pixel density of the character feature, N is the number of coordinate arrays in the character feature, C1 is the first value of the size array in the character feature, and C2 is the second value of the size array in the character feature.
[0088] If the size array of a character feature is {25, 15}, and the number of coordinate arrays in the component feature is 60, then the corresponding pixel density M = 60 / (25×15) = 0.16. The method for calculating the pixel density of the character template feature is the same as the above method.
[0089] S1513. Determine whether the difference between the first pixel density and each of the second pixel densities is less than the density threshold, so as to obtain character template features whose differences are less than the density threshold as the second feature set.
[0090] S1514. Calculate the degree of match between the character feature and each character template feature in the second feature set, and obtain a verification character corresponding to a character template feature with the highest degree of match in the second feature set as the verification character corresponding to the character feature.
[0091] Specifically, the value of each coordinate array in the character feature is divided by the size array of the character feature to obtain a vector array corresponding to each coordinate array. For example, if the size array of a character feature is {25, 15}, and a coordinate array is {3, 7}, then a vector array corresponding to the coordinate array is calculated to be {3 / 25, 7 / 15}, that is, {0.12, 0.4667}. In the same way, the vector array of each character template feature in the second feature set is obtained, and the number of arrays that overlap between the vector array of a character template feature and the vector array of the character feature is obtained. The calculation result obtained by dividing the number of overlapping arrays by the vector array of the character feature is used as the matching degree between the character template feature and the character feature. The matching degree between each character template feature in the second feature set and the character feature is calculated according to the above method, and the verification character corresponding to the character template feature with the highest matching degree is obtained as the verification character corresponding to the character feature.
[0092] S152: Combine the verification characters according to the order of the character features to obtain verification code information corresponding to the character features.
[0093] The verification characters are combined according to the order of the character features to obtain verification code information corresponding to the character features. The character images obtained after segmenting the image to be recognized have a certain order, and the order of the character images is the same as the order of the character features, that is, a verification character corresponding to each character feature is combined according to the order of the character features to obtain verification code information consisting of multiple verification characters arranged in a predetermined order.
[0094] For example, the verification code information obtained after recognizing a certain image to be recognized is "T4bP".
[0095] S160: Feedback a combination of the identification information of the image to be identified and the verification code information to the management server as verification information corresponding to the image to be identified.
[0096] The combination of the identification information of the image to be identified and the verification code information is fed back to the management server as the verification information corresponding to the image to be identified. The image to be identified also includes an identification information corresponding to the image to be identified, and the identification information can uniquely identify each image to be identified. The user terminal can combine the identification information corresponding to the image to be identified and the obtained verification code information to obtain the corresponding verification information and feed it back to the management server. After receiving the verification information, the management server can obtain the target verification code that matches the identification information in the verification information, so as to verify the verification code information in the verification information according to the target verification code.
[0097] The technical method in this application can be applied to application scenarios including smart government affairs / smart urban management / smart communities / smart security / smart logistics / smart medical care / smart education / smart environmental protection / smart transportation, etc., which include graphic verification code recognition, thereby promoting the construction of smart cities.
[0098] In the method for recognizing a graphic verification code provided in an embodiment of the present invention, the input verification code image is digitized and extracted according to the image processing rules to obtain a sample library, the corresponding target pixel is determined from the image to be recognized from the management server, the character image containing a single character is segmented from the target pixel, the character image is digitized to obtain the character feature corresponding to each character image, the verification code information matching the character feature in the sample library is obtained according to the matching rule, and the verification information containing the verification code information is fed back to the management server. Through the above method, a sample library stored in a digitized form can be obtained, and the image to be recognized is recognized based on the obtained sample library to obtain the verification code information. Compared with the use of character pictures for image verification code recognition, the storage space required for the sample library can be greatly reduced, and the efficiency of recognizing graphic verification codes can be improved.
[0099] The embodiment of the present invention further provides a graphic verification code recognition device, which is used to execute any embodiment of the above-mentioned graphic verification code recognition method. Fig.10 , Fig.10 The figure is a schematic block diagram of a graphic verification code recognition device provided by an embodiment of the present invention. The graphic verification code recognition device can be configured in a user terminal.
[0100] like Fig.10 As shown, the graphic verification code recognition device 100 includes a sample library construction unit 110 , a target pixel determination unit 120 , a character image acquisition unit 130 , a character feature acquisition unit 140 , a verification code information acquisition unit 150 and a verification information feedback unit 160 .
[0101] The sample library construction unit 110 is used to, upon receiving a verification code image set input by a user, perform numerical extraction on all verification code images contained in the verification code image set according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, wherein the sample library includes multiple verification characters and character template features corresponding to each verification character.
[0102] In one embodiment, the sample library construction unit 110 includes a sub-unit effective pixel determination unit, an effective image acquisition unit, and a digitization processing unit.
[0103] An effective pixel determination unit is used to determine the effective pixels corresponding to each verification code image in the verification code image set according to the image information and pixel judgment rules of each verification code image; an effective image acquisition unit is used to extract the effective image containing the effective pixels according to the position information of the effective pixels in each of the images; a digitization processing unit is used to digitize each of the effective images according to the digitization rules to obtain the character template features corresponding to each of the verification code images.
[0104] In one embodiment, the effective pixel determination unit includes subunits: a grayscale image acquisition unit, a grayscale value determination unit, and a pixel elimination unit.
[0105] A grayscale image acquisition unit is used to grayscale each of the verification code images according to the grayscale rule to obtain a grayscale image matching each of the verification code images; a grayscale value judgment unit is used to judge whether the grayscale value of the pixels contained in the grayscale image is greater than the grayscale threshold value to obtain pixels whose grayscale value is not greater than the grayscale threshold value; a pixel elimination unit is used to judge whether each pixel whose grayscale value is not greater than the grayscale threshold value is isolated, so as to eliminate the isolated pixels from the pixels whose grayscale value is not greater than the grayscale threshold value to obtain the valid pixels.
[0106] In one embodiment, the effective image acquisition unit includes subunits: a rectangular boundary determination unit, a rectangular image extraction unit, and a binarization processing unit.
[0107] A rectangular boundary determination unit is used to determine the rectangular boundary of the effective pixels according to the position information of the effective pixels in the image; a rectangular image extraction unit is used to extract the corresponding rectangular image from the effective pixels according to the rectangular boundary; and a binarization processing unit is used to binarize the rectangular image to obtain a valid image containing only black and white.
[0108] In one embodiment, the digitization processing unit includes subunits: a size array generating unit, a coordinate array generating unit and a character template feature acquiring unit.
[0109] A size array generating unit is used to obtain the size information of a valid image, and generate a size array corresponding to the size information according to the digitization rule; a coordinate array generating unit is used to obtain the coordinate information of all valid pixels in the valid image, and generate a coordinate array corresponding to each valid pixel according to the digitization rule and the coordinate information; a character template feature acquiring unit is used to use the size array and all the coordinate arrays as character template features of a verification code image corresponding to the valid image.
[0110] The target pixel determination unit 120 is used to determine the target pixel corresponding to the image to be identified according to the pixel determination rule in the image processing rule when receiving the image to be identified from the management server.
[0111] The character image acquisition unit 130 is used to segment the target pixel to obtain a character image containing a single character according to a preset image adjustment rule and the position information of the target pixel.
[0112] In one embodiment, the character image acquisition unit 130 includes sub-units: a pixel block acquisition unit, a segmented image acquisition unit, and an image adjustment unit.
[0113] A pixel block acquisition unit is used to acquire a pixel block formed by connecting multiple pixels in the target pixel according to the position information of each pixel in the target pixel; each of the pixel blocks contains a character; a segmented image acquisition unit is used to extract and obtain a segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel; and an image adjustment unit is used to adjust the segmented image according to the image adjustment rule to obtain a character image corresponding to each segmented image.
[0114] The character feature acquisition unit 140 is used to digitize the character pixels in each of the character images according to the digitization rule in the image processing rule to obtain the character feature corresponding to each of the character images.
[0115] The verification code information acquisition unit 150 is used to acquire the verification code information matching the character feature in the sample library according to the preset matching rule and the character feature, wherein the verification code information includes at least one verification character.
[0116] In one embodiment, the verification code information obtaining unit 150 includes subunits: a verification character matching unit and a verification character combining unit.
[0117] The verification character matching unit is used to obtain a verification character corresponding to each character feature in the sample library according to the matching rule; the verification character combining unit is used to combine the verification characters according to the order of the character features to obtain verification code information corresponding to the character features.
[0118] In one embodiment, the verification character matching unit includes subunits: a first feature set acquisition unit, a pixel density acquisition unit, a second feature set acquisition unit, and a verification character determination unit.
[0119] The first feature set acquisition unit is used to acquire the character template features whose size ratios in the sample library match the size ratios of one of the character features according to the size threshold to obtain the first feature set; the pixel density acquisition unit is used to calculate the first pixel density of the character feature and the second pixel density of each character template feature in the first feature set according to the pixel density calculation formula; the second feature set acquisition unit is used to determine whether the difference between the first pixel density and each of the second pixel densities is less than the density threshold, so as to acquire the character template features whose differences are less than the density threshold as the second feature set; the verification character determination unit is used to calculate the matching degree between the character feature and each character template feature in the second feature set, and acquire the verification character corresponding to the character template feature with the highest matching degree in the second feature set as the verification character corresponding to the character feature.
[0120] The verification information feedback unit 160 is configured to feed back a combination of the identification information of the image to be identified and the verification code information to the management server as verification information corresponding to the image to be identified.
[0121] The graphic verification code recognition device provided in the embodiment of the present invention applies the above-mentioned graphic verification code recognition method, extracts the input verification code image digitally according to the image processing rules to obtain a sample library, determines the corresponding target pixel from the image to be recognized from the management server, segments the character image containing a single character from the target pixel, digitalizes the character image to obtain the character feature corresponding to each character image, obtains the verification code information matching the character feature in the sample library according to the matching rule, and feeds back the verification information containing the verification code information to the management server. Through the above-mentioned method, a sample library stored in a digital form can be obtained, and the image to be recognized is recognized based on the obtained sample library to obtain the verification code information. Compared with the use of character pictures for image verification code recognition, the storage space required for the sample library can be greatly reduced, and the efficiency of recognizing graphic verification codes can be improved.
[0122] The above-mentioned graphic verification code recognition device can be implemented in the form of a computer program, and the computer program can be Fig.11Runs on the computer device shown.
[0123] See also Fig.11 , Fig.11 It is a schematic block diagram of a computer device provided by an embodiment of the present invention.
[0124] See also Fig.11 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0125] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute a method for recognizing a graphic verification code.
[0126] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0127] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute the graphic verification code recognition method.
[0128] The network interface 505 is used for network communication, such as providing data information transmission, etc. Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device 500 to which the solution of the present invention is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0129] The processor 502 is used to run a computer program 5032 stored in the memory to implement the following functions: if a verification code image set input by a user is received, all verification code images contained in the verification code image set are numerically extracted according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, and the sample library contains multiple verification characters and character template features corresponding to each verification character; if an image to be recognized is received from a management server, a target pixel corresponding to the image to be recognized is determined according to a pixel judgment rule in the image processing rule; a character image containing a single character is obtained by segmenting the target pixel according to a preset image adjustment rule and position information of the target pixel; character pixels in each of the character images are numerically converted according to a numerical conversion rule in the image processing rule to obtain character features corresponding to each of the character images; verification code information matching the character features in the sample library is obtained according to a preset matching rule and the character features, and the verification code information contains at least one of the verification characters; a combination of the identification information of the image to be recognized and the verification code information is fed back to the management server as verification information corresponding to the image to be recognized.
[0130] In one embodiment, when the processor 502 receives a verification code image set input by a user and performs the step of digitizing all verification code images contained in the verification code image set according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, the processor 502 performs the following operations: determining the valid pixels corresponding to each verification code image in the verification code image set according to the image information and pixel judgment rule of each verification code image; extracting the valid image containing the valid pixels according to the position information of the valid pixels in each of the images; and digitizing each of the valid images according to the digitization rule to obtain the character template features corresponding to each of the verification code images.
[0131] In one embodiment, when the processor 502 executes the step of determining the valid pixels corresponding to each verification code image in the verification code image set according to the image information and pixel judgment rule of each verification code image, the processor 502 performs the following operations: graying each verification code image according to the graying rule to obtain a grayscale image matching each verification code image; judging whether the grayscale value of the pixels included in the grayscale image is greater than the grayscale threshold to obtain pixels whose grayscale value is not greater than the grayscale threshold; judging whether each pixel whose grayscale value is not greater than the grayscale threshold is isolated to remove the isolated pixels from the pixels whose grayscale value is not greater than the grayscale threshold to obtain the valid pixels.
[0132] In one embodiment, when the processor 502 executes the step of digitizing each of the valid images according to the digitization rule to obtain a character template feature corresponding to each of the verification code images, the processor 502 performs the following operations: obtaining size information of one of the valid images, and generating a size array corresponding to the size information according to the digitization rule; obtaining coordinate information of all valid pixels in the valid image, and generating a coordinate array corresponding to each of the valid pixels according to the digitization rule and the coordinate information; and using the size array and all the coordinate arrays as character template features of a verification code image corresponding to the valid image.
[0133] In one embodiment, when the processor 502 executes the step of segmenting the target pixel according to a preset image adjustment rule and the position information of the target pixel to obtain a character image containing a single character, the processor 502 performs the following operations: obtaining a pixel block formed by connecting multiple pixels in the target pixel according to the position information of each pixel in the target pixel; each of the pixel blocks contains a character; extracting a segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel; and adjusting the segmented image according to the image adjustment rule to obtain a character image corresponding to each segmented image.
[0134] In one embodiment, when the processor 502 executes the step of obtaining the verification code information matching the character feature in the sample library according to the preset matching rule and the character feature, the processor 502 performs the following operations: obtaining a verification character corresponding to each of the character features in the sample library according to the matching rule; and combining the verification characters according to the order of the character features to obtain the verification code information corresponding to the character features.
[0135] In one embodiment, when the processor 502 executes the step of obtaining a verification character corresponding to each of the character features in the sample library according to the matching rule, the processor 502 performs the following operations: obtaining a character template feature whose size ratio in the sample library matches the size ratio of one of the character features according to the size threshold to obtain a first feature set; calculating the first pixel density of the character feature and the second pixel density of each character template feature in the first feature set according to the pixel density calculation formula; determining whether the difference between the first pixel density and each of the second pixel densities is less than the density threshold to obtain a character template feature whose difference is less than the density threshold as a second feature set; calculating the degree of match between the character feature and each of the character template features in the second feature set, and obtaining a verification character corresponding to a character template feature with the highest degree of match in the second feature set as the verification character corresponding to the character feature.
[0136] Those skilled in the art will understand that Fig.11 The embodiments of the computer device shown in the figure do not constitute a limitation on the specific composition of the computer device. In other embodiments, the computer device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, in some embodiments, the computer device may only include a memory and a processor. In such embodiments, the structure and function of the memory and the processor are the same as those of the embodiment of the present invention. Fig.11 The embodiments shown are consistent and will not be described again here.
[0137] It should be understood that in the embodiment of the present invention, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0138] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein the computer program implements the following steps when executed by a processor: if a verification code image set input by a user is received, all verification code images contained in the verification code image set are numerically extracted according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, wherein the sample library contains multiple verification characters and character template features corresponding to each verification character; if an image to be recognized is received from a management server, a target pixel corresponding to the image to be recognized is determined according to a pixel judgment rule in the image processing rule; a character image containing a single character is obtained by segmenting the target pixel according to a preset image adjustment rule and position information of the target pixel; character pixels in each of the character images are numerically converted according to a numerical conversion rule in the image processing rule to obtain character features corresponding to each of the character images; verification code information matching the character features in the sample library is obtained according to a preset matching rule and the character features, wherein the verification code information contains at least one of the verification characters; and a combination of the identification information of the image to be recognized and the verification code information is fed back to the management server as verification information corresponding to the image to be recognized.
[0139] In one embodiment, if a verification code image set input by a user is received, the step of digitizing and extracting all verification code images contained in the verification code image set according to a preset image processing rule to obtain a sample library corresponding to the verification code image set includes: determining the valid pixels corresponding to each verification code image in the verification code image set according to the image information and pixel judgment rule of each verification code image; extracting the valid image containing the valid pixels according to the position information of the valid pixels in each of the images; and digitizing each of the valid images according to the digitization rule to obtain the character template features corresponding to each of the verification code images.
[0140] In one embodiment, the step of determining valid pixels corresponding to each verification code image in the verification code image set according to the image information and pixel judgment rule of each verification code image includes: graying each verification code image according to the graying rule to obtain a grayscale image matching each verification code image; judging whether the grayscale value of the pixels included in the grayscale image is greater than the grayscale threshold to obtain pixels whose grayscale value is not greater than the grayscale threshold; judging whether each pixel whose grayscale value is not greater than the grayscale threshold is isolated to remove the isolated pixels from the pixels whose grayscale value is not greater than the grayscale threshold to obtain the valid pixels.
[0141] In one embodiment, the step of digitizing each of the valid images according to the digitization rule to obtain a character template feature corresponding to each of the verification code images includes: obtaining size information of one of the valid images, and generating a size array corresponding to the size information according to the digitization rule; obtaining coordinate information of all valid pixels in the valid image, and generating a coordinate array corresponding to each of the valid pixels according to the digitization rule and the coordinate information; and using the size array and all the coordinate arrays as character template features of a verification code image corresponding to the valid image.
[0142] In one embodiment, the step of segmenting the target pixel to obtain a character image containing a single character according to a preset image adjustment rule and the position information of the target pixel includes: obtaining a pixel block formed by connecting multiple pixels in the target pixel according to the position information of each pixel in the target pixel; each of the pixel blocks contains a character; extracting a segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel; and adjusting the segmented image according to the image adjustment rule to obtain a character image corresponding to each segmented image.
[0143] In one embodiment, the step of obtaining verification code information matching the character feature in the sample library according to a preset matching rule and the character feature includes: obtaining a verification character corresponding to each character feature in the sample library according to the matching rule; and combining the verification characters according to the order of the character features to obtain verification code information corresponding to the character features.
[0144] In one embodiment, the step of obtaining a verification character corresponding to each of the character features in the sample library according to the matching rule includes: obtaining a character template feature whose size ratio matches the size ratio of a character feature in the sample library according to the size threshold to obtain a first feature set; calculating the first pixel density of the character feature and the second pixel density of each character template feature in the first feature set according to the pixel density calculation formula; determining whether the difference between the first pixel density and each of the second pixel densities is less than the density threshold to obtain a character template feature whose difference is less than the density threshold as a second feature set; calculating the degree of match between the character feature and each character template feature in the second feature set, and obtaining a verification character corresponding to a character template feature with the highest degree of match in the second feature set as the verification character corresponding to the character feature.
[0145] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment, devices and units can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0146] In the several embodiments provided by the present invention, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. For example, 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. Units with the same function may also be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.
[0147] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0148] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0149] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a computer-readable storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned computer-readable storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a magnetic disk or an optical disk.
[0150] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for recognizing a graphic verification code, characterized in that: include: If a verification code image set input by a user is received, all verification code images contained in the verification code image set are numerically extracted according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, wherein the sample library includes multiple verification characters and character template features corresponding to each verification character; If an image to be identified is received from a management server, a target pixel corresponding to the image to be identified is determined according to a pixel determination rule in the image processing rule; Segmenting the target pixel to obtain a character image containing a single character according to a preset image adjustment rule and the position information of the target pixel; Numerizing the character pixels in each of the character images according to the numerization rule in the image processing rule to obtain the character features corresponding to each of the character images; Acquire verification code information matching the character feature in the sample library according to a preset matching rule and the character feature, wherein the verification code information includes at least one verification character; Feeding back to the management server a combination of the identification information of the image to be identified and the verification code information as verification information corresponding to the image to be identified; The image processing rules include pixel judgment rules and digitization rules. The digitization extraction of all verification code images included in the verification code image set according to the preset image processing rules to obtain a sample library corresponding to the verification code image set includes: Determine the valid pixels corresponding to each verification code image in the verification code image set according to the image information and pixel judgment rule of each verification code image; Extracting a valid image including the valid pixels according to the position information of the valid pixels in each of the images; Numerize each of the valid images according to the numerization rule to obtain a character template feature corresponding to each of the verification code images; the character template feature includes a size array and a coordinate array of the valid image; The step of digitizing each of the valid images according to the digitization rule to obtain a character template feature corresponding to each of the verification code images includes: Acquire size information of a valid image, and generate a size array corresponding to the size information according to the numerical rule; Acquire the coordinate information of all valid pixels in the valid image, and generate a coordinate array corresponding to each valid pixel according to the digitization rule and the coordinate information; Using the size array and all the coordinate arrays as character template features of a verification code image corresponding to the valid image; The pixel determination rule includes a grayscale rule and a grayscale threshold, and determining the valid pixels corresponding to each verification code image in the verification code image set according to the image information and the pixel determination rule includes: Graying each verification code image according to the graying rule to obtain a gray image matching each verification code image; Determining whether the grayscale values of pixels contained in the grayscale image are greater than the grayscale threshold value to obtain pixels whose grayscale values are not greater than the grayscale threshold value; Determining whether each pixel whose grayscale value is not greater than the grayscale threshold is isolated, so as to remove the isolated pixels from the pixels whose grayscale value is not greater than the grayscale threshold to obtain the valid pixels, including: determining whether each pixel is connected to other pixels whose pixel values are not greater than the grayscale threshold, if connected, determining that the pixel is not isolated; if not connected, determining that the pixel is isolated, and removing the isolated pixels to obtain the valid pixels; The extracting of the effective image containing the effective pixels according to the position information of the effective pixels in each of the images comprises: determining the rectangular boundary of the effective pixels according to the position information of the effective pixels in one of the images; extracting the corresponding rectangular image from the effective pixels according to the rectangular boundary; binarizing the rectangular image to obtain an effective image containing only black and white; The obtaining verification code information matching the character feature in the sample library according to the preset matching rule and the character feature includes: Acquire a verification character corresponding to each of the character features in the sample library according to the matching rule; Combining the verification characters according to the order of the character features to obtain verification code information corresponding to the character features; The matching rule includes a size threshold, a pixel density calculation formula and a density threshold. The step of obtaining a verification character corresponding to each character feature in the sample library according to the matching rule includes: According to the size threshold, character template features whose size ratios in the sample library match the size ratios of one of the character features are acquired to obtain a first feature set; Calculate the first pixel density of the character feature and the second pixel density of each character template feature in the first feature set according to the pixel density calculation formula; Determine whether the difference between the first pixel density and each of the second pixel densities is less than the density threshold, so as to obtain character template features whose differences are less than the density threshold as a second feature set; Calculating the degree of match between the character feature and each character template feature in the second feature set, and obtaining a verification character corresponding to a character template feature with the highest degree of match in the second feature set as the verification character corresponding to the character feature; The matching degree calculation process includes: dividing the coordinate arrays in the character feature by the size array of the character feature to calculate the vector array corresponding to each coordinate array, and dividing the coordinate arrays in the character template feature by the size array of the character template feature to calculate the vector array corresponding to each coordinate array; obtaining the number of arrays that overlap with the vector array of the character feature, dividing the number of overlapping arrays by the number of vector arrays of the character feature, and obtaining the matching degree between the character feature and the character template feature.
2. The method for recognizing a graphic verification code according to claim 1, characterized in that: The step of segmenting the target pixel according to the preset image adjustment rule and the position information of the target pixel to obtain a character image containing a single character includes: According to the position information of each pixel in the target pixel, a pixel block formed by connecting a plurality of pixels in the target pixel is obtained; each of the pixel blocks contains a character; Extracting a segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel; The segmented images are adjusted according to the image adjustment rule to obtain character images corresponding to each segmented image.
3. A graphic verification code recognition device, characterized in that: include: A sample library construction unit is used for, upon receiving a verification code image set input by a user, performing numerical extraction on all verification code images contained in the verification code image set according to a preset image processing rule to obtain a sample library corresponding to the verification code image set, wherein the sample library includes a plurality of verification characters and a character template feature corresponding to each verification character; a target pixel determination unit, configured to determine a target pixel corresponding to the image to be identified according to a pixel determination rule in the image processing rule if an image to be identified is received from the management server; A character image acquisition unit, used for segmenting the target pixel to obtain a character image containing a single character according to a preset image adjustment rule and the position information of the target pixel; A character feature acquisition unit, configured to digitize the character pixels in each of the character images according to the digitization rule in the image processing rule to obtain a character feature corresponding to each of the character images; A verification code information acquisition unit, configured to acquire verification code information matching the character feature in the sample library according to a preset matching rule and the character feature, wherein the verification code information includes at least one verification character; a verification information feedback unit, configured to feed back a combination of the identification information of the image to be identified and the verification code information as verification information corresponding to the image to be identified to the management server; The image processing rules include pixel judgment rules and digitization rules; the sample library construction unit includes: an effective pixel determination unit, used to determine the effective pixels corresponding to each verification code image in the verification code image set according to the image information and pixel judgment rules of each verification code image; an effective image acquisition unit, used to extract the effective image containing the effective pixels according to the position information of the effective pixels in each of the images; a digitization processing unit, used to digitize each of the effective images according to the digitization rules to obtain the character template features corresponding to each of the verification code images; the character template features include the size array and coordinate array of the effective image; The step of digitizing each of the valid images according to the digitization rule to obtain a character template feature corresponding to each of the verification code images includes: Acquire size information of a valid image, and generate a size array corresponding to the size information according to the numerical rule; Acquire the coordinate information of all valid pixels in the valid image, and generate a coordinate array corresponding to each valid pixel according to the digitization rule and the coordinate information; Using the size array and all the coordinate arrays as character template features of a verification code image corresponding to the valid image; The pixel judgment rule includes a grayscale rule and a grayscale threshold, and the valid pixel determination unit includes subunits: a grayscale image acquisition unit, used to grayscale each of the verification code images according to the grayscale rule to obtain a grayscale image matching each of the verification code images; a grayscale value judgment unit, used to judge whether the grayscale value of the pixels contained in the grayscale image is greater than the grayscale threshold, so as to obtain pixels whose grayscale value is not greater than the grayscale threshold; a pixel elimination unit, used to judge whether each pixel whose grayscale value is not greater than the grayscale threshold is isolated, so as to eliminate the isolated pixels from the pixels whose grayscale value is not greater than the grayscale threshold to obtain the valid pixels, including: judging whether each pixel is connected to other pixels whose pixel value is not greater than the grayscale threshold, if connected, the judgment result is that the pixel is not isolated; if not connected, the judgment result is that the pixel is isolated, and the isolated pixels are eliminated to obtain the valid pixels; The effective image acquisition unit includes subunits: a rectangular boundary determination unit, used to determine the rectangular boundary of the effective pixel according to the position information of the effective pixel in the image; a rectangular image extraction unit, used to extract the corresponding rectangular image from the effective pixel according to the rectangular boundary; a binarization processing unit, used to binarize the rectangular image to obtain an effective image containing only black and white; The obtaining verification code information matching the character feature in the sample library according to the preset matching rule and the character feature includes: Acquire a verification character corresponding to each of the character features in the sample library according to the matching rule; Combining the verification characters according to the order of the character features to obtain verification code information corresponding to the character features; The matching rule includes a size threshold, a pixel density calculation formula and a density threshold. The step of obtaining a verification character corresponding to each character feature in the sample library according to the matching rule includes: According to the size threshold, character template features whose size ratios in the sample library match the size ratios of one of the character features are acquired to obtain a first feature set; Calculate the first pixel density of the character feature and the second pixel density of each character template feature in the first feature set according to the pixel density calculation formula; Determine whether the difference between the first pixel density and each of the second pixel densities is less than the density threshold, so as to obtain character template features whose differences are less than the density threshold as a second feature set; Calculating the degree of match between the character feature and each character template feature in the second feature set, and obtaining a verification character corresponding to a character template feature with the highest degree of match in the second feature set as the verification character corresponding to the character feature; The matching degree calculation process includes: calculating the vector array corresponding to each coordinate array in the character feature according to the size array in the character feature, and calculating the vector array corresponding to each coordinate array in the character template feature according to the size array in the character template feature; obtaining the number of arrays of the vector arrays of each character template feature that overlap with the vector array of the character feature, dividing the number of overlapping arrays by the number of vector arrays of the character feature, and obtaining the matching degree between the character feature and the character template feature.
4. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the graphic verification code recognition method according to any one of claims 1 to 2 is implemented.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the graphic verification code recognition method according to any one of claims 1 to 2.
