WO2021159802A1 - Graphical captcha recognition method, apparatus, computer device, and storage medium - Google Patents

Graphical captcha recognition method, apparatus, computer device, and storage medium Download PDF

Info

Publication number
WO2021159802A1
WO2021159802A1 PCT/CN2020/131758 CN2020131758W WO2021159802A1 WO 2021159802 A1 WO2021159802 A1 WO 2021159802A1 CN 2020131758 W CN2020131758 W CN 2020131758W WO 2021159802 A1 WO2021159802 A1 WO 2021159802A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
character
verification code
pixel
rule
Prior art date
Application number
PCT/CN2020/131758
Other languages
French (fr)
Chinese (zh)
Inventor
崔利伟
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021159802A1 publication Critical patent/WO2021159802A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/36User authentication by graphic or iconic representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Definitions

  • This application relates to the field of image recognition technology, 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.
  • the embodiments of the present application provide a method, device, computer equipment and storage medium for recognizing a graphic verification code, aiming to solve the problem of low recognition efficiency that exists when recognizing a verification image in the prior art method.
  • an embodiment of the present application provides a method for identifying a graphic verification code, which includes:
  • the sample library contains multiple verification characters and character template features corresponding to each verification character
  • 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 verification information corresponding to the image to be identified.
  • an embodiment of the present application provides a graphic verification code recognition device, which includes:
  • the sample library construction unit is used to, if the verification code image set input by the user is received, numerically extract all the verification code images contained in the verification code image set according to the preset image processing rules to obtain the verification code image set
  • the sample library includes a plurality of verification characters and character template characteristics corresponding to each verification character
  • the target pixel determining unit is configured to, if an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel determination rule in the image processing rule;
  • a character image acquisition unit configured 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;
  • a character feature acquiring unit configured to digitize the character pixels in each character image according to the digitization rule in the image processing rule to obtain the character feature corresponding to each character image;
  • the verification code information acquiring unit is configured to acquire verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature, and the verification code information includes at least one verification character ;
  • the verification information feedback unit is configured to feed back the 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.
  • an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the computer
  • the program implements the pattern verification code recognition method described in the first aspect.
  • an embodiment of the present application also 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 above-mentioned first On the one hand, the graphic verification code recognition method.
  • the embodiments of the present application provide a method, device, computer equipment, and storage medium for identifying a graphic verification code.
  • the input verification code image is numerically extracted to obtain a sample library
  • the corresponding target pixel is determined from the image to be recognized from the management server
  • the target pixel is segmented to obtain a character image containing a single character.
  • Numericalization is performed 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
  • the verification information including the verification code information is fed back to the management server.
  • FIG. 1 is a schematic flowchart of a method for identifying a graphic verification code provided by an embodiment of the application
  • FIG. 2 is a schematic diagram of an application scenario of a method for identifying a graphic verification code provided by an embodiment of the application
  • FIG. 3 is a diagram showing the use effect of the graphic verification code recognition method provided by the embodiment of the application.
  • FIG. 4 is a schematic diagram of a sub-process of a method for identifying a graphic verification code provided by an embodiment of the application
  • FIG. 5 is a schematic diagram of another sub-flow of the method for identifying a graphic verification code according to an embodiment of the application
  • FIG. 6 is a schematic diagram of another sub-process of the method for identifying a graphic verification code provided by an embodiment of the application.
  • FIG. 7 is a schematic diagram of another sub-process of the method for identifying a graphic verification code provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of another sub-process of the method for identifying a graphic verification code provided by an embodiment of the application.
  • FIG. 9 is a schematic diagram of another sub-flow of the method for identifying a graphic verification code provided by an embodiment of the application.
  • FIG. 10 is a schematic block diagram of a graphic verification code recognition device provided by an embodiment of the application.
  • FIG. 11 is a schematic block diagram of a computer device provided by an embodiment of the application.
  • FIG. 1 is a schematic flowchart of a method for identifying a graphic verification code provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of an application scenario of the method for recognizing a graphic verification code provided by an embodiment of the present application.
  • the graphic verification code recognition method is applied to the user terminal 10.
  • the method is executed by application software installed in the user terminal 10.
  • the user terminal 10 communicates with at least one management server 20, and the user can input the verification code image set into the user
  • the terminal 10 creates a sample library.
  • the user terminal 10 can identify the image to be identified through the sample library to obtain the corresponding verification information containing the verification code information and feed it back to The management server 20 can complete the process of recognizing the image to be recognized.
  • the user terminal 10 is a terminal device that is used to perform a graphic verification code recognition method to identify the image to be recognized and obtain verification code information, such as a desktop computer, a notebook computer, a tablet computer, or a mobile phone, etc., and the management server 20 can send the image to be recognized Enterprise terminal to user terminal 10. As shown in Fig. 1, the method includes steps S110 to S160.
  • the sample library includes multiple verification characters and character template features corresponding to each verification character.
  • the verification code image set input by the user is received, all the verification code images contained in the verification code image set are numerically extracted according to the preset image processing rules to obtain a sample library corresponding to the verification code image set.
  • the sample library contains multiple verification characters and character template features corresponding to each verification character.
  • the user is the user of the user terminal, and the user can be a tester who performs a login test on the program in the enterprise.
  • the user In order to recognize the image to be recognized from the management server, the user needs to input the verification code image set to build the sample library. And accurately recognize the image to be recognized through the constructed sample library.
  • the image processing rules include pixel judgment rules and digitization 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 verification characters.
  • the verification character is a specific character information contained in the image.
  • the verification character can be the character information obtained by manually recognizing the image containing the verification character.
  • the verification character can be uppercase letters, lowercase letters, Arabic numerals, and One or more of Chinese characters.
  • a verification character may include a matching image in the verification code image set, and a verification character may also correspond to multiple images, and various fonts have different ways of writing a verification character.
  • each image corresponds to one font, and each image contains image information obtained by writing "Five” in one font.
  • Multiple images corresponding to "Five” and multiple different fonts can be added to the verification code image collection; increasing the number of images matching the verification characters can significantly improve the accuracy of the recognition of the verification image to be recognized.
  • the sample library is to store sample information used to identify the verification image to be recognized.
  • the sample library contains multiple verification characters and one or more character template features that match each verification character.
  • the four images corresponding to the verification character "five" are respectively digitized, and each image can get a corresponding character template feature, and finally four character template features corresponding to "five” can be obtained , That is, the obtained sample library contains four character template features corresponding to the verification character "five".
  • the effective pixels corresponding to each verification code image can be obtained, and the effective pixels corresponding to the effective pixels can be cropped according to the position information of the effective pixels.
  • the pixel is digitized to obtain the character template feature corresponding to each verification code image.
  • the character template feature is the numerical information used to reflect the effective pixel feature, and the character template feature is corresponded and stored to obtain the sample library.
  • step S110 includes sub-steps S111, S112, and S113.
  • S111 Determine effective pixels corresponding to each image according to the image information of each verification code image in the verification code image set and the pixel determination rule.
  • the pixel judgment rules include grayscale rules and grayscale thresholds.
  • the verification code image contains several pixels, and each pixel contains a corresponding pixel value in the image, and the pixel value corresponding to the pixel corresponds to the image Image information.
  • the pixel judgment rule is the rule information for judging the pixel value of each pixel. According to the pixel value of the pixel contained in the verification code image and the pixel judgment rule, the effective pixel corresponding to the image can be determined.
  • each pixel in the color image corresponds to a pixel value on the three color channels of red (R), green (G), and blue (B) corresponding to RGB; if The verification code image is a grayscale image, and each pixel in the grayscale image corresponds to a pixel value on the color channel of black.
  • the pixel value is represented by a non-negative integer, and its value range is [0,255] Take the color channel of black as an example. If the pixel value of a certain pixel is 0, it means that the color of the pixel is black. If the pixel value of a certain pixel is 255, it means that the color of the pixel is white, and the pixel value is other The value indicates that the color of the pixel is a specific gray scale between white and black.
  • step S111 includes sub-steps S1111, S1112, and S1113.
  • S1111 grayscale each verification code image according to the grayscale rules to obtain a grayscale image matching each verification code image; S1112, perform grayscale image processing on the pixels contained in the grayscale image Determine whether the gray value of is greater than the gray threshold to obtain pixels whose gray value is not greater than the gray threshold; S1113, determine whether each pixel with the gray value not greater than the gray threshold is isolated , To remove isolated pixels from the pixels whose gray value is not greater than the gray threshold value to obtain the effective pixel.
  • Fig. 3 is an effect diagram of the graphic verification code recognition method provided by an embodiment of the application, and the gray image obtained after gray-scale processing is shown in Fig. 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.
  • the grayscale threshold is 80
  • the image corresponding to the obtained effective pixel is shown in Figure 3-(b).
  • S112 Extract an effective image including the effective pixel according to the position information of the effective pixel in each of the images.
  • the effective image including the effective pixel is extracted according to the position information of the effective pixel in each of the images. Specifically, the coordinate value of each effective pixel in the image in the image is the position information of the effective pixel. According to the position information of the effective pixel, the effective image containing the effective pixel can be extracted from the image.
  • the obtained effective image is as As shown in Figure 3-(c).
  • step S112 includes the sub-steps: determining the rectangular boundary of the effective pixel according to the position information of the effective pixel in one of the images; extracting the corresponding rectangular image from the effective pixels according to the rectangular boundary; The rectangular image is binarized to obtain an effective image containing only black and white.
  • the rectangular boundary is a rectangular frame determined according to the coordinate value of the outermost effective pixel in the effective pixel, and the rectangle is extracted from the effective pixel according to the rectangular boundary.
  • Image the rectangular image contains all effective pixels, the rectangular image is binarized, all effective pixels are changed to black, and other pixels in the rectangular image are changed to white, that is, the resulting effective image contains only black and Two colors of white.
  • S113 Perform digitization on each of the effective images according to the digitization rule to obtain character template characteristics corresponding to each of the verification code images.
  • the digitization rule it is the rule information for digitizing the valid image.
  • the character template feature corresponding to the valid image can be obtained.
  • the character template feature is the feature of the verification code image through the numerical value.
  • Quantitatively expressed feature information the character template feature includes a size array and a coordinate array. The size array is used to represent the size of the effective image, and the coordinate array can be used to represent the coordinate value of each effective pixel in the effective image.
  • step S113 includes sub-steps S1131, S1132, and S1133.
  • S1131 Obtain the size information of a piece of the effective image, and generate a size array corresponding to the size information according to the digitization rule; S1132, obtain the coordinate information of all effective pixels in the effective image, and according to the digitization The rule and the coordinate information generate a coordinate array corresponding to each of the effective pixels; S1133. Use the size array and all the coordinate arrays as character template features of a verification code image corresponding to the effective image.
  • the size array corresponding to the effective image is ⁇ 25, 15 ⁇ ; a valid pixel in the effective image is located in the third row and the seventh column , Then the coordinate array corresponding to the effective pixel is ⁇ 3, 7 ⁇ .
  • S120 If an image to be recognized from the management server is received, determine a target pixel corresponding to the image to be recognized according to the pixel determination rule in the image processing rule.
  • the target pixel corresponding to the image to be recognized is determined according to the pixel determination rule in the image processing rule.
  • the management server will send the image to be recognized to the user terminal.
  • the image to be recognized is the graphic verification code that needs to be recognized.
  • the graphic verification code consists of one or more verification code characters.
  • the pixel judgment rule in the image processing rule the pixel in the image to be recognized is judged and the corresponding target pixel is obtained.
  • the pixel judgment rule includes the gray scale rule and the gray threshold.
  • step S120 includes the sub-steps: grayscale the image to be recognized according to the grayscale rule to obtain a grayscale image to be recognized that matches the image to be recognized; Identify whether the gray value of the pixels contained in the grayscale image is greater than the gray threshold value to determine to obtain pixels with gray value greater than the gray threshold value; for each pixel whose gray value is greater than the gray threshold value Whether or not to be isolated is determined, so as to remove isolated pixels from the pixels whose grayscale value is greater than the grayscale threshold to obtain the target pixel.
  • the method of obtaining the corresponding target pixel from the image to be recognized is the same as the method of obtaining the corresponding effective pixel from the verification code image, and will not be further described here.
  • a character image containing a single character is obtained by segmenting the target pixel. Specifically, according to the position information of each pixel in the target pixel, a segmented image containing a single character can be segmented from the target pixel, 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 pixel, multiple character images with the same number of characters can be obtained.
  • step S130 includes sub-steps S131, S132, and S133.
  • a pixel block formed by connecting a plurality of pixels in the target pixel is obtained according to the position information of each pixel in the target pixel; each of the pixel blocks includes a character. Since a single character is a pixel block formed by connecting multiple pixels, according to the position information of the target pixel, a pixel block connected with multiple pixels is used as a pixel block corresponding to a character.
  • S132 Extract a segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel.
  • a rectangular boundary corresponding to the pixel block can be determined according to the position of a certain pixel block in the target pixel, and the rectangular boundary is determined according to the coordinate value of the outermost pixel in the pixel block According to the rectangle boundary, extract a segmented image corresponding to the pixel block from the target pixel.
  • the segmented image is adjusted according to the image adjustment rule to obtain a character image corresponding to each segmented image.
  • the segmented images can be adjusted according to the feature information such as the size of the segmented images to obtain a character image corresponding to each segmented image.
  • the image adjustment rules include one of enlargement, reduction, cropping, and rotation.
  • the adjusted character image is an image that meets the image adjustment rules.
  • S140 Perform digitization on the character pixels in each of the character images according to the digitization rules in the image processing rules to obtain character features corresponding to each of the character images.
  • the character pixels in each of the character images are digitized according to the digitization rules in the image processing rules to obtain character features corresponding to each of the character images.
  • the digitization rule it is the rule information for digitizing the character pixels contained in the character image.
  • the character feature corresponding to the character image can be obtained.
  • the character feature is the numerical value of the character
  • the feature information that is quantified by the feature of the image.
  • the character feature also includes 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.
  • step S140 includes sub-steps: obtaining size information of a piece of the character image, generating a size array corresponding to the size information according to the digitization rule; obtaining the size of all character pixels in the character image For coordinate information, a coordinate array corresponding to each character pixel is generated according to the digitization rule and the coordinate information; the size array and all the coordinate arrays are used as character features corresponding to the character image.
  • the method of obtaining the corresponding character feature from the character image is the same as the method of obtaining the corresponding character template feature from the valid image, and will not be explained here.
  • Acquire verification code information matching the character feature in the sample library according to a preset matching rule and the character feature includes at least one verification character.
  • the number of character images contained 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.
  • the sample library corresponding to each character feature can be obtained according to the matching rules.
  • the verification code information corresponding to the image to be recognized can be obtained by combining the obtained verification characters.
  • step S150 includes sub-steps S151 and S152.
  • the matching rule includes a size threshold, a pixel density calculation formula, and a density threshold.
  • the size threshold is 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 based on 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 used to obtain The character feature or character template feature is calculated to obtain the calculation formula of the corresponding pixel density.
  • 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 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.
  • the qualified character template feature combination is obtained as a second feature set corresponding to a character feature, and the matching degree between each character template feature in the second feature set and the character feature is calculated, and a matching character is obtained by screening.
  • the character template feature with the highest feature matching degree, and the verification character of the character template feature is further obtained as the verification character of the character feature.
  • a verification character corresponding to each character feature can be obtained.
  • step S151 includes sub-steps S1511, S1512, S1513, and S1514.
  • 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 ⁇
  • the size threshold is 0.3
  • the size ratio of the character feature is 1.6667
  • the character The size ratio of the template feature is 2, and the difference between the two size ratios is 0.3333, which is greater than the size threshold, then the character template feature does not match the character feature.
  • Calculating the pixel density takes a character feature as an example.
  • the number of coordinate arrays included 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:
  • M is the pixel density of the character feature
  • N is the number of coordinate arrays in the character feature
  • C 1 is the first value of the size array in the character feature
  • C 2 is the second value of the size array in the character feature .
  • the method of calculating the pixel density of the character template feature is the same as the above method.
  • each coordinate array in the character feature is divided by the size array of the character feature to obtain the vector array corresponding to each coordinate array.
  • the size array of a certain character feature is ⁇ 25, 15 ⁇ , where If a certain coordinate array is ⁇ 3, 7 ⁇ , a vector array corresponding to the coordinate array is calculated to be ⁇ 3/25, 7/15 ⁇ , that is, ⁇ 0.12, 0.4667 ⁇ .
  • each character template feature in the second feature set obtains the number of arrays where the vector array of a character template feature coincides with the vector array of the character feature, and divide the number of coincident arrays by the character feature's vector array
  • the calculation result obtained by the vector array 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, 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.
  • the verification characters are combined according to the sequence of the character features to obtain verification code information corresponding to the character features.
  • the character image obtained after segmentation of the image to be recognized has a certain sequence, and the sequence of the character image is the same as the sequence of the character features, and a verification character corresponding to each character feature can be combined according to the sequence of the character features , In order to obtain the verification code information consisting of multiple verification characters arranged in a predetermined order.
  • the verification code information obtained after recognizing a certain image to be recognized is "T4bP".
  • 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 verification information corresponding to the image to be identified.
  • the image to be identified also contains an identification information corresponding to the image to be identified.
  • the identification information can uniquely identify each image to be identified.
  • the user terminal can perform identification information corresponding to the image to be identified and the obtained verification code information. Combination to obtain the corresponding verification information and feed it back to the management server.
  • the management server can obtain the target verification code matching the identification information in the verification information, so as to obtain the verification information in the verification information according to the target verification code. Verification code information is verified.
  • the technical methods in this application can be applied to application scenarios that include graphic verification code recognition, such as smart government/smart city management/smart community/smart security/smart logistics/smart healthcare/smart education/smart environmental protection/smart transportation, so as to promote smart cities Construction.
  • graphic verification code recognition such as smart government/smart city management/smart community/smart security/smart logistics/smart healthcare/smart education/smart environmental protection/smart transportation, so as to promote smart cities Construction.
  • the input verification code image is numerically extracted according to the image processing rules to obtain a sample library, and the corresponding target pixel is determined from the image to be recognized from the management server, and from The target pixel is segmented to obtain a character image containing a single character, the character image is digitized to obtain the character feature corresponding to each character image, and the verification code information matching the character feature in the sample library is obtained according to the matching rule, which will contain the verification code
  • the verification information of the information is fed back to the management server.
  • the embodiment of the present application also provides a graphic verification code recognition device, which is used to execute any embodiment of the foregoing graphic verification code recognition method.
  • FIG. 10 is a schematic block diagram of a graphic verification code recognition apparatus provided by an embodiment of the present application.
  • the graphic verification code recognition device can be configured in the user terminal.
  • 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.
  • the sample library construction unit 110 is configured to, if the verification code image set input by the user is received, digitally extract all the verification code images contained in the verification code image set according to a preset image processing rule to obtain a verification code image
  • a sample library corresponding to the set, the sample library includes a plurality of verification characters and a character template feature corresponding to each verification character.
  • the sample library construction unit 110 includes a sub-unit effective pixel determination unit, an effective image acquisition unit, and a numerical processing unit.
  • the effective pixel determination unit is used to determine the effective pixel corresponding to each image according to the image information of each verification code image in the verification code image set and the pixel judgment rule;
  • the effective image acquisition unit is used to determine the effective pixel corresponding to each image according to the The position information of the effective pixels in the image extracts the effective image including the effective pixels;
  • the digitization processing unit is configured to digitize each of the effective images according to the digitization rule to obtain the verification code image Corresponding character template characteristics.
  • the effective pixel determination unit includes sub-units: a gray image acquisition unit, a gray value judgment unit, and a pixel removal unit.
  • a gray-scale image acquisition unit configured to gray-scale each verification code image according to the gray-scale rule to obtain a gray-scale image matching each verification code image; a gray-scale value judgment unit, It is used to judge whether the gray value of the pixels contained in the gray image is greater than the gray threshold value, so as to obtain the pixels whose gray value is not greater than the gray threshold value; Whether each pixel whose gray value is not greater than the gray threshold is judged in isolation, so as to remove isolated pixels from the pixels whose gray value is not greater than the gray threshold to obtain the effective pixel.
  • the effective image acquisition unit includes sub-units: a rectangular boundary determination unit, a rectangular image extraction unit, and a binarization processing unit.
  • a rectangular boundary determining unit configured to determine a rectangular boundary of the effective pixel according to the position information of an effective pixel in the image
  • a rectangular image extracting unit configured to extract a corresponding rectangular image from the effective pixel according to the rectangular boundary
  • the binarization processing unit is configured to binarize the rectangular image to obtain an effective image containing only black and white.
  • the numerical processing unit includes sub-units: a size array generating unit, a coordinate array generating unit, and a character template feature acquiring unit.
  • the size array generation unit is used to obtain the size information of the valid image, and the size array corresponding to the size information is generated according to the digitization rule; the coordinate array generation unit is used to obtain all the valid images in the effective image.
  • the coordinate information of the pixel generates a coordinate array corresponding to each effective pixel according to the digitization rule and the coordinate information; the character template feature acquisition unit is used to take the size array and all the coordinate arrays as the AND The character template feature of a verification code image corresponding to the effective image.
  • the target pixel determining unit 120 is configured to, if an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel determination rule in the image processing rule.
  • the character image acquisition unit 130 is configured 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.
  • the character image acquisition unit 130 includes sub-units: a pixel block acquisition unit, a segmented image acquisition unit, and an image adjustment unit.
  • the pixel block obtaining unit is configured to obtain, 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; each of the pixel blocks includes a character
  • the segmented image acquisition unit is used to extract the segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel; the image adjustment unit is used to adjust the image according to the image adjustment rule
  • the segmented images are adjusted to obtain a character image corresponding to each of the segmented images.
  • the character feature acquiring unit 140 is configured to digitize the character pixels in each character image according to the digitization rule in the image processing rule to obtain the character feature corresponding to each character image.
  • the verification code information obtaining unit 150 is configured to obtain verification code information matching the character feature in the sample library according to the preset matching rules and the character feature, and the verification code information includes at least one of the verification code information. character.
  • the verification code information acquiring unit 150 includes sub-units: a verification character matching unit and a verification character combination unit.
  • 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 combination unit is used to compare the verification character according to the sequence of the character features The combination is performed to obtain the verification code information corresponding to the character feature.
  • 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.
  • the first feature set obtaining unit is configured to obtain, according to the size threshold, the character template feature whose size ratio matches the size ratio of one of the character features in the sample library to obtain the first feature set;
  • the pixel density obtaining unit uses The first pixel density of the character feature and the second pixel density of each character template feature in the first feature set are calculated according to the pixel density calculation formula;
  • the second feature set acquisition unit is used to determine the first Whether the difference between the pixel density and each of the second pixel densities is less than the density threshold, so as to obtain the character template features whose difference is less than the density threshold as the second feature set;
  • the verification character determination unit uses To calculate the matching degree between the character feature and each character template feature in the second feature set, obtain the verification character corresponding to the character template feature with the highest matching degree in the second feature set as the character feature Corresponding to the verification character.
  • the verification information feedback unit 160 is configured to feed back the 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 graphic verification code recognition method is applied to numerically extract the input verification code image according to the image processing rules to obtain a sample library, which is determined from the to-be-recognized image from the management server
  • the corresponding target pixel is segmented from the target pixel to obtain a character image containing a single character
  • the character image is digitized to obtain the character feature corresponding to each character image
  • the verification code matching the character feature in the sample library is obtained according to the matching rule Information
  • the verification information containing the verification code information is fed back to the management server.
  • a sample library that is stored in a numerical form can be obtained, and based on the obtained sample library, the image to be recognized is recognized to obtain the verification code information.
  • the sample library can be greatly reduced Need to occupy the storage space, and improve the efficiency of identifying the graphic verification code.
  • the above-mentioned graphic verification code recognition device can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in FIG. 11.
  • FIG. 11 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
  • the non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032.
  • the processor 502 can execute the graphic verification code identification method.
  • the processor 502 is used to provide calculation and control capabilities, and support the operation of the entire computer device 500.
  • the internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503.
  • the processor 502 can execute the graphic verification code identification method.
  • the network interface 505 is used for network communication, such as providing data information transmission.
  • the structure shown in FIG. 11 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied.
  • the specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
  • the processor 502 is configured to run a computer program 5032 stored in the memory, so as to implement the corresponding function in the above-mentioned graphic verification code identification method.
  • the embodiment of the computer device shown in FIG. 11 does not constitute a limitation on the specific configuration of the computer device.
  • the computer device may include more or less components than those shown in the figure. Or some parts are combined, or different parts are arranged.
  • the computer device may only include a memory and a processor. In such an embodiment, the structures and functions of the memory and the processor are consistent with the embodiment shown in FIG. 11, and will not be repeated here.
  • the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor.
  • a computer-readable storage medium may be a non-volatile computer-readable storage medium, or may be a volatile computer-readable storage medium.
  • the computer-readable storage medium stores a computer program, where the computer program implements the steps included in the above-mentioned graphic verification code recognition method when the computer program is executed by the processor.
  • the disclosed equipment, device, and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods, or the units with the same function may be combined into one. Units, for example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments of the present application.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. 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.
  • the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product can be stored in a computer.
  • the read storage medium includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned computer-readable storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

A graphical CAPTCHA recognition method and apparatus, a computer device, and a storage medium, comprising: performing, according to an image processing rule, numerical extraction on input verification code images to obtain a sample library; determining target pixels in an image to be recognized originating from a management server; separating among the target pixels to obtain character images comprising a single character and digitizing said character images to obtain character features corresponding to each character image; acquiring from the sample library, according to matching rules, verification code information matching the character features, and feeding back to the management server verification information comprising verification code information. On the basis of image recognition technology and relating to the field of artificial intelligence, a sample library using digitization for storage is obtained. Performing recognition on images to be recognized on the basis of the sample library to obtain verification code information, compared to using a character picture to perform image verification code recognition, greatly reduces the storage space occupied by the sample library while improving the recognition efficiency of images to be recognized.

Description

图形验证码识别方法、装置、计算机设备及存储介质Graphic verification code identification method, device, computer equipment and storage medium
本申请要求于2020年09月04日提交中国专利局、申请号为202010921075.9,发明名称为“图形验证码识别方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on September 4, 2020, the application number is 202010921075.9, and the invention title is "graphic verification code identification method, device, computer equipment, and storage medium". The entire content is approved The reference is incorporated in this application.
技术领域Technical field
本申请涉及图像识别技术领域,涉及智慧城市图像识别相关的应用场景,尤其涉及一种图形验证码识别方法、装置、计算机设备及存储介质。This application relates to the field of image recognition technology, 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 technique
大型企业在程序开发过程中会涉及对程序进行测试,在对程序进行登录测试等环节需根据所提供的图形验证码输入对应的验证码信息,可通过图像识别技术对图形验证码中所包含的验证码字符进行识别以获取对应的验证码信息。然而发明人发现,现有的图形验证码识别方法需在字符库内存储大量的字符图片,并通过字符图片匹配的方式完成对图形验证码的识别,这一识别方法导致字符库需大量的存储空间,且图片匹配的过程中需耗费大量时间,影响了对图形验证码进行识别的效率。因此,现有的技术方法中对验证图像进行识别时存在识别效率不高的问题。Large enterprises will involve testing the program in the process of program development. In the process of logging in and testing the program, you need to enter the corresponding verification code information according to the provided graphic verification code. Image recognition technology can be used to verify the information contained in the graphic verification code. The verification code characters are recognized to obtain the corresponding verification code information. However, the inventor found that the existing graphic verification code recognition method needs to store a large number of character pictures in the character library, and complete the recognition of the graphic verification code through character image matching. This recognition method causes the character library to require a large amount of storage Space, and the process of image matching takes a lot of time, which affects the efficiency of identifying the image verification code. Therefore, there is a problem that the recognition efficiency is not high when recognizing the verification image in the existing technical method.
发明内容Summary of the invention
本申请实施例提供了一种图形验证码识别方法、装置、计算机设备及存储介质,旨在解决现有技术方法对验证图像进行识别时所存在的识别效率不高的问题。The embodiments of the present application provide a method, device, computer equipment and storage medium for recognizing a graphic verification code, aiming to solve the problem of low recognition efficiency that exists when recognizing a verification image in the prior art method.
第一方面,本申请实施例提供了一种图形验证码识别方法,其包括:In the first aspect, an embodiment of the present application provides a method for identifying a graphic verification code, which includes:
若接收到用户所输入的验证码图像集,根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,所述样本库中包含多个验证字符及与每一验证字符对应的字符模板特征;If the verification code image set input by the user is received, all the verification code images contained in the verification code image set are numerically extracted according to the preset image processing rules to obtain a sample library corresponding to the verification code image set. The sample library contains multiple verification characters and character template features corresponding to each verification character;
若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素;If an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel judgment rule in the image processing rule;
根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像;Segmenting from 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;
根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征;Digitize the character pixels in each of the character images according to the digitization rule in the image processing rules to obtain character features corresponding to each of the character images;
根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符;Acquiring verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature, and the verification code information includes at least one verification character;
将所述待识别图像的标识信息与所述验证码信息的组合作为与所述待识别图像对应的验证信息反馈至所述管理服务器。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 verification information corresponding to the image to be identified.
第二方面,本申请实施例提供了一种图形验证码识别装置,其包括:In the second aspect, an embodiment of the present application provides a graphic verification code recognition device, which includes:
样本库构建单元,用于若接收到用户所输入的验证码图像集,根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的 样本库,所述样本库中包含多个验证字符及与每一验证字符对应的字符模板特征;The sample library construction unit is used to, if the verification code image set input by the user is received, numerically extract all the verification code images contained in the verification code image set according to the preset image processing rules to obtain the verification code image set Corresponding sample library, the sample library includes a plurality of verification characters and character template characteristics corresponding to each verification character;
目标像素确定单元,用于若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素;The target pixel determining unit is configured to, if an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel determination rule in the image processing rule;
字符图像获取单元,用于根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像;A character image acquisition unit, configured 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;
字符特征获取单元,用于根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征;A character feature acquiring unit, configured to digitize the character pixels in each character image according to the digitization rule in the image processing rule to obtain the character feature corresponding to each character image;
验证码信息获取单元,用于根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符;The verification code information acquiring unit is configured to acquire verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature, and the verification code information includes at least one verification character ;
验证信息反馈单元,用于将所述待识别图像的标识信息与所述验证码信息的组合作为与所述待识别图像对应的验证信息反馈至所述管理服务器。The verification information feedback unit is configured to feed back the 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.
第三方面,本申请实施例又提供了一种计算机设备,其包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述第一方面所述的图形验证码识别方法。In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the computer The program implements the pattern verification code recognition method described in the first aspect.
第四方面,本申请实施例还提供了一种计算机可读存储介质,其中所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行上述第一方面所述的图形验证码识别方法。In a fourth aspect, an embodiment of the present application also 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 above-mentioned first On the one hand, the graphic verification code recognition method.
本申请实施例提供了一种图形验证码识别方法、装置、计算机设备及存储介质。根据图像处理规则对所输入的验证码图像进行数值化提取得到样本库,从来自管理服务器的待识别图像中确定对应的目标像素,从目标像素中分割得到包含单个字符的字符图像,对字符图像进行数值化得到与每一字符图像对应的字符特征,根据匹配规则获取样本库中与字符特征相匹配的验证码信息,将包含验证码信息的验证信息反馈至管理服务器。通过上述方法,可得到采用数值化形式进行存储的样本库,并基于所得到的样本库对待识别图像进行识别以得到验证码信息,相比采用字符图片进行图像验证码识别,可大幅减少样本库所需占用的存储空间,并提高对图形验证码进行识别的效率。The embodiments of the present application provide a method, device, computer equipment, and storage medium for identifying a graphic verification code. According to the image processing rules, the input verification code image is numerically extracted to obtain a sample library, the corresponding target pixel is determined from the image to be recognized from the management server, and the target pixel is segmented to obtain a character image containing a single character. Numericalization is performed 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 including the verification code information is fed back to the management server. Through the above method, a sample library that is stored in a numerical form can be obtained, and based on the obtained sample library, the image to be recognized is recognized to obtain the verification code information. Compared with the use of character pictures for image verification code recognition, the sample library can be greatly reduced Need to occupy the storage space, and improve the efficiency of identifying the graphic verification code.
附图说明Description of the drawings
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following will briefly introduce the drawings used in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present application. Ordinary technicians can obtain other drawings based on these drawings without creative work.
图1为本申请实施例提供的图形验证码识别方法的流程示意图;FIG. 1 is a schematic flowchart of a method for identifying a graphic verification code provided by an embodiment of the application;
图2为本申请实施例提供的图形验证码识别方法的应用场景示意图;2 is a schematic diagram of an application scenario of a method for identifying a graphic verification code provided by an embodiment of the application;
图3为本申请实施例提供的图形验证码识别方法的使用效果图;FIG. 3 is a diagram showing the use effect of the graphic verification code recognition method provided by the embodiment of the application;
图4为本申请实施例提供的图形验证码识别方法的子流程示意图;FIG. 4 is a schematic diagram of a sub-process of a method for identifying a graphic verification code provided by an embodiment of the application;
图5为本申请实施例提供的图形验证码识别方法的另一子流程示意图;FIG. 5 is a schematic diagram of another sub-flow of the method for identifying a graphic verification code according to an embodiment of the application;
图6为本申请实施例提供的图形验证码识别方法的另一子流程示意图;FIG. 6 is a schematic diagram of another sub-process of the method for identifying a graphic verification code provided by an embodiment of the application;
图7为本申请实施例提供的图形验证码识别方法的另一子流程示意图;FIG. 7 is a schematic diagram of another sub-process of the method for identifying a graphic verification code provided by an embodiment of the application;
图8为本申请实施例提供的图形验证码识别方法的另一子流程示意图;FIG. 8 is a schematic diagram of another sub-process of the method for identifying a graphic verification code provided by an embodiment of the application;
图9为本申请实施例提供的图形验证码识别方法的另一子流程示意图;FIG. 9 is a schematic diagram of another sub-flow of the method for identifying a graphic verification code provided by an embodiment of the application;
图10为本申请实施例提供的图形验证码识别装置的示意性框图;FIG. 10 is a schematic block diagram of a graphic verification code recognition device provided by an embodiment of the application;
图11为本申请实施例提供的计算机设备的示意性框图。FIG. 11 is a schematic block diagram of a computer device provided by an embodiment of the application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and appended claims, the terms "including" and "including" indicate the existence of the described features, wholes, steps, operations, elements and/or components, but do not exclude one or The existence or addition of multiple other features, wholes, steps, operations, elements, components, and/or collections thereof.
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in the specification of this application and the appended claims, unless the context clearly indicates other circumstances, the singular forms "a", "an" and "the" are intended to include plural forms.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should be further understood that the term "and/or" used in the specification and appended claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations .
请参阅图1及图2,图1是本申请实施例提供的图形验证码识别方法的流程示意图,图2为本申请实施例提供的图形验证码识别方法的应用场景示意图。该图形验证码识别方法应用于用户终端10中,该方法通过安装于用户终端10中的应用软件进行执行,用户终端10与至少一台管理服务器20进行通信,用户可将验证码图像集输入用户终端10并创建得到样本库,若接收到来自任意一台管理服务器20的待识别图像,用户终端10可通过样本库对待识别图像进行识别以获取得到对应的包含验证码信息的验证信息并反馈至管理服务器20,即可完成对待识别图像进行识别的过程。用户终端10即是用于执行图形验证码识别方法以对待识别图像进行识别获取验证码信息的终端设备,例如台式电脑、笔记本电脑、平板电脑或手机等,管理服务器20即为可发送待识别图像至用户终端10的企业终端。如图1所示,该方法包括步骤S110~S160。Please refer to FIG. 1 and FIG. 2. FIG. 1 is a schematic flowchart of a method for identifying a graphic verification code provided by an embodiment of the present application, and FIG. 2 is a schematic diagram of an application scenario of the method for recognizing a graphic verification code provided by an embodiment of the present application. The graphic verification code recognition method is applied to the user terminal 10. The method is executed by application software installed in the user terminal 10. The user terminal 10 communicates with at least one management server 20, and the user can input the verification code image set into the user The terminal 10 creates a sample library. If receiving an image to be identified from any management server 20, the user terminal 10 can identify the image to be identified through the sample library to obtain the corresponding verification information containing the verification code information and feed it back to The management server 20 can complete the process of recognizing the image to be recognized. The user terminal 10 is a terminal device that is used to perform a graphic verification code recognition method to identify the image to be recognized and obtain verification code information, such as a desktop computer, a notebook computer, a tablet computer, or a mobile phone, etc., and the management server 20 can send the image to be recognized Enterprise terminal to user terminal 10. As shown in Fig. 1, the method includes steps S110 to S160.
S110、若接收到用户所输入的验证码图像集,根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,所述样本库中包含多个验证字符及与每一验证字符对应的字符模板特征。S110. If the verification code image set input by the user is received, numerically extract all verification code images contained 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. The sample library includes multiple verification characters and character template features corresponding to each verification character.
若接收到用户所输入的验证码图像集,根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,所述样本库中包含与多个验证字符及与每一验证字符对应的字符模板特征。其中,用户即为用户终端的使用者,用户可以是企业中对程序进行登录测试的测试人员,用户为了对来自管理服务器的待识别图像进行识别,需先输入验证码图像集以构建样本库,并通过所构建的样本库对待识别图像进行准确识别。所述图像处理规则包括像素判断规则及数值化规则,验证码图像集中包 含多个验证码图像,以及与该验证码图像相匹配的一个验证字符,验证码图像即为一张包含验证字符的图像,验证字符即为该图像中所包含的一个具体字符信息,验证字符可以是通过人工方式对包含验证字符的图像进行识别所得到的字符信息,验证字符可以是大写字母、小写字母、阿拉伯数字及汉字中的一种或多种。具体的,一个验证字符在验证码图像集可包含一张相匹配的图像,一个验证字符也可对应多张图像,各种字体对某一个验证字符进行书写的方式各不相同。If the verification code image set input by the user is received, all the verification code images contained in the verification code image set are numerically extracted according to the preset image processing rules to obtain a sample library corresponding to the verification code image set. 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 who performs a login test on the program in the enterprise. In order to recognize the image to be recognized from the management server, the user needs to input the verification code image set to build the sample library. And accurately recognize the image to be recognized through the constructed sample library. The image processing rules include pixel judgment rules and digitization 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 verification characters. , The verification character is a specific character information contained in the image. The verification character can be the character information obtained by manually recognizing the image containing the verification character. The verification character can be uppercase letters, lowercase letters, Arabic numerals, and One or more of 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, and various fonts have different ways of writing a verification character.
例如,验证字符“五”与多种字体之间对应多张图像,则每一张图像与一种字体相对应,每一张图像中均为以一种字体书写“五”所得到的图像信息,则可将与“五”与多种不同字体对应的多张图像均添加至验证码图像集中;增加与验证字符相匹配的图像的数量可显著提高对待识别验证图像进行识别的准确度。For example, if the verification character "Five" corresponds to multiple images with multiple fonts, each image corresponds to one font, and each image contains image information obtained by writing "Five" in one font. , Multiple images corresponding to "Five" and multiple different fonts can be added to the verification code image collection; increasing the number of images matching the verification characters can significantly improve the accuracy of the recognition of the verification image to be recognized.
样本库即为存储用于识别待识别验证图像的样本信息,样本库中包含多个验证字符,以及与每一验证字符相匹配的一个或多个字符模板特征。The sample library is to store sample information used to identify the verification image to be recognized. The sample library contains multiple verification characters and one or more character template features that match each verification character.
例如,对与“五”这一验证字符对应的四张图像分别进行数值化,每一张图像均可得到对应的一个字符模板特征,则最终可得到与“五”对应的四个字符模板特征,也即是所得到的样本库中包含与“五”这一验证字符对应的四个字符模板特征。For example, the four images corresponding to the verification character "five" are respectively digitized, and each image can get a corresponding character template feature, and finally four character template features corresponding to "five" can be obtained , That is, the obtained sample library contains four character template features corresponding to the verification character "five".
根据图像处理规则中的像素判断规则可获取与每一验证码图像对应的有效像素,根据有效像素的位置信息裁剪得到与有效像素对应的有效图像,根据数值化规则对有效图像中所包含的有效像素进行数值化,得到与每一验证码图像对应的字符模板特征,字符模板特征即为用于体现有效像素特征的数值信息,的字符模板特征进行对应并存储,即可得到样本库。According to the pixel judgment rules in the image processing rules, the effective pixels corresponding to each verification code image can be obtained, and the effective pixels corresponding to the effective pixels can be cropped according to the position information of the effective pixels. The pixel is digitized to obtain the character template feature corresponding to each verification code image. The character template feature is the numerical information used to reflect the effective pixel feature, and the character template feature is corresponded and stored to obtain the sample library.
在一实施例中,如图4所示,步骤S110包括子步骤S111、S112和S113。In an embodiment, as shown in FIG. 4, step S110 includes sub-steps S111, S112, and S113.
S111、根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素。S111. Determine effective pixels corresponding to each image according to the image information of each verification code image in the verification code image set and the pixel determination rule.
根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素。所述像素判断规则中包括灰度化规则及灰度阈值,验证码图像中包含若干个像素,每个像素在该图像中包含对应的像素值,像素所对应的像素值即为与该图像对应的图像信息。像素判断规则即为对每一像素的像素值进行判断的规则信息,根据验证码图像中所包含像素的像素值及像素判断规则即可确定与该图像对应的有效像素。具体的,若验证码图像为彩色图像,则该彩色图像中每一像素点在RGB对应的红(R)、绿(G)、蓝(B)三个颜色通道上分别对应一个像素值;若验证码图像为灰度图像,则该灰度图像中每一像素点在黑色这一颜色通道上对应一个像素值,像素值均采用非负整数进行表示,其取值范围为[0,255],以黑色这一颜色通道为例,若某一像素的像素值为0则表示该像素的颜色为黑色,若某一像素的像素值为255则表示该像素的颜色为白色,像素值为其他数值则表明该像素的颜色为介于白色与黑色之间的一个具体灰度。Determine the effective pixel corresponding to each image according to the image information of each verification code image in the verification code image set and the pixel judgment rule. The pixel judgment rules include grayscale rules and grayscale thresholds. The verification code image contains several pixels, and each pixel contains a corresponding pixel value in the image, and the pixel value corresponding to the pixel corresponds to the image Image information. The pixel judgment rule is the rule information for judging the pixel value of each pixel. According to the pixel value of the pixel contained in the verification code image and the pixel judgment rule, the effective pixel corresponding to the image can be determined. Specifically, if the verification code image is a color image, each pixel in the color image corresponds to a pixel value on the three color channels of red (R), green (G), and blue (B) corresponding to RGB; if The verification code image is a grayscale image, and each pixel in the grayscale image corresponds to a pixel value on the color channel of black. The pixel value is represented by a non-negative integer, and its value range is [0,255] Take the color channel of black as an example. If the pixel value of a certain pixel is 0, it means that the color of the pixel is black. If the pixel value of a certain pixel is 255, it means that the color of the pixel is white, and the pixel value is other The value indicates that the color of the pixel is a specific gray scale between white and black.
在一实施例中,如图5所示,步骤S111包括子步骤S1111、S1112和S1113。In one embodiment, as shown in FIG. 5, step S111 includes sub-steps S1111, S1112, and S1113.
S1111、根据所述灰度化规则对每一个所述验证码图像进行灰度化以得到与每一所述验证码图像相匹配的灰度图像;S1112、对所述灰度图像中所包含像素的灰度值是否大于所述灰度 阈值进行判断,以获取灰度值不大于所述灰度阈值的像素;S1113、对所述灰度值不大于灰度阈值的每一像素是否孤立进行判断,以将孤立的像素从所述灰度值不大于灰度阈值的像素中剔除以得到所述有效像素。S1111, grayscale each verification code image according to the grayscale rules to obtain a grayscale image matching each verification code image; S1112, perform grayscale image processing on the pixels contained in the grayscale image Determine whether the gray value of is greater than the gray threshold to obtain pixels whose gray value is not greater than the gray threshold; S1113, determine whether each pixel with the gray value not greater than the gray threshold is isolated , To remove isolated pixels from the pixels whose gray value is not greater than the gray threshold value to obtain the effective pixel.
若验证码图像不为灰度图像,可通过灰度化规则对该图像进行灰度化处理,以得到对应的灰度图像,灰度化规则可将每一像素点在RGB对应的像素值转换为在黑色这一颜色通道上对应一个像素值;若验证码图像为灰度图像,则无需进行灰度化处理。图3为本申请实施例提供的图形验证码识别方法的使用效果图,进行灰度化处理后所得到的灰度图像如图3-(a)所示。判断灰度图像中每一像素的像素值是否大于灰度阈值,获取所有不大于灰度阈值的像素,例如,若灰度阈值为80,则可对每一像素的像素值进行判断以获取像素值不大于80的像素;由于可从图像中识别得到的有效信息均为多个像素相连接而形成的像素区块,因此可将图像中多个像素相连接而形成的像素区块作为有效像素,具体的,对所得到的不大于灰度阈值的每一像素是否孤立进行判断,也即是对每一像素是否与像素值不大于灰度阈值的其他像素相连,若相连,则判断结果为该像素不孤立;若不相连,则判断结果为该像素孤立,将孤立的像素剔除即可得到有效像素,所得到的有效像素对应的图像如图3-(b)所示。If the verification code image is not a grayscale image, you can perform grayscale processing on the image through the grayscale rule to obtain the corresponding grayscale image. The grayscale rule can convert the pixel value of each pixel in RGB In order to correspond to a pixel value on the color channel of black; if the verification code image is a grayscale image, there is no need to perform grayscale processing. Fig. 3 is an effect diagram of the graphic verification code recognition method provided by an embodiment of the application, and the gray image obtained after gray-scale processing is shown in Fig. 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, you can determine the pixel value of each pixel to obtain the pixel Pixels with a value 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 an effective pixel , Specifically, whether each pixel obtained is not greater than the grayscale threshold is judged in isolation, that is, whether each pixel is connected to other pixels whose pixel value is not greater than the grayscale threshold. If connected, the judgment result is The pixel is not isolated; if it is not connected, the judgment result is that the pixel is isolated, and the effective pixel can be obtained by removing the isolated pixel. The image corresponding to the obtained effective pixel is shown in Figure 3-(b).
S112、根据每一所述图像中有效像素的位置信息提取包含所述有效像素的有效图像。S112: Extract an effective image including the effective pixel according to the position information of the effective pixel in each of the images.
根据每一所述图像中有效像素的位置信息提取包含所述有效像素的有效图像。具体的,图像中每一有效像素在该图像中的坐标值即为有效像素的位置信息,根据有效像素的位置信息即可从图像中提取得到包含有效像素的有效图像,所得到的有效图像如图3-(c)所示。The effective image including the effective pixel is extracted according to the position information of the effective pixel in each of the images. Specifically, the coordinate value of each effective pixel in the image in the image is the position information of the effective pixel. According to the position information of the effective pixel, the effective image containing the effective pixel can be extracted from the image. The obtained effective image is as As shown in Figure 3-(c).
在一实施例中,步骤S112包括子步骤:根据一个所述图像中有效像素的位置信息确定所述有效像素的矩形边界;根据所述矩形边界从有效像素中提取得到对应的矩形图像;对所述矩形图像进行二值化以得到仅包含黑色和白色的有效图像。In an embodiment, step S112 includes the sub-steps: determining the rectangular boundary of the effective pixel according to the position information of the effective pixel in one of the images; extracting the corresponding rectangular image from the effective pixels according to the rectangular boundary; The rectangular image is binarized to obtain an effective image containing only black and white.
根据图像中有效像素的位置信息确定与有效像素对应的一个矩形边界,矩形边界即为根据有效像素中最外围的有效像素的坐标值确定的矩形框,根据该矩形边界从有效像素中提取得到矩形图像,矩形图像中包含所有有效像素,对矩形图像进行二值化,将所有有效像素变更为黑色,将矩形图像中的其他像素变更为白色,也即是所得到的有效图像中仅包含黑色及白色两种颜色。Determine a rectangular boundary corresponding to the effective pixel according to the position information of the effective pixel in the image. The rectangular boundary is a rectangular frame determined according to the coordinate value of the outermost effective pixel in the effective pixel, and the rectangle is extracted from the effective pixel according to the rectangular boundary. Image, the rectangular image contains all effective pixels, the rectangular image is binarized, all effective pixels are changed to black, and other pixels in the rectangular image are changed to white, that is, the resulting effective image contains only black and Two colors of white.
S113、根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征。S113: Perform digitization on each of the effective images according to the digitization rule to obtain character template characteristics corresponding to each of the verification code images.
根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征。根据数值化规则即为对有效图像进行数值化的规则信息,对有效图像进行数值化后即可得到与该有效图像对应的字符模板特征,字符模板特征即为通过数值对验证码图像的特征进行量化表示的特征信息,字符模板特征包括尺寸数组及坐标数组,尺寸数组用于表示有效图像的尺寸,坐标数组可用于表示有效图像中每一有效像素的坐标值。Perform digitization on each of the valid images according to the digitization rule to obtain character template characteristics corresponding to each of the verification code images. According to the digitization rule, it is the rule information for digitizing the valid image. After digitizing the valid image, the character template feature corresponding to the valid image can be obtained. The character template feature is the feature of the verification code image through the numerical value. Quantitatively expressed feature information, the character template feature includes a size array and a coordinate array. The size array is used to represent the size of the effective image, and the coordinate array can be used to represent the coordinate value of each effective pixel in the effective image.
在一实施例中,如图6所示,步骤S113包括子步骤S1131、S1132和S1133。In an embodiment, as shown in FIG. 6, step S113 includes sub-steps S1131, S1132, and S1133.
S1131、获取一张所述有效图像的尺寸信息,根据所述数值化规则生成与所述尺寸信息对应的尺寸数组;S1132、获取所述有效图像中所有有效像素的坐标信息,根据所述数值化规则 及所述坐标信息生成与每一所述有效像素对应的坐标数组;S1133、将所述尺寸数组与所有所述坐标数组作为与所述有效图像对应的一验证码图像的字符模板特征。S1131. Obtain the size information of a piece of the effective image, and generate a size array corresponding to the size information according to the digitization rule; S1132, obtain the coordinate information of all effective pixels in the effective image, and according to the digitization The rule and the coordinate information generate a coordinate array corresponding to each of the effective pixels; S1133. Use the size array and all the coordinate arrays as character template features of a verification code image corresponding to the effective image.
例如,某一有效图像的尺寸信息为:长25像素,宽15像素,则得到与该有效图像对应的尺寸数组为{25,15};有效图像中某一有效像素位于第3行第7列,则得到与该有效像素对应的坐标数组为{3,7}。For example, if the size information of a valid image is: 25 pixels in length and 15 pixels in width, the size array corresponding to the effective image is {25, 15}; a valid pixel in the effective image is located in the third row and the seventh column , Then the coordinate array corresponding to the effective pixel is {3, 7}.
S120、若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素。S120: If an image to be recognized from the management server is received, determine a target pixel corresponding to the image to be recognized according to the pixel determination rule in the image processing rule.
若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素。用户通过用户终端登录网页或邮箱的过程中,管理服务器会下发待识别图像至用户终端,待识别图像即为需进行识别的图形验证码,图形验证码由一个或多个验证码字符,可根据图像处理规则中的像素判断规则对待识别图像中的像素进行判断并获取对应的目标像素,像素判断规则中包括灰度化规则及灰度阈值。If the image to be recognized from the management server is received, the target pixel corresponding to the image to be recognized is determined according to the pixel determination rule in the image processing rule. When the user logs in to the webpage or mailbox through the user terminal, the management server will send the image to be recognized to the user terminal. The image to be recognized is the graphic verification code that needs to be recognized. The graphic verification code consists of one or more verification code characters. According to the pixel judgment rule in the image processing rule, the pixel in the image to be recognized is judged and the corresponding target pixel is obtained. The pixel judgment rule includes the gray scale rule and the gray threshold.
在一实施例中,步骤S120包括子步骤:根据所述灰度化规则对所述待识别图像进行灰度化以得到与所述待识别图像相匹配的待识别灰度图像;对所述待识别灰度图像中所包含像素的灰度值是否大于所述灰度阈值进行判断,以获取灰度值大于所述灰度阈值的像素;对所述灰度值大于灰度阈值的每一像素是否孤立进行判断,以将孤立的像素从所述灰度值大于灰度阈值的像素中剔除得到以所述目标像素。具体的,从待识别图像中获取对应的目标像素的方法与从验证码图像中获取对应的有效像素的方法相同,在此不展开进行说明。In one embodiment, step S120 includes the sub-steps: grayscale the image to be recognized according to the grayscale rule to obtain a grayscale image to be recognized that matches the image to be recognized; Identify whether the gray value of the pixels contained in the grayscale image is greater than the gray threshold value to determine to obtain pixels with gray value greater than the gray threshold value; for each pixel whose gray value is greater than the gray threshold value Whether or not to be isolated is determined, so as to remove isolated pixels from the pixels whose grayscale value is greater than the grayscale threshold to obtain the target pixel. Specifically, the method of obtaining the corresponding target pixel from the image to be recognized is the same as the method of obtaining the corresponding effective pixel from the verification code image, and will not be further described here.
S130、根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像。S130: According to a preset image adjustment rule and the position information of the target pixel, a character image containing a single character is obtained by segmenting the target pixel.
根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像。具体的,根据目标像素中每一像素的位置信息,即可从目标像素中分割得到包含单个字符的分割图像,根据图像调整规则对该分割图像进行调整,即可得到仅包含单个字符的字符图像,也即是根据目标像素中所包含字符的数量,即可得到与字符数量相同的多个字符图像。According to a preset image adjustment rule and the position information of the target pixel, a character image containing a single character is obtained by segmenting the target pixel. Specifically, according to the position information of each pixel in the target pixel, a segmented image containing a single character can be segmented from the target pixel, 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 pixel, multiple character images with the same number of characters can be obtained.
在一实施例中,如图7所示,步骤S130包括子步骤S131、S132和S133。In one embodiment, as shown in FIG. 7, step S130 includes sub-steps S131, S132, and S133.
S131、根据所述目标像素中每一像素的位置信息获取所述目标像素中多个像素相连接而形成的像素区块;每一所述像素区块中均包含一个字符。S131. Obtain, 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; each of the pixel blocks includes a character.
根据所述目标像素中每一像素的位置信息获取所述目标像素中多个像素相连接而形成的像素区块;每一所述像素区块中均包含一个字符。由于单个字符均是由多个像素相连接而形成的像素区块,因此根据目标像素的位置信息,将有多个像素相连接的像素区块作为与一个字符对应的像素区块。A pixel block formed by connecting a plurality of pixels in the target pixel is obtained according to the position information of each pixel in the target pixel; each of the pixel blocks includes a character. Since a single character is a pixel block formed by connecting multiple pixels, according to the position information of the target pixel, a pixel block connected with multiple pixels is used as a pixel block corresponding to a character.
S132、根据所述像素区块在所述目标像素中所处的位置提取得到与每一像素区块对应的分割图像。S132: Extract a segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel.
根据所述像素区块在所述目标像素中所处的位置提取得到与每一像素区块对应的分割图像。具体的,根据某一个像素区块在目标像素中所处的为位置即可确定与该像素区块对应的 一个矩形边界,矩形边界即为根据该像素区块中最外围的像素的坐标值确定的矩形框,根据该矩形边界从目标像素中提取得到与一个与该像素区块对应的分割图像。Extracting a segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel. Specifically, a rectangular boundary corresponding to the pixel block can be determined according to the position of a certain pixel block in the target pixel, and the rectangular boundary is determined according to the coordinate value of the outermost pixel in the pixel block According to the rectangle boundary, extract a segmented image corresponding to the pixel block from the target pixel.
S133、根据所述图像调整规则对所述分割图像进行调整以得到与每一所述分割图像对应的字符图像。S133. Adjust the segmented images according to the image adjustment rule to obtain a character image corresponding to each segmented image.
根据所述图像调整规则对所述分割图像进行调整以得到与每一所述分割图像对应的字符图像。具体的,可根据所得到的分割图像的尺寸等特征信息,对分割图像进行调整以得到与每一分割图像对应的字符图像具体的,图像调整规则包括放大、缩小、裁剪及旋转中的一种或多种,调整后的字符图像即为满足图像调整规则的图像。The segmented image is adjusted according to the image adjustment rule to obtain a character image corresponding to each segmented image. Specifically, the segmented images can be adjusted according to the feature information such as the size of the segmented images to obtain a character image corresponding to each segmented image. Specifically, the image adjustment rules include one of enlargement, reduction, cropping, and rotation. Or more, the adjusted character image is an image that meets the image adjustment rules.
S140、根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征。S140: Perform digitization on the character pixels in each of the character images according to the digitization rules in the image processing rules to obtain character features corresponding to each of the character images.
根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征。根据数值化规则即为对字符图像中所包含的字符像素进行数值化的规则信息,对一个字符图像进行数值化后即可得到与该字符图像对应的字符特征,字符特征即为通过数值对字符图像的特征进行量化表示的特征信息,字符特征也包括尺寸数组及坐标数组,尺寸数组用于表示字符图像的尺寸,坐标数组可用于表示字符图像中每一字符像素的坐标值。The character pixels in each of the character images are digitized according to the digitization rules in the image processing rules to obtain character features corresponding to each of the character images. According to the digitization rule, it is the rule information for digitizing the character pixels contained in the character image. After digitizing a character image, the character feature corresponding to the character image can be obtained. The character feature is the numerical value of the character The feature information that is quantified by the feature of the image. The character feature also includes 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.
在一实施例中,步骤S140包括子步骤:获取一张所述字符图像的尺寸信息,根据所述数值化规则生成与所述尺寸信息对应的尺寸数组;获取所述字符图像中所有字符像素的坐标信息,根据所述数值化规则及所述坐标信息生成与每一所述字符像素对应的坐标数组;将所述尺寸数组与所有所述坐标数组作为与所述字符图像对应的字符特征。In one embodiment, step S140 includes sub-steps: obtaining size information of a piece of the character image, generating a size array corresponding to the size information according to the digitization rule; obtaining the size of all character pixels in the character image For coordinate information, a coordinate array corresponding to each character pixel is generated according to the digitization rule and the coordinate information; the size array and all the coordinate arrays are used as character features corresponding to the character image.
从字符图像中获取对应的字符特征的方法与从有效图像中获取对应的字符模板特征的方法相同,在此不展开进行说明。The method of obtaining the corresponding character feature from the character image is the same as the method of obtaining the corresponding character template feature from the valid image, and will not be explained here.
S150、根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符。S150. Obtain verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature, where the verification code information includes at least one verification character.
根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符。具体的,待识别图像中所包含的字符图像的数量即与验证码信息中验证字符的数量相等,每一字符图像对应一个字符特征,可根据匹配规则获取样本库中与每一字符特征对应的一个验证字符,将所得到的验证字符进行组合后即可得到与待识别图像对应的验证码信息。Acquire verification code information matching the character feature in the sample library according to a preset matching rule and the character feature, and the verification code information includes at least one verification character. Specifically, the number of character images contained 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. The sample library corresponding to each character feature can be obtained according to the matching rules. For a verification character, the verification code information corresponding to the image to be recognized can be obtained by combining the obtained verification characters.
在一实施例中,如图8所示,步骤S150包括子步骤S151和S152。In an embodiment, as shown in FIG. 8, step S150 includes sub-steps S151 and S152.
S151、根据所述匹配规则获取所述样本库中与每一所述字符特征对应的一个验证字符。S151. Obtain a verification character corresponding to each character feature in the sample library according to the matching rule.
根据所述匹配规则获取所述样本库中与每一所述字符特征对应的一个验证字符。所述匹配规则中包括尺寸阈值、像素密度计算公式及密度阈值,尺寸阈值即是用于判断字符特征的尺寸比值与字符模板特征的尺寸比值是否相匹配的阈值信息,尺寸比值可根据尺寸数组中的数值计算得到,若字符特征的尺寸比值与字符模板特征的尺寸比值之间的差值不大于尺寸阈值,则两者相匹配,否则两者不相匹配;像素密度计算公式即是用于获取字符特征或字符模 板特征进行计算以获取对应像素密度的计算公式,若字符特征对应的像素密度较大,则表明该字符特征所对应的字符图像中单位面积内所包含的字符像素较多,反之则表明该字符特征所对应的字符图像中单位面积内所包含的字符像素较少;密度阈值即是用于判断字符特征的像素密度是否与字符模板特征的像素密度是否相匹配的阈值信息,若字符特征的像素密度与字符模板特征的像素密度之间的差值不大于密度阈值,则两者相匹,否则两者不相匹配。Acquire one verification character corresponding to each character feature in the sample library according to the matching rule. The matching rule includes a size threshold, a pixel density calculation formula, and a density threshold. The size threshold is 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 based on 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 used to obtain The character feature or character template feature is calculated to obtain the calculation formula of the corresponding pixel density. If the pixel density corresponding to the character feature is larger, it means that the character image corresponding to the character feature contains more character pixels per unit area, and vice versa 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 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.
根据上述方法筛选得到符合条件的字符模板特征组合为与一个字符特征对应的第二特征集,计算第二特征集中每一字符模板特征与该字符特征之间的匹配度,并筛选得到一个与字符特征匹配度最高的字符模板特征,并进一步获取该字符模板特征的验证字符作为该字符特征的验证字符。根据上述方式可获取到与每一字符特征对应的一个验证字符。According to the above method, the qualified character template feature combination is obtained as a second feature set corresponding to a character feature, and the matching degree between each character template feature in the second feature set and the character feature is calculated, and a matching character is obtained by screening. The character template feature with the highest feature matching degree, and the 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.
在一实施例中,如图9所示,步骤S151包括子步骤S1511、S1512、S1513和S1514。In an embodiment, as shown in FIG. 9, step S151 includes sub-steps S1511, S1512, S1513, and S1514.
S1511、根据所述尺寸阈值获取所述样本库中尺寸比值与一个所述字符特征的尺寸比值相匹配的字符模板特征以得到第一特征集。S1511, according to the size threshold, obtain a character template feature whose size ratio matches a size ratio of the character feature in the sample library to obtain a first feature set.
例如,某一字符特征的尺寸数组为{25,15},样本库中某一字符模板特征的尺寸数组为{20,10},尺寸阈值为0.3;该字符特征的尺寸比值为1.6667,该字符模板特征的尺寸比值为2,两者的尺寸比值的差值为0.3333,大于尺寸阈值,则该字符模板特征不与该字符特征相匹配。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 character The size ratio of the template feature is 2, and the difference between the two size ratios is 0.3333, which is greater than the size threshold, then the character template feature does not match the character feature.
S1512、根据所述像素密度计算公式计算所述字符特征的第一像素密度及所述第一特征集中每一字符模板特征的第二像素密度。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.
计算像素密度以字符特征为例进行说明,获取该字符特征中所包含的坐标数组的数量,并除以尺寸数组中数值的乘积,即可得到该字符特征的像素密度。像素密度计算公式可表示为:Calculating the pixel density takes a character feature as an example. The number of coordinate arrays included 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:
M=N/(C 1×C 2)                     (1); M=N/(C 1 ×C 2 ) (1);
其中,M为字符特征的像素密度,N为该字符特征中坐标数组的数量,C 1为该字符特征中尺寸数组的第一个数值,C 2为该字符特征中尺寸数组的第二个数值。 Among them, M is the pixel density of the character feature, N is the number of coordinate arrays in the character feature , C 1 is the first value of the size array in the character feature, and C 2 is the second value of the size array in the character feature .
若一字符特征的尺寸数组为{25,15},该组分特征中坐标数组的数量为60,则对应的像素密度M=60/(25×15)=0.16。计算字符模板特征的像素密度的方式与上述方式相同。If the size array of a character feature is {25, 15} and the number of coordinate arrays in the component feature is 60, the corresponding pixel density M=60/(25×15)=0.16. The method of calculating the pixel density of the character template feature is the same as the above method.
S1513、判断所述第一像素密度与所述每一所述第二像素密度之间的差值是否小于所述密度阈值,以获取差值小于所述密度阈值的字符模板特征作为第二特征集。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 difference is less than the density threshold as a second feature set .
S1514、计算所述字符特征与所述第二特征集中的每一字符模板特征之间的匹配度,获取所述第二特征集中匹配度最高的一个字符模板特征对应的验证字符作为与所述字符特征对应验证字符。S1514. Calculate the matching degree between the character feature and each character template feature in the second feature set, and obtain the verification character corresponding to the character template feature with the highest matching degree in the second feature set as the character The feature corresponds to the verification character.
具体的,将字符特征中每一坐标数组的数值除以该字符特征的尺寸数组,得到与每一坐标数组对应的矢量数组,例如,某一字符特征的尺寸数组为{25,15},其中某一坐标数组为{3,7},则计算得到与该坐标数组对应的一个矢量数组为{3/25,7/15},也即是{0.12,0.4667}。以同样方式获取第二特征集中每一字符模板特征的矢量数组,获取一个字符模板特征的矢量数组与该字符特征的矢量数组相重合的数组数量,将相重合的数组数量除以该字符特征的矢 量数组所得到的计算结果,作为该字符模板特征与该字符特征之间的匹配度。根据上述方法计算第二特征集中每一字符模板特征与该字符特征之间的匹配度,并获取匹配度最高的一个字符模板特征所对应的验证字符作为与该字符特征对应验证字符。Specifically, the value of each coordinate array in the character feature is divided by the size array of the character feature to obtain the vector array corresponding to each coordinate array. For example, the size array of a certain character feature is {25, 15}, where If a certain coordinate array is {3, 7}, a vector array corresponding to the coordinate array is calculated to be {3/25, 7/15}, that is, {0.12, 0.4667}. Obtain the vector array of each character template feature in the second feature set in the same way, obtain the number of arrays where the vector array of a character template feature coincides with the vector array of the character feature, and divide the number of coincident arrays by the character feature's vector array The calculation result obtained by the vector array is used as the matching degree between the character template feature and the character feature. According to the above method, the matching degree between each character template feature in the second feature set and the character feature is calculated, 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.
S152、根据所述字符特征的顺序对所述验证字符进行组合以得到与所述字符特征对应的验证码信息。S152. Combine the verification characters according to the sequence of the character features to obtain verification code information corresponding to the character features.
根据所述字符特征的顺序对所述验证字符进行组合以得到与所述字符特征对应的验证码信息。对待识别图像进行分割后所得到的字符图像有一定的顺序,字符图像的顺序与所述字符特征的顺序相同,即可根据字符特征的顺序对与每一字符特征相对应的一个验证字符进行组合,以得到包含以既定顺序排列的多个验证字符所组成的验证码信息。The verification characters are combined according to the sequence of the character features to obtain verification code information corresponding to the character features. The character image obtained after segmentation of the image to be recognized has a certain sequence, and the sequence of the character image is the same as the sequence of the character features, and a verification character corresponding to each character feature can be combined according to the sequence of the character features , In order to obtain the verification code information consisting of multiple verification characters arranged in a predetermined order.
例如,对某一待识别图像进行识别后所得到的验证码信息为“T4bP”。For example, the verification code information obtained after recognizing a certain image to be recognized is "T4bP".
S160、将所述待识别图像的标识信息与所述验证码信息的组合作为与所述待识别图像对应的验证信息反馈至所述管理服务器。S160. Feed the 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 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. The image to be identified also contains an identification information corresponding to the image to be identified. The identification information can uniquely identify each image to be identified. The user terminal can perform identification information corresponding to the image to be identified and the obtained verification code information. Combination 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 matching the identification information in the verification information, so as to obtain the verification information in the verification information according to the target verification code. Verification code information is verified.
本申请中的技术方法可应用于智慧政务/智慧城管/智慧社区/智慧安防/智慧物流/智慧医疗/智慧教育/智慧环保/智慧交通等包含图形验证码识别的应用场景中,从而推动智慧城市的建设。The technical methods in this application can be applied to application scenarios that include graphic verification code recognition, such as smart government/smart city management/smart community/smart security/smart logistics/smart healthcare/smart education/smart environmental protection/smart transportation, so as to promote smart cities Construction.
在本申请实施例所提供的图形验证码识别方法中,根据图像处理规则对所输入的验证码图像进行数值化提取得到样本库,从来自管理服务器的待识别图像中确定对应的目标像素,从目标像素中分割得到包含单个字符的字符图像,对字符图像进行数值化得到与每一字符图像对应的字符特征,根据匹配规则获取样本库中与字符特征相匹配的验证码信息,将包含验证码信息的验证信息反馈至管理服务器。通过上述方法,可得到采用数值化形式进行存储的样本库,并基于所得到的样本库对待识别图像进行识别以得到验证码信息,相比采用字符图片进行图像验证码识别,可大幅减少样本库所需占用的存储空间,并提高对图形验证码进行识别的效率。In the graphic verification code recognition method provided by the embodiments of the present application, the input verification code image is numerically extracted according to the image processing rules to obtain a sample library, and the corresponding target pixel is determined from the image to be recognized from the management server, and from The target pixel is segmented to obtain a character image containing a single character, the character image is digitized to obtain the character feature corresponding to each character image, and the verification code information matching the character feature in the sample library is obtained according to the matching rule, which will contain the verification code The verification information of the information is fed back to the management server. Through the above method, a sample library that is stored in a numerical form can be obtained, and based on the obtained sample library, the image to be recognized is recognized to obtain the verification code information. Compared with the use of character pictures for image verification code recognition, the sample library can be greatly reduced Need to occupy the storage space, and improve the efficiency of identifying the graphic verification code.
本申请实施例还提供一种图形验证码识别装置,该图形验证码识别装置用于执行前述图形验证码识别方法的任一实施例。具体地,请参阅图10,图10是本申请实施例提供的图形验证码识别装置的示意性框图。该图形验证码识别装置可以配置于用户终端中。The embodiment of the present application also provides a graphic verification code recognition device, which is used to execute any embodiment of the foregoing graphic verification code recognition method. Specifically, please refer to FIG. 10, which is a schematic block diagram of a graphic verification code recognition apparatus provided by an embodiment of the present application. The graphic verification code recognition device can be configured in the user terminal.
如图10所示,图形验证码识别装置100包括样本库构建单元110、目标像素确定单元120、字符图像获取单元130、字符特征获取单元140、验证码信息获取单元150和验证信息反馈单元160。As shown in FIG. 10, 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.
样本库构建单元110,用于若接收到用户所输入的验证码图像集,根据预置的图像处理 规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,所述样本库中包含多个验证字符及与每一验证字符对应的字符模板特征。The sample library construction unit 110 is configured to, if the verification code image set input by the user is received, digitally extract all the verification code images contained in the verification code image set according to a preset image processing rule to obtain a verification code image A sample library corresponding to the set, the sample library includes a plurality of verification characters and a character template feature corresponding to each verification character.
在一实施例中,所述样本库构建单元110包括子单元有效像素确定单元、有效图像获取单元及数值化处理单元。In an embodiment, the sample library construction unit 110 includes a sub-unit effective pixel determination unit, an effective image acquisition unit, and a numerical processing unit.
有效像素确定单元,用于根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素;有效图像获取单元,用于根据每一所述图像中有效像素的位置信息提取包含所述有效像素的有效图像;数值化处理单元,用于根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征。The effective pixel determination unit is used to determine the effective pixel corresponding to each image according to the image information of each verification code image in the verification code image set and the pixel judgment rule; the effective image acquisition unit is used to determine the effective pixel corresponding to each image according to the The position information of the effective pixels in the image extracts the effective image including the effective pixels; the digitization processing unit is configured to digitize each of the effective images according to the digitization rule to obtain the verification code image Corresponding character template characteristics.
在一实施例中,所述有效像素确定单元包括子单元:灰度图像获取单元、灰度值判断单元及像素剔除单元。In an embodiment, the effective pixel determination unit includes sub-units: a gray image acquisition unit, a gray value judgment unit, and a pixel removal unit.
灰度图像获取单元,用于根据所述灰度化规则对每一个所述验证码图像进行灰度化以得到与每一所述验证码图像相匹配的灰度图像;灰度值判断单元,用于对所述灰度图像中所包含像素的灰度值是否大于所述灰度阈值进行判断,以获取灰度值不大于所述灰度阈值的像素;像素剔除单元,用于对所述灰度值不大于灰度阈值的每一像素是否孤立进行判断,以将孤立的像素从所述灰度值不大于灰度阈值的像素中剔除以得到所述有效像素。A gray-scale image acquisition unit, configured to gray-scale each verification code image according to the gray-scale rule to obtain a gray-scale image matching each verification code image; a gray-scale value judgment unit, It is used to judge whether the gray value of the pixels contained in the gray image is greater than the gray threshold value, so as to obtain the pixels whose gray value is not greater than the gray threshold value; Whether each pixel whose gray value is not greater than the gray threshold is judged in isolation, so as to remove isolated pixels from the pixels whose gray value is not greater than the gray threshold to obtain the effective pixel.
在一实施例中,所述有效图像获取单元包括子单元:矩形边界确定单元、矩形图像提取单元及二值化处理单元。In an embodiment, the effective image acquisition unit includes sub-units: a rectangular boundary determination unit, a rectangular image extraction unit, and a binarization processing unit.
矩形边界确定单元,用于根据一个所述图像中有效像素的位置信息确定所述有效像素的矩形边界;矩形图像提取单元,用于根据所述矩形边界从有效像素中提取得到对应的矩形图像;二值化处理单元,用于对所述矩形图像进行二值化以得到仅包含黑色和白色的有效图像。A rectangular boundary determining unit, configured to determine a rectangular boundary of the effective pixel according to the position information of an effective pixel in the image; a rectangular image extracting unit, configured to extract a corresponding rectangular image from the effective pixel according to the rectangular boundary; The binarization processing unit is configured to binarize the rectangular image to obtain an effective image containing only black and white.
在一实施例中,所述数值化处理单元包括子单元:尺寸数组生成单元、坐标数组生成单元及字符模板特征获取单元。In an embodiment, the numerical processing unit includes sub-units: a size array generating unit, a coordinate array generating unit, and a character template feature acquiring unit.
尺寸数组生成单元,用于获取一张所述有效图像的尺寸信息,根据所述数值化规则生成与所述尺寸信息对应的尺寸数组;坐标数组生成单元,用于获取所述有效图像中所有有效像素的坐标信息,根据所述数值化规则及所述坐标信息生成与每一所述有效像素对应的坐标数组;字符模板特征获取单元,用于将所述尺寸数组与所有所述坐标数组作为与所述有效图像对应的一验证码图像的字符模板特征。The size array generation unit is used to obtain the size information of the valid image, and the size array corresponding to the size information is generated according to the digitization rule; the coordinate array generation unit is used to obtain all the valid images in the effective image. The coordinate information of the pixel generates a coordinate array corresponding to each effective pixel according to the digitization rule and the coordinate information; the character template feature acquisition unit is used to take the size array and all the coordinate arrays as the AND The character template feature of a verification code image corresponding to the effective image.
目标像素确定单元120,用于若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素。The target pixel determining unit 120 is configured to, if an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel determination rule in the image processing rule.
字符图像获取单元130,用于根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像。The character image acquisition unit 130 is configured 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.
在一实施例中,所述字符图像获取单元130包括子单元:像素区块获取单元、分割图像获取单元及图像调整单元。In an 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.
像素区块获取单元,用于根据所述目标像素中每一像素的位置信息获取所述目标像素中多个像素相连接而形成的像素区块;每一所述像素区块中均包含一个字符;分割图像获取单元,用于根据所述像素区块在所述目标像素中所处的位置提取得到与每一像素区块对应的分 割图像;图像调整单元,用于根据所述图像调整规则对所述分割图像进行调整以得到与每一所述分割图像对应的字符图像。The pixel block obtaining unit is configured to obtain, 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; each of the pixel blocks includes a character The segmented image acquisition unit is used to extract the segmented image corresponding to each pixel block according to the position of the pixel block in the target pixel; the image adjustment unit is used to adjust the image according to the image adjustment rule The segmented images are adjusted to obtain a character image corresponding to each of the segmented images.
字符特征获取单元140,用于根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征。The character feature acquiring unit 140 is configured to digitize the character pixels in each character image according to the digitization rule in the image processing rule to obtain the character feature corresponding to each character image.
验证码信息获取单元150,用于根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符。The verification code information obtaining unit 150 is configured to obtain verification code information matching the character feature in the sample library according to the preset matching rules and the character feature, and the verification code information includes at least one of the verification code information. character.
在一实施例中,所述验证码信息获取单元150包括子单元:验证字符匹配单元及验证字符组合单元。In an embodiment, the verification code information acquiring unit 150 includes sub-units: a verification character matching unit and a verification character combination unit.
验证字符匹配单元,用于根据所述匹配规则获取所述样本库中与每一所述字符特征对应的一个验证字符;验证字符组合单元,用于根据所述字符特征的顺序对所述验证字符进行组合以得到与所述字符特征对应的验证码信息。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 combination unit is used to compare the verification character according to the sequence of the character features The combination is performed to obtain the verification code information corresponding to the character feature.
在一实施例中,所述验证字符匹配单元包括子单元:第一特征集获取单元、像素密度获取单元、第二特征集获取单元及验证字符确定单元。In an 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.
第一特征集获取单元,用于根据所述尺寸阈值获取所述样本库中尺寸比值与一个所述字符特征的尺寸比值相匹配的字符模板特征以得到第一特征集;像素密度获取单元,用于根据所述像素密度计算公式计算所述字符特征的第一像素密度及所述第一特征集中每一字符模板特征的第二像素密度;第二特征集获取单元,用于判断所述第一像素密度与所述每一所述第二像素密度之间的差值是否小于所述密度阈值,以获取差值小于所述密度阈值的字符模板特征作为第二特征集;验证字符确定单元,用于计算所述字符特征与所述第二特征集中的每一字符模板特征之间的匹配度,获取所述第二特征集中匹配度最高的一个字符模板特征对应的验证字符作为与所述字符特征对应验证字符。The first feature set obtaining unit is configured to obtain, according to the size threshold, the character template feature whose size ratio matches the size ratio of one of the character features in the sample library to obtain the first feature set; the pixel density obtaining unit uses The first pixel density of the character feature and the second pixel density of each character template feature in the first feature set are calculated according to the pixel density calculation formula; the second feature set acquisition unit is used to determine the first Whether the difference between the pixel density and each of the second pixel densities is less than the density threshold, so as to obtain the character template features whose difference is less than the density threshold as the second feature set; the verification character determination unit uses To calculate the matching degree between the character feature and each character template feature in the second feature set, obtain the verification character corresponding to the character template feature with the highest matching degree in the second feature set as the character feature Corresponding to the verification character.
验证信息反馈单元160,用于将所述待识别图像的标识信息与所述验证码信息的组合作为与所述待识别图像对应的验证信息反馈至所述管理服务器。The verification information feedback unit 160 is configured to feed back the 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.
在本申请实施例所提供的图形验证码识别装置应用上述图形验证码识别方法,根据图像处理规则对所输入的验证码图像进行数值化提取得到样本库,从来自管理服务器的待识别图像中确定对应的目标像素,从目标像素中分割得到包含单个字符的字符图像,对字符图像进行数值化得到与每一字符图像对应的字符特征,根据匹配规则获取样本库中与字符特征相匹配的验证码信息,将包含验证码信息的验证信息反馈至管理服务器。通过上述方法,可得到采用数值化形式进行存储的样本库,并基于所得到的样本库对待识别图像进行识别以得到验证码信息,相比采用字符图片进行图像验证码识别,可大幅减少样本库所需占用的存储空间,并提高对图形验证码进行识别的效率。In the graphic verification code recognition device provided by the embodiment of the application, the graphic verification code recognition method is applied to numerically extract the input verification code image according to the image processing rules to obtain a sample library, which is determined from the to-be-recognized image from the management server The corresponding target pixel is segmented from the target pixel to obtain a character image containing a single character, the character image is digitized to obtain the character feature corresponding to each character image, and the verification code matching the character feature in the sample library is obtained according to the matching rule Information, the verification information containing the verification code information is fed back to the management server. Through the above method, a sample library that is stored in a numerical form can be obtained, and based on the obtained sample library, the image to be recognized is recognized to obtain the verification code information. Compared with the use of character pictures for image verification code recognition, the sample library can be greatly reduced Need to occupy the storage space, and improve the efficiency of identifying the graphic verification code.
上述图形验证码识别装置可以实现为计算机程序的形式,该计算机程序可以在如图11所示的计算机设备上运行。The above-mentioned graphic verification code recognition device can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in FIG. 11.
请参阅图11,图11是本申请实施例提供的计算机设备的示意性框图。Please refer to FIG. 11, which is a schematic block diagram of a computer device according to an embodiment of the present application.
参阅图11,该计算机设备500包括通过系统总线501连接的处理器502、存储器和网络接口505,其中,存储器可以包括非易失性存储介质503和内存储器504。Referring to FIG. 11, the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
该非易失性存储介质503可存储操作系统5031和计算机程序5032。该计算机程序5032被执行时,可使得处理器502执行图形验证码识别方法。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 the graphic verification code identification method.
该处理器502用于提供计算和控制能力,支撑整个计算机设备500的运行。The processor 502 is used to provide calculation and control capabilities, and support the operation of the entire computer device 500.
该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序5032被处理器502执行时,可使得处理器502执行图形验证码识别方法。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 identification method.
该网络接口505用于进行网络通信,如提供数据信息的传输等。本领域技术人员可以理解,图11中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备500的限定,具体的计算机设备500可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。The network interface 505 is used for network communication, such as providing data information transmission. Those skilled in the art can understand that the structure shown in FIG. 11 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
其中,所述处理器502用于运行存储在存储器中的计算机程序5032,以实现上述的图形验证码识别方法中对应的功能。Wherein, the processor 502 is configured to run a computer program 5032 stored in the memory, so as to implement the corresponding function in the above-mentioned graphic verification code identification method.
本领域技术人员可以理解,图11中示出的计算机设备的实施例并不构成对计算机设备具体构成的限定,在其他实施例中,计算机设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。例如,在一些实施例中,计算机设备可以仅包括存储器及处理器,在这样的实施例中,存储器及处理器的结构及功能与图11所示实施例一致,在此不再赘述。Those skilled in the art can understand that the embodiment of the computer device shown in FIG. 11 does not constitute a limitation on the specific configuration of the computer device. In other embodiments, the computer device may include more or less components than those shown in the figure. Or some parts are combined, or different parts are arranged. For example, in some embodiments, the computer device may only include a memory and a processor. In such an embodiment, the structures and functions of the memory and the processor are consistent with the embodiment shown in FIG. 11, and will not be repeated here.
应当理解,在本申请实施例中,处理器502可以是中央处理单元(Central Processing Unit,CPU),该处理器502还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in this embodiment of the application, the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates 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.
在本申请的另一实施例中提供计算机可读存储介质。该计算机可读存储介质可以为非易失性的计算机可读存储介质,也可以是易失性的计算机可读存储介质。该计算机可读存储介质存储有计算机程序,其中计算机程序被处理器执行时实现上述的图形验证码识别方法中所包含的步骤。In another embodiment of the present application, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium, or may be a volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, where the computer program implements the steps included in the above-mentioned graphic verification code recognition method when the computer program is executed by the processor.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的设备、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the above-described equipment, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here. A person of ordinary skill in the art may be aware that the units and algorithm steps of the examples described in the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both, in order to clearly illustrate the hardware and software Interchangeability, in the above description, the composition and steps of each example have been generally described in accordance with the function. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为逻辑功能划分,实际实现时可以有另外的划分方式,也可以将具有相同功能的单元集 合成一个单元,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个计算机可读存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的计算机可读存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。In the several embodiments provided in this application, it should be understood that the disclosed equipment, device, and method may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, or the units with the same function may be combined into one. Units, for example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments of the present application. In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. 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 this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product can be stored in a computer. The read storage medium includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned computer-readable storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), magnetic disk or optical disk and other media that can store program codes. The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements, these modifications or replacements shall be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种图形验证码识别方法,其中,包括:A graphic verification code recognition method, which includes:
    若接收到用户所输入的验证码图像集,根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,所述样本库中包含多个验证字符及与每一验证字符对应的字符模板特征;If the verification code image set input by the user is received, all the verification code images contained in the verification code image set are numerically extracted according to the preset image processing rules to obtain a sample library corresponding to the verification code image set. The sample library contains multiple verification characters and character template features corresponding to each verification character;
    若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素;If an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel judgment rule in the image processing rule;
    根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像;Segmenting from 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;
    根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征;Digitize the character pixels in each of the character images according to the digitization rule in the image processing rules to obtain character features corresponding to each of the character images;
    根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符;Acquiring verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature, and the verification code information includes at least one verification character;
    将所述待识别图像的标识信息与所述验证码信息的组合作为与所述待识别图像对应的验证信息反馈至所述管理服务器。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 verification information corresponding to the image to be identified.
  2. 根据权利要求1所述的图形验证码识别方法,其中,所述图像处理规则包括像素判断规则及数值化规则,所述根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,包括:The method for recognizing a graphic verification code according to claim 1, wherein the image processing rule includes a pixel judgment rule and a digitization rule, and all verification codes contained in the verification code image set are processed according to a preset image processing rule. The image is extracted numerically to obtain a sample library corresponding to the captcha image set, including:
    根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素;Determine the effective pixels corresponding to each image according to the image information and pixel judgment rules of each verification code image in the verification code image set;
    根据每一所述图像中有效像素的位置信息提取包含所述有效像素的有效图像;Extracting an effective image including the effective pixels according to the position information of the effective pixels in each of the images;
    根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征。Perform digitization on each of the valid images according to the digitization rule to obtain character template characteristics corresponding to each of the verification code images.
  3. 根据权利要求2所述的图形验证码识别方法,其中,所述像素判断规则包括灰度化规则及灰度阈值,所述根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素,包括:The method for recognizing a graphic verification code according to claim 2, wherein the pixel judgment rule includes a gray scale rule and a gray threshold, and the judgment is based on the image information and pixel of each verification code image in the verification code image set The rules determine the effective pixels corresponding to each of the images, including:
    根据所述灰度化规则对每一个所述验证码图像进行灰度化以得到与每一所述验证码图像相匹配的灰度图像;Grayscale each of the verification code images according to the grayscale rule to obtain a grayscale image matching each of the verification code images;
    对所述灰度图像中所包含像素的灰度值是否大于所述灰度阈值进行判断,以获取灰度值不大于所述灰度阈值的像素;Judging whether the gray value of the pixels contained in the gray image is greater than the gray threshold value, so as to obtain pixels whose gray value is not greater than the gray threshold value;
    对所述灰度值不大于灰度阈值的每一像素是否孤立进行判断,以将孤立的像素从所述灰度值不大于灰度阈值的像素中剔除以得到所述有效像素。It is determined whether each pixel with the gray value not greater than the gray threshold is isolated, so as to remove the isolated pixels from the pixels with the gray value not greater than the gray threshold to obtain the effective pixel.
  4. 根据权利要求2所述的图形验证码识别方法,其中,所述根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征,包括:4. The graphic verification code recognition method according to claim 2, wherein the digitizing each of the valid images according to the digitization rule to obtain the character template characteristics corresponding to each of the verification code images includes :
    获取一张所述有效图像的尺寸信息,根据所述数值化规则生成与所述尺寸信息对应的尺 寸数组;Acquiring size information of the effective image, and generating a size array corresponding to the size information according to the digitization rule;
    获取所述有效图像中所有有效像素的坐标信息,根据所述数值化规则及所述坐标信息生成与每一所述有效像素对应的坐标数组;Acquiring coordinate information of all effective pixels in the effective image, and generating a coordinate array corresponding to each effective pixel according to the digitization rule and the coordinate information;
    将所述尺寸数组与所有所述坐标数组作为与所述有效图像对应的一验证码图像的字符模板特征。The size array and all the coordinate arrays are used as character template features of a verification code image corresponding to the valid image.
  5. 根据权利要求1所述的图形验证码识别方法,其中,所述根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像,包括:The method for recognizing a graphic verification code according to claim 1, wherein the segmenting to obtain a character image containing a single character from the target pixel according to a preset image adjustment rule and the position information of the target pixel comprises:
    根据所述目标像素中每一像素的位置信息获取所述目标像素中多个像素相连接而形成的像素区块;每一所述像素区块中均包含一个字符;Acquiring, 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; each of the pixel blocks includes 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 image is adjusted according to the image adjustment rule to obtain a character image corresponding to each segmented image.
  6. 根据权利要求1所述的图形验证码识别方法,其中,所述根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,包括:The method for recognizing a graphic verification code according to claim 1, wherein the obtaining verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature comprises:
    根据所述匹配规则获取所述样本库中与每一所述字符特征对应的一个验证字符;Obtaining a verification character corresponding to each character feature in the sample library according to the matching rule;
    根据所述字符特征的顺序对所述验证字符进行组合以得到与所述字符特征对应的验证码信息。The verification characters are combined according to the sequence of the character features to obtain verification code information corresponding to the character features.
  7. 根据权利要求6所述的图形验证码识别方法,其中,所述匹配规则中包括尺寸阈值、像素密度计算公式及密度阈值,所述根据所述匹配规则获取所述样本库中与每一所述字符特征对应的一个验证字符,包括:The method for recognizing a graphic verification code according to claim 6, wherein the matching rule includes a size threshold, a pixel density calculation formula, and a density threshold, and the sample library is obtained according to the matching rule. A verification character corresponding to the character feature, including:
    根据所述尺寸阈值获取所述样本库中尺寸比值与一个所述字符特征的尺寸比值相匹配的字符模板特征以得到第一特征集;Acquiring, according to the size threshold, a character template feature whose size ratio matches a size ratio of the character feature in the sample library 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;
    判断所述第一像素密度与所述每一所述第二像素密度之间的差值是否小于所述密度阈值,以获取差值小于所述密度阈值的字符模板特征作为第二特征集;Judging 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 difference is less than the density threshold as a second feature set;
    计算所述字符特征与所述第二特征集中的每一字符模板特征之间的匹配度,获取所述第二特征集中匹配度最高的一个字符模板特征对应的验证字符作为与所述字符特征对应验证字符。Calculate the matching degree between the character feature and each character template feature in the second feature set, and obtain the verification character corresponding to the character template feature with the highest matching degree in the second feature set as the corresponding character feature Verify characters.
  8. 一种图形验证码识别装置,包括:A graphic verification code recognition device, including:
    样本库构建单元,用于若接收到用户所输入的验证码图像集,根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,所述样本库中包含多个验证字符及与每一验证字符对应的字符模板特征;The sample library construction unit is used to, if the verification code image set input by the user is received, numerically extract all the verification code images contained in the verification code image set according to the preset image processing rules to obtain the verification code image set Corresponding sample library, the sample library includes a plurality of verification characters and character template characteristics corresponding to each verification character;
    目标像素确定单元,用于若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素;The target pixel determining unit is configured to, if an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel determination rule in the image processing rule;
    字符图像获取单元,用于根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像;A character image acquisition unit, configured 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;
    字符特征获取单元,用于根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征;A character feature acquiring unit, configured to digitize the character pixels in each character image according to the digitization rule in the image processing rule to obtain the character feature corresponding to each character image;
    验证码信息获取单元,用于根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符;The verification code information acquiring unit is configured to acquire verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature, and the verification code information includes at least one verification character ;
    验证信息反馈单元,用于将所述待识别图像的标识信息与所述验证码信息的组合作为与所述待识别图像对应的验证信息反馈至所述管理服务器。The verification information feedback unit is configured to feed back the 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.
  9. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下步骤:A computer device includes a memory, a processor, and a computer program stored on the memory and capable of running on the processor, wherein the processor implements the following steps when the processor executes the computer program:
    若接收到用户所输入的验证码图像集,根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,所述样本库中包含多个验证字符及与每一验证字符对应的字符模板特征;If the verification code image set input by the user is received, all the verification code images contained in the verification code image set are numerically extracted according to the preset image processing rules to obtain a sample library corresponding to the verification code image set. The sample library contains multiple verification characters and character template features corresponding to each verification character;
    若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素;If an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel judgment rule in the image processing rule;
    根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像;Segmenting from 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;
    根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征;Digitize the character pixels in each of the character images according to the digitization rule in the image processing rules to obtain character features corresponding to each of the character images;
    根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符;Acquiring verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature, and the verification code information includes at least one verification character;
    将所述待识别图像的标识信息与所述验证码信息的组合作为与所述待识别图像对应的验证信息反馈至所述管理服务器。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 verification information corresponding to the image to be identified.
  10. 根据权利要求9所述的计算机设备,其中,所述图像处理规则包括像素判断规则及数值化规则,所述根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,包括:9. The computer device according to claim 9, wherein the image processing rules include pixel judgment rules and digitization rules, and all the verification code images contained in the verification code image set are numerically evaluated according to the preset image processing rules. To obtain a sample library corresponding to the verification code image set, including:
    根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素;Determine the effective pixels corresponding to each image according to the image information and pixel judgment rules of each verification code image in the verification code image set;
    根据每一所述图像中有效像素的位置信息提取包含所述有效像素的有效图像;Extracting an effective image including the effective pixels according to the position information of the effective pixels in each of the images;
    根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征。Perform digitization on each of the valid images according to the digitization rule to obtain character template characteristics corresponding to each of the verification code images.
  11. 根据权利要求10所述的计算机设备,其中,所述像素判断规则包括灰度化规则及灰度阈值,所述根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素,包括:The computer device according to claim 10, wherein the pixel judgment rule includes a gray scale rule and a gray threshold, and the pixel judgment rule is determined according to the image information and pixel judgment rule of each verification code image in the verification code image set. The effective pixels corresponding to each of the images include:
    根据所述灰度化规则对每一个所述验证码图像进行灰度化以得到与每一所述验证码图像相匹配的灰度图像;Grayscale each of the verification code images according to the grayscale rule to obtain a grayscale image matching each of the verification code images;
    对所述灰度图像中所包含像素的灰度值是否大于所述灰度阈值进行判断,以获取灰度值不大于所述灰度阈值的像素;Judging whether the gray value of the pixels contained in the gray image is greater than the gray threshold value, so as to obtain pixels whose gray value is not greater than the gray threshold value;
    对所述灰度值不大于灰度阈值的每一像素是否孤立进行判断,以将孤立的像素从所述灰度值不大于灰度阈值的像素中剔除以得到所述有效像素。It is determined whether each pixel with the gray value not greater than the gray threshold is isolated, so as to remove the isolated pixels from the pixels with the gray value not greater than the gray threshold to obtain the effective pixel.
  12. 根据权利要求10所述的计算机设备,其中,所述根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征,包括:10. The computer device according to claim 10, wherein the digitizing each of the valid images according to the digitizing rule to obtain the character template characteristics corresponding to each of the verification code images comprises:
    获取一张所述有效图像的尺寸信息,根据所述数值化规则生成与所述尺寸信息对应的尺寸数组;Acquiring size information of the valid image, and generating a size array corresponding to the size information according to the digitization rule;
    获取所述有效图像中所有有效像素的坐标信息,根据所述数值化规则及所述坐标信息生成与每一所述有效像素对应的坐标数组;Acquiring coordinate information of all effective pixels in the effective image, and generating a coordinate array corresponding to each effective pixel according to the digitization rule and the coordinate information;
    将所述尺寸数组与所有所述坐标数组作为与所述有效图像对应的一验证码图像的字符模板特征。The size array and all the coordinate arrays are used as character template features of a verification code image corresponding to the valid image.
  13. 根据权利要求9所述的计算机设备,其中,所述根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像,包括:9. The computer device according to claim 9, wherein the segmenting to obtain a character image containing a single character from the target pixel according to a preset image adjustment rule and the position information of the target pixel comprises:
    根据所述目标像素中每一像素的位置信息获取所述目标像素中多个像素相连接而形成的像素区块;每一所述像素区块中均包含一个字符;Acquiring, 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; each of the pixel blocks includes 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 image is adjusted according to the image adjustment rule to obtain a character image corresponding to each segmented image.
  14. 根据权利要求9所述的计算机设备,其中,所述根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,包括:9. The computer device according to claim 9, wherein said obtaining the verification code information that matches the character feature in the sample library according to the preset matching rule and the character feature comprises:
    根据所述匹配规则获取所述样本库中与每一所述字符特征对应的一个验证字符;Obtaining a verification character corresponding to each character feature in the sample library according to the matching rule;
    根据所述字符特征的顺序对所述验证字符进行组合以得到与所述字符特征对应的验证码信息。The verification characters are combined according to the sequence of the character features to obtain verification code information corresponding to the character features.
  15. 根据权利要求14所述的计算机设备,其中,所述匹配规则中包括尺寸阈值、像素密度计算公式及密度阈值,所述根据所述匹配规则获取所述样本库中与每一所述字符特征对应的一个验证字符,包括:The computer device according to claim 14, wherein the matching rule includes a size threshold, a pixel density calculation formula, and a density threshold, and the sample library corresponding to each character feature in the sample library is obtained according to the matching rule A verification character of, including:
    根据所述尺寸阈值获取所述样本库中尺寸比值与一个所述字符特征的尺寸比值相匹配的字符模板特征以得到第一特征集;Acquiring, according to the size threshold, a character template feature whose size ratio matches a size ratio of the character feature in the sample library 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;
    判断所述第一像素密度与所述每一所述第二像素密度之间的差值是否小于所述密度阈值,以获取差值小于所述密度阈值的字符模板特征作为第二特征集;Judging 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 difference is less than the density threshold as a second feature set;
    计算所述字符特征与所述第二特征集中的每一字符模板特征之间的匹配度,获取所述第二特征集中匹配度最高的一个字符模板特征对应的验证字符作为与所述字符特征对应验证字 符。Calculate the matching degree between the character feature and each character template feature in the second feature set, and obtain the verification character corresponding to the character template feature with the highest matching degree in the second feature set as the corresponding character feature Verify characters.
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行以下操作:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the following operations:
    若接收到用户所输入的验证码图像集,根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,所述样本库中包含多个验证字符及与每一验证字符对应的字符模板特征;If the verification code image set input by the user is received, all the verification code images contained in the verification code image set are numerically extracted according to the preset image processing rules to obtain a sample library corresponding to the verification code image set. The sample library contains multiple verification characters and character template features corresponding to each verification character;
    若接收到来自管理服务器的待识别图像,根据所述图像处理规则中的像素判断规则确定与所述待识别图像对应的目标像素;If an image to be recognized from the management server is received, determine the target pixel corresponding to the image to be recognized according to the pixel judgment rule in the image processing rule;
    根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像;Segmenting from 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;
    根据所述图像处理规则中的数值化规则对每一所述字符图像中的字符像素进行数值化以得到与每一所述字符图像对应的字符特征;Digitize the character pixels in each of the character images according to the digitization rule in the image processing rules to obtain character features corresponding to each of the character images;
    根据预置的匹配规则及所述字符特征获取所述样本库中与所述字符特征相匹配的验证码信息,所述验证码信息中包含至少一个所述验证字符;Acquiring verification code information that matches the character feature in the sample library according to a preset matching rule and the character feature, and the verification code information includes at least one verification character;
    将所述待识别图像的标识信息与所述验证码信息的组合作为与所述待识别图像对应的验证信息反馈至所述管理服务器。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 verification information corresponding to the image to be identified.
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述图像处理规则包括像素判断规则及数值化规则,所述根据预置的图像处理规则对所述验证码图像集中包含的所有验证码图像进行数值化提取以得到与验证码图像集对应的样本库,包括:The computer-readable storage medium according to claim 16, wherein the image processing rules include pixel judgment rules and digitization rules, and the verification codes included in the verification code image set are processed according to the preset image processing rules. The image is extracted numerically to obtain a sample library corresponding to the captcha image set, including:
    根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素;Determine the effective pixels corresponding to each image according to the image information and pixel judgment rules of each verification code image in the verification code image set;
    根据每一所述图像中有效像素的位置信息提取包含所述有效像素的有效图像;Extracting an effective image including the effective pixels according to the position information of the effective pixels in each of the images;
    根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征。Perform digitization on each of the valid images according to the digitization rule to obtain character template characteristics corresponding to each of the verification code images.
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述像素判断规则包括灰度化规则及灰度阈值,所述根据所述验证码图像集中每一验证码图像的图像信息及像素判断规则确定与每一所述图像对应的有效像素,包括:The computer-readable storage medium according to claim 17, wherein the pixel judgment rule includes a grayscale rule and a grayscale threshold, and the judgment is based on the image information and pixel of each verification code image in the verification code image set The rules determine the effective pixels corresponding to each of the images, including:
    根据所述灰度化规则对每一个所述验证码图像进行灰度化以得到与每一所述验证码图像相匹配的灰度图像;Grayscale each of the verification code images according to the grayscale rule to obtain a grayscale image matching each of the verification code images;
    对所述灰度图像中所包含像素的灰度值是否大于所述灰度阈值进行判断,以获取灰度值不大于所述灰度阈值的像素;Judging whether the gray value of the pixels contained in the gray image is greater than the gray threshold value, so as to obtain pixels whose gray value is not greater than the gray threshold value;
    对所述灰度值不大于灰度阈值的每一像素是否孤立进行判断,以将孤立的像素从所述灰度值不大于灰度阈值的像素中剔除以得到所述有效像素。It is determined whether each pixel with the gray value not greater than the gray threshold is isolated, so as to remove the isolated pixels from the pixels with the gray value not greater than the gray threshold to obtain the effective pixel.
  19. 根据权利要求17所述的计算机可读存储介质,其中,所述根据所述数值化规则对每一所述有效图像进行数值化以得到与每一所述验证码图像对应的字符模板特征,包括:18. The computer-readable storage medium according to claim 17, wherein the digitizing each of the valid images according to the digitizing rule to obtain character template features corresponding to each of the verification code images includes :
    获取一张所述有效图像的尺寸信息,根据所述数值化规则生成与所述尺寸信息对应的尺 寸数组;Acquiring size information of the effective image, and generating a size array corresponding to the size information according to the digitization rule;
    获取所述有效图像中所有有效像素的坐标信息,根据所述数值化规则及所述坐标信息生成与每一所述有效像素对应的坐标数组;Acquiring coordinate information of all effective pixels in the effective image, and generating a coordinate array corresponding to each effective pixel according to the digitization rule and the coordinate information;
    将所述尺寸数组与所有所述坐标数组作为与所述有效图像对应的一验证码图像的字符模板特征。The size array and all the coordinate arrays are used as character template features of a verification code image corresponding to the valid image.
  20. 根据权利要求16所述的计算机可读存储介质,其中,所述根据预置的图像调整规则及所述目标像素的位置信息从所述目标像素中分割得到包含单个字符的字符图像,包括:15. The computer-readable storage medium according to claim 16, wherein the segmenting to obtain a character image containing a single character from the target pixel according to a preset image adjustment rule and the position information of the target pixel comprises:
    根据所述目标像素中每一像素的位置信息获取所述目标像素中多个像素相连接而形成的像素区块;每一所述像素区块中均包含一个字符;Acquiring, 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; each of the pixel blocks includes 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 image is adjusted according to the image adjustment rule to obtain a character image corresponding to each segmented image.
PCT/CN2020/131758 2020-09-04 2020-11-26 Graphical captcha recognition method, apparatus, computer device, and storage medium WO2021159802A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010921075.9A CN112035821A (en) 2020-09-04 2020-09-04 Method and device for identifying graphic verification code, computer equipment and storage medium
CN202010921075.9 2020-09-04

Publications (1)

Publication Number Publication Date
WO2021159802A1 true WO2021159802A1 (en) 2021-08-19

Family

ID=73591436

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/131758 WO2021159802A1 (en) 2020-09-04 2020-11-26 Graphical captcha recognition method, apparatus, computer device, and storage medium

Country Status (2)

Country Link
CN (1) CN112035821A (en)
WO (1) WO2021159802A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114943063A (en) * 2022-03-04 2022-08-26 杭州京胜航星科技有限公司 Electronic seal generating and identifying system based on Internet

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112529004A (en) * 2020-12-08 2021-03-19 平安科技(深圳)有限公司 Intelligent image recognition method and device, computer equipment and storage medium
CN115223293B (en) * 2022-07-14 2023-06-02 深圳诺博医疗科技有限公司 Taking verification method, device, system and equipment for consumable cabinet

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104021376A (en) * 2014-06-05 2014-09-03 北京乐动卓越科技有限公司 Verification code identifying method and device
CN107273890A (en) * 2017-05-26 2017-10-20 亿海蓝(北京)数据技术股份公司 Graphical verification code recognition methods and device for character combination
US20170308768A1 (en) * 2015-01-15 2017-10-26 Suntront Tech Co., Ltd Character information recognition method based on image processing
CN110363195A (en) * 2019-06-18 2019-10-22 深圳壹账通智能科技有限公司 Graphical verification code recognition methods, device, readable storage medium storing program for executing and terminal device
CN111274957A (en) * 2020-01-20 2020-06-12 阳光人寿保险股份有限公司 Webpage verification code identification method, device, terminal and computer storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8331670B2 (en) * 2011-03-22 2012-12-11 Konica Minolta Laboratory U.S.A., Inc. Method of detection document alteration by comparing characters using shape features of characters
CN105117704B (en) * 2015-08-25 2018-05-29 电子科技大学 A kind of text image consistency comparison method based on multiple features
CN107067006B (en) * 2017-04-20 2022-03-18 金电联行(北京)信息技术有限公司 Verification code identification method and system serving for data acquisition
CN108563559A (en) * 2018-03-12 2018-09-21 平安普惠企业管理有限公司 A kind of test method of identifying code, device, terminal device and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104021376A (en) * 2014-06-05 2014-09-03 北京乐动卓越科技有限公司 Verification code identifying method and device
US20170308768A1 (en) * 2015-01-15 2017-10-26 Suntront Tech Co., Ltd Character information recognition method based on image processing
CN107273890A (en) * 2017-05-26 2017-10-20 亿海蓝(北京)数据技术股份公司 Graphical verification code recognition methods and device for character combination
CN110363195A (en) * 2019-06-18 2019-10-22 深圳壹账通智能科技有限公司 Graphical verification code recognition methods, device, readable storage medium storing program for executing and terminal device
CN111274957A (en) * 2020-01-20 2020-06-12 阳光人寿保险股份有限公司 Webpage verification code identification method, device, terminal and computer storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114943063A (en) * 2022-03-04 2022-08-26 杭州京胜航星科技有限公司 Electronic seal generating and identifying system based on Internet
CN114943063B (en) * 2022-03-04 2023-04-07 杭州京胜航星科技有限公司 Electronic seal generation and recognition system based on Internet

Also Published As

Publication number Publication date
CN112035821A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
WO2022121218A1 (en) Intelligent image recognition method and apparatus, and computer device and storage medium
WO2021159802A1 (en) Graphical captcha recognition method, apparatus, computer device, and storage medium
CN106529380B (en) Image recognition method and device
JP4505362B2 (en) Red-eye detection apparatus and method, and program
US20150339526A1 (en) Systems and methods for classifying objects in digital images captured using mobile devices
US20100033745A1 (en) Image processing method and apparatus
EP2806374A1 (en) Method and system for automatic selection of one or more image processing algorithm
WO2014160433A2 (en) Systems and methods for classifying objects in digital images captured using mobile devices
CN108255555B (en) A kind of system language switching method and terminal device
EP3756130B1 (en) Image hidden information detector
CN112651953B (en) Picture similarity calculation method and device, computer equipment and storage medium
JP2005309608A (en) Character recognition result output device, character recognition device, its method and program
Scherhag et al. Face morph detection for unknown morphing algorithms and image sources: a multi‐scale block local binary pattern fusion approach
JP6882362B2 (en) Systems and methods for identifying images, including identification documents
CN111507957A (en) Identity card picture conversion method and device, computer equipment and storage medium
CN111027545A (en) Card picture mark detection method and device, computer equipment and storage medium
Wang et al. Image sharpening detection based on difference sets
CN110895811A (en) Image tampering detection method and device
CN114120001A (en) Health code identification method and device, computer equipment and storage medium
RU2453919C1 (en) Method of detecting spam in bitmap image
CN111803956B (en) Method and device for determining game plug-in behavior, electronic equipment and storage medium
JP4967045B2 (en) Background discriminating apparatus, method and program
JP2006252562A (en) Image recognition method
CN114973276A (en) Handwritten character detection method and device and electronic equipment
WO2017128273A1 (en) Error block determination

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20918916

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205N DATED 28-04-2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20918916

Country of ref document: EP

Kind code of ref document: A1