CN114494474B - Generation method, verification method and device of universal verification code of human and legal equipment - Google Patents
Generation method, verification method and device of universal verification code of human and legal equipment Download PDFInfo
- Publication number
- CN114494474B CN114494474B CN202210051928.7A CN202210051928A CN114494474B CN 114494474 B CN114494474 B CN 114494474B CN 202210051928 A CN202210051928 A CN 202210051928A CN 114494474 B CN114494474 B CN 114494474B
- Authority
- CN
- China
- Prior art keywords
- verification code
- picture
- time
- area
- verification
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T9/00—Image coding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/30—Authentication, i.e. establishing the identity or authorisation of security principals
- G06F21/31—User authentication
- G06F21/36—User authentication by graphic or iconic representation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
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 Processing (AREA)
Abstract
本发明公开了一种人与合法设备通用验证码的生成方法、验证方法及装置,包括:生成验证码的第一背景图片,并存储相应的生成时间;对所述生成时间采用编码规则进行编码,获得生成时间对应的编码数据;将第一背景图片中划分出多个时间区域图片,并对时间区域图片预处理,获得第二背景图片;对第二背景图片进行区域划分,获得验证码字符区域图片,并在验证码字符区域图片内,随机生成验证码字符,并在验证码字符区域图片内,随机生成验证码字符,再对验证码字符添加干扰规则,获得人与合法设备通用验证码,实现人与合法设备通用的验证。本发明生成的验证码,不但能够实现人与合法设备之间通用,而且还能使得设备的识别速度更快,认证效率高。
The invention discloses a generation method, a verification method and a device for a universal verification code for a person and a legal device, comprising: generating a first background picture of the verification code, and storing the corresponding generation time; encoding the generation time by using an encoding rule , obtain the coded data corresponding to the generation time; divide the first background picture into multiple time area pictures, and preprocess the time area pictures to obtain the second background picture; perform regional division on the second background picture to obtain the verification code characters Area picture, and randomly generate verification code characters in the verification code character area picture, and randomly generate verification code characters in the verification code character area picture, and then add interference rules to the verification code characters to obtain a general verification code for people and legal devices , to achieve universal verification between people and legal devices. The verification code generated by the invention can not only realize common use between people and legal devices, but also can make the identification speed of the device faster and the authentication efficiency high.
Description
技术领域technical field
本发明涉及图像处理技术领域,尤其涉及一种人与合法设备通用验证码的生成方法、验证方法及装置。The invention relates to the technical field of image processing, and in particular, to a method for generating a verification code, a verification method and a device for common verification codes between people and legal devices.
背景技术Background technique
验证码就是将一串随机产生的数字或者符号,生成一幅图片,图片里加入一些干扰因素,由用户肉眼识别其中的字符信息,输入表单提交到网站验证,验证成功才能使用某项功能。A verification code is to generate a picture from a string of randomly generated numbers or symbols, add some interference factors to the picture, and identify the character information with the naked eye of the user, enter the form and submit it to the website for verification, and a certain function can be used only after the verification is successful.
验证码图片的识别:验证码技术从设计之初就是为了区分人与计算机,通过利用人脑的不可模拟性,来对验证码进行识别。计算机识别难度较大,而人可以轻易识别。设备要对验证码图片进行识别,一般需要按照以下顺序的处理:灰度化、二值化、去噪、字符分割和字符识别。灰度化处理是指把含有亮度和色彩的彩色图像变换成灰度图像的过程;字符分割是在验证码图片中,以验证码字符为目标对验证码图片进行分割,最后得到若干个验证码字符图像。Recognition of captcha images: Captcha technology is designed to distinguish between humans and computers from the very beginning, and to identify the captcha by using the imitability of the human brain. Computer identification is more difficult, but people can easily identify. To recognize the verification code picture, the device generally needs to process in the following order: grayscale, binarization, denoising, character segmentation and character recognition. Grayscale processing refers to the process of converting a color image containing brightness and color into a grayscale image; character segmentation is to segment the verification code image in the verification code picture with the verification code characters as the target, and finally obtain several verification codes. character image.
在现有图像验证码识别方法中,识别过程复杂,效率不高,在较多干扰条件下难以达到人识别验证码的准确率。In the existing image verification code recognition methods, the recognition process is complex and the efficiency is not high, and it is difficult to achieve the accuracy of the human recognition verification code under many interference conditions.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于提供一种图片验证码的生成方法、验证方法以及相应装置,以解决上述背景技术中的问题。The purpose of the present invention is to provide a method for generating a picture verification code, a verification method and a corresponding device, so as to solve the above-mentioned problems in the background art.
为实现上述目的,本发明提供一种图片验证码的生成方法,包括:To achieve the above purpose, the present invention provides a method for generating a picture verification code, comprising:
生成验证码的第一背景图片,并存储所述第一背景图片的生成时间数据;Generate the first background picture of the verification code, and store the generation time data of the first background picture;
对所述生成时间数据采用预设的编码规则进行编码,获得所述生成时间数据对应的时间编码数据;Encoding the generation time data by using a preset coding rule, and obtaining time encoding data corresponding to the generation time data;
将所述第一背景图片中划分出多个时间区域图片,并根据所述时间编码数据对每个所述时间区域图片预处理,获得第二背景图片;dividing the first background picture into a plurality of time zone pictures, and preprocessing each of the time zone pictures according to the time coding data to obtain a second background picture;
对所述第二背景图片进行区域划分,获得多个验证码字符区域图片,并在每个所述验证码字符区域图片内,随机生成验证码字符,再对所述验证码字符添加预设的干扰规则,获得人与合法设备通用验证码。The second background picture is divided into regions, and a plurality of verification code character area pictures are obtained, and in each of the verification code character area pictures, a verification code character is randomly generated, and a preset verification code character is added to the verification code character. Interfere with the rules and obtain universal verification codes for people and legitimate devices.
进一步,作为优选地,所述对所述生成时间采用预设的编码规则进行编码,获得所述生成时间对应的时间编码,包括:Further, preferably, the generation time is encoded using a preset encoding rule, and the time code corresponding to the generation time is obtained, including:
将所述生成时间数据进行预处理,获得第二生成时间数据;其中,所述预处理包括:对所述生成时间进行划分为年数、月数、日数和第一分钟数,其中,所述第一分钟数包括小时数和分钟数;将所述年数和所述第一分钟数相加,在与所述月数和日数进行组合,获得第二生成时间数据;Preprocessing the generation time data to obtain second generation time data; wherein, the preprocessing includes: dividing the generation time into years, months, days, and first minutes, wherein the first The number of one minute includes the number of hours and the number of minutes; adding the number of years and the number of the first minutes, and combining with the number of months and days, the second generation time data is obtained;
将所述第二生成时间数据除以一个预设的数值,获得第三生成时间数据;其中,所述预设的数据为四位数及以上的数值;Dividing the second generation time data by a preset value to obtain the third generation time data; wherein, the preset data is a value of four digits and above;
将所述第三生成时间数据的整数部分和小数部分的前四位的数值进行相加,获得相加的结果,并将所述相加的结果的前四位作为所述生成时间数据对应时间编码。The integer part of the third generation time data and the numerical value of the first four digits of the decimal part are added to obtain the result of addition, and the first four digits of the result of the addition are used as the corresponding time of the generation time data coding.
进一步,作为优选地,所述将所述第一背景图片中划分出多个时间区域图片,并根据所述时间编码数据对所述每个背景图片时间区域预处理,获得第二背景图片,包括:Further, preferably, the first background picture is divided into a plurality of time area pictures, and the time area of each background picture is preprocessed according to the time coding data to obtain a second background picture, including :
将所述第一背景图片中划分出多个第一时间区域图片,并对每个所述时间区域图片按照预设的规则进行灰度化和二值化处理,获得多个第二时间区域图片;Divide the first background picture into a plurality of first time region pictures, and perform grayscale and binarization processing on each of the time region pictures according to preset rules to obtain a plurality of second time region pictures ;
根据所述时间编码数据和所述第二时间区域图片中的黑色像素点个数,对所述第一时间区域图片的像素点的RGB值进行调整处理,使得多个背景图片时间区域经过按照预设的规则进行灰度化和二值化处理后的黑色像素点个数与所述时间编码数据相对应;According to the time-encoded data and the number of black pixels in the second time-area picture, the RGB values of the pixels in the first time-area picture are adjusted, so that the time-area of the background pictures are processed according to the predetermined time area. The number of black pixels after grayscale and binarization processing according to the set rule corresponds to the time-coded data;
将所述经过调整处理后的第一时间区域图片作为最终的时间区域图片,并结合第一背景图片中没有被划分的图片区域部分,构成第二背景图片。The adjusted first time region picture is used as the final time region picture, and combined with the undivided picture region parts in the first background picture, a second background picture is formed.
进一步,作为优选地,所述对所述第二背景图片进行区域划分,获得多个验证码字符区域图片,并在每个所述验证码字符区域图片内,随机生成验证码字符,再对所述验证码字符添加预设的干扰规则,获得人与合法设备通用的验证码,包括:Further, preferably, the second background picture is divided into regions, a plurality of verification code character region pictures are obtained, and in each of the verification code character region pictures, the verification code characters are randomly generated, and then all verification code characters are randomly generated. Add preset interference rules to the above verification code characters to obtain verification codes common to people and legal devices, including:
预先构建验证码字符表,所述验证码字符表中包括:验证码字符以及验证码字符对应的黑色像素点个数;Build a verification code character table in advance, and the verification code character table includes: verification code characters and the number of black pixels corresponding to the verification code characters;
对所述第二背景图片进行区域划分,获得多个验证码字符区域图片;The second background picture is divided into regions to obtain a plurality of verification code character region pictures;
从所述验证码字符表中随机挑选字符,写入每个所述验证码字符区域图片内,并添加干扰噪声点和干扰线;Characters are randomly selected from the verification code character table, written into each of the verification code character area pictures, and interference noise points and interference lines are added;
对所述验证码字符区域图片中的像素点的RGB值进行调整处理,使得验证码字符区域图片经过按照预设的规则进行灰度化和二值化处理后的黑色像素点个数与所述验证码字符对应的黑色像素点个数相等;The RGB values of the pixels in the verification code character area picture are adjusted and processed, so that the number of black pixels after the verification code character area picture is grayed and binarized according to preset rules is the same as the number of black pixels in the verification code character area picture. The number of black pixels corresponding to the verification code characters is equal;
将所述经过调整处理后的验证码字符区域图片作为最终的验证码字符区域图片,并结合所述第二背景图片的其他区域部分,构成人与合法设备通用验证码。The adjusted verification code character area picture is used as the final verification code character area picture, and combined with other areas of the second background picture, to form a general verification code for people and legal devices.
本发明还提供一种人与合法设备通用验证码的验证方法,应用于上述任意一项所述的人与合法设备通用验证码的生成方法所生成的验证码进行验证,所述验证方法包括:The present invention also provides a verification method for a universal verification code for a person and a legal device, which is applied to the verification code generated by the method for generating a universal verification code for a person and a legal device described in any one of the above for verification, and the verification method includes:
根据预设的注册规则,生成合法设备,并获取验证码图片的信息数据,所述信息数据包括:验证码图片的灰度化参数、二值化参数、验证码图片的区域划分信息以及验证码字符关联表;According to the preset registration rules, a legal device is generated, and the information data of the verification code picture is obtained, and the information data includes: the grayscale parameter of the verification code picture, the binarization parameter, the area division information of the verification code picture, and the verification code. character association table;
根据所述验证码图片的区域划分信息和验证码图片的灰度化参数、二值化参数,获取验证码背景图片的生成时间的对应时间编码;According to the area division information of the verification code picture and the grayscale parameter and the binarization parameter of the verification code picture, obtain the corresponding time code of the generation time of the verification code background picture;
根据所述验证码图片的灰度化参数、二值化参数、验证码图片的区域划分信息以及验证码字符关联表,获取验证码的字符;Obtain the characters of the verification code according to the grayscale parameter, the binarization parameter of the verification code picture, the area division information of the verification code picture, and the verification code character association table;
根据所述验证码背景图片的生成时间和所述验证码的字符,判断所述验证码是否正确。According to the generation time of the background picture of the verification code and the characters of the verification code, it is judged whether the verification code is correct.
本发明还提供一种验证码的生成装置,包括:生成模块、编码模块、预处理模块和获取模块,其中;The present invention also provides a verification code generation device, comprising: a generation module, an encoding module, a preprocessing module and an acquisition module, wherein;
所述生成模块,用于生成验证码的第一背景图片,并存储所述第一背景图片的生成时间数据;The generation module is used to generate the first background picture of the verification code, and store the generation time data of the first background picture;
所述编码模块,用于对所述生成时间数据采用预设的编码规则进行编码,获得所述生成时间数据对应的时间编码数据;The encoding module is used to encode the generation time data using a preset encoding rule, and obtain time encoding data corresponding to the generation time data;
所述预处理模块,用于将所述第一背景图片中划分出多个时间区域图片,并根据所述时间编码数据对每个所述时间区域图片预处理,获得第二背景图片;The preprocessing module is configured to divide the first background picture into a plurality of time region pictures, and preprocess each of the time region pictures according to the time coding data to obtain a second background picture;
所述获取模块,用于对所述第二背景图片进行区域划分,获得多个验证码字符区域图片,并在每个所述验证码字符区域图片内,随机生成验证码字符,再对所述验证码字符添加预设的干扰规则,获得人与合法设备通用验证码。The obtaining module is configured to perform area division on the second background picture, obtain a plurality of verification code character area pictures, and randomly generate a verification code character in each of the verification code character area pictures, and then analyze the verification code characters. Preset interference rules are added to the verification code characters to obtain a universal verification code for people and legal devices.
进一步,作为优选地,所述编码模块,具体用于:Further, as preferably, the encoding module is specifically used for:
将所述生成时间数据进行预处理,获得第二生成时间数据;其中,所述预处理包括:对所述生成时间进行划分为年数、月数、日数和第一分钟数,其中,所述第一分钟数包括小时数和分钟数;将所述年数和所述第一分钟数相加,在与所述月数和日数进行组合,获得第二生成时间数据;Preprocessing the generation time data to obtain second generation time data; wherein, the preprocessing includes: dividing the generation time into years, months, days, and first minutes, wherein the first The number of one minute includes the number of hours and the number of minutes; adding the number of years and the number of the first minutes, and combining with the number of months and days, the second generation time data is obtained;
将所述第二生成时间数据除以一个预设的数值,获得第三生成时间数据;其中,所述预设的数据为四位数及以上的数值;Dividing the second generation time data by a preset value to obtain the third generation time data; wherein, the preset data is a value of four digits and above;
将所述第三生成时间数据的整数部分和小数部分的前四位的数值进行相加,获得相加的结果,并将所述相加的结果的前四位作为所述生成时间数据对应时间编码。The integer part of the third generation time data and the numerical value of the first four digits of the decimal part are added to obtain the result of addition, and the first four digits of the result of the addition are used as the corresponding time of the generation time data coding.
进一步,作为优选地,所述预处理模块,具体用于:Further, preferably, the preprocessing module is specifically used for:
将所述第一背景图片中划分出多个第一时间区域图片,并对每个所述时间区域图片按照预设的规则进行灰度化和二值化处理,获得多个第二时间区域图片;Divide the first background picture into a plurality of first time region pictures, and perform grayscale and binarization processing on each of the time region pictures according to preset rules to obtain a plurality of second time region pictures ;
根据所述时间编码数据和所述第二时间区域图片中的黑色像素点个数,对所述第一时间区域图片的像素点的RGB值进行调整处理,使得多个背景图片时间区域经过按照预设的规则进行灰度化和二值化处理后的黑色像素点个数与所述时间编码数据相对应;According to the time-encoded data and the number of black pixels in the second time-area picture, the RGB values of the pixels in the first time-area picture are adjusted, so that the time-area of the background pictures are processed according to the predetermined time area. The number of black pixels after grayscale and binarization processing according to the set rule corresponds to the time-coded data;
将所述经过调整处理后的第一时间区域图片作为最终的时间区域图片,并结合第一背景图片中没有被划分的图片区域部分,构成第二背景图片。The adjusted first time region picture is used as the final time region picture, and combined with the undivided picture region parts in the first background picture, a second background picture is formed.
进一步,作为优选地,所述获取模块,具体用于:Further, as preferably, the acquisition module is specifically used for:
预先构建验证码字符表,所述验证码字符表中包括:验证码字符以及验证码字符对应的黑色像素点个数;Build a verification code character table in advance, and the verification code character table includes: verification code characters and the number of black pixels corresponding to the verification code characters;
对所述第二背景图片进行区域划分,获得多个验证码字符区域图片;The second background picture is divided into regions to obtain a plurality of verification code character region pictures;
从所述验证码字符表中随机挑选字符,写入每个所述验证码字符区域图片内,并添加干扰噪声点和干扰线;Characters are randomly selected from the verification code character table, written into each of the verification code character area pictures, and interference noise points and interference lines are added;
对所述验证码字符区域图片中的像素点的RGB值进行调整处理,使得验证码字符区域图片经过按照预设的规则进行灰度化和二值化处理后的黑色像素点个数与所述验证码字符对应的黑色像素点个数相等;The RGB values of the pixels in the verification code character area picture are adjusted and processed, so that the number of black pixels after the verification code character area picture is grayed and binarized according to preset rules is the same as the number of black pixels in the verification code character area picture. The number of black pixels corresponding to the verification code characters is equal;
将所述经过调整处理后的验证码字符区域图片作为最终的验证码字符区域图片,并结合所述第二背景图片的其他区域部分,构成人与合法设备通用验证码。The adjusted verification code character area picture is used as the final verification code character area picture, and combined with other areas of the second background picture, to form a general verification code for people and legal devices.
本发明还提供一种人与合法设备通用验证码的验证装置,包括:获取模块、时间编码模块、字符模块和验证模块,其中:The present invention also provides a verification device for a universal verification code for people and legal equipment, comprising: an acquisition module, a time encoding module, a character module and a verification module, wherein:
所述获取模块,用于根据预设的注册规则,生成合法设备,并获取验证码图片的信息数据,所述信息数据包括:验证码图片的灰度化参数、二值化参数、验证码图片的区域划分信息以及验证码字符关联表;The acquisition module is used for generating legal devices according to preset registration rules, and acquiring information data of the verification code picture, the information data including: grayscale parameters, binarization parameters, and verification code pictures of the verification code picture The area division information and the verification code character association table;
所述解码模块,用于根据所述验证码图片的区域划分信息和验证码图片的灰度化参数、二值化参数,获取验证码背景图片的生成时间的对应时间编码;The decoding module is configured to obtain the corresponding time code of the generation time of the background picture of the verification code according to the area division information of the verification code picture and the grayscale parameter and the binarization parameter of the verification code picture;
所述字符模块,用于根据所述验证码图片的灰度化参数、二值化参数、验证码图片的区域划分信息以及验证码字符关联表,获取验证码的字符;The character module is used to obtain the characters of the verification code according to the grayscale parameter, the binarization parameter of the verification code picture, the area division information of the verification code picture, and the verification code character association table;
所述验证模块,用于根据所述验证码背景图片的生成时间和所述验证码的字符,判断所述验证码是否正确。The verification module is configured to determine whether the verification code is correct according to the generation time of the verification code background picture and the characters of the verification code.
相对于现有技术,本发明的有益效果在于:Compared with the prior art, the beneficial effects of the present invention are:
1、人可以通过肉眼识别验证码图片得到验证码字符信息,设备也可对验证码图片通过一系列处理识别得到验证码字符信息,这样人和设备就得到相同的验证码信息,最终达到人与设备可以通用的身份认证方法。将验证码作为人与合法设备通用的身份认证方法,与现有技术中用户密码、智能卡等对比,更为安全。1. People can obtain the verification code character information by identifying the verification code picture with the naked eye, and the device can also obtain the verification code character information through a series of processing and identification of the verification code picture, so that people and devices can obtain the same verification code information, and finally achieve a human-to-human relationship. Devices can use a common authentication method. Using the verification code as a common identity authentication method for people and legal devices is more secure compared with user passwords and smart cards in the prior art.
2、与上述基于设备身份认证技术相比,验证码技术在设备的身份认证过程中,设备要识别出验证码信息返回至服务器,服务器先对验证码信息进行验证,在对设备的账号密码进行验证,有效降低服务器处理的工作量,可以更好的验证设备的真实身份,防止攻击者进行暴力攻击。2. Compared with the above-mentioned device-based authentication technology, the verification code technology needs to identify the verification code information and return it to the server in the process of device identity authentication. Verification effectively reduces the workload of the server, can better verify the true identity of the device, and prevent attackers from conducting brute force attacks.
3、与验证码直接运用在身份认证系统不能抵抗重放攻击、假冒服务器相比,本发明利用当前时间的转化为时间编码,写入到验证码图片的四个边角上,作为后面验证码图片生成的基础。设备在身份认证过程先对验证码图片四个边角进行识别得到时间编码,设备基于设备当前时间、当前时间向前推一分钟生成两个时间编码。识别到的时间编码与设备生成的两个时间编码进行验证,只要设备生成时间编码的有其中一个验证通过,才继续对验证码图片进行识别验证码信息流程,否则就结束身份认证流程,可以有效的防止出现假冒服务器和重放攻击。最终实现了双向认证,可以有效的抵抗重放攻击、假冒服务器等。3. Compared with the verification code that is directly used in the identity authentication system and cannot resist replay attacks and counterfeit servers, the present invention utilizes the conversion of the current time to time code, and writes it on the four corners of the verification code picture as the verification code behind. The basis for image generation. During the identity authentication process, the device first identifies the four corners of the verification code picture to obtain the time code. The device generates two time codes based on the current time of the device and the current time is pushed forward by one minute. The recognized time code is verified with the two time codes generated by the device. As long as one of the time codes generated by the device passes the verification, the verification code information process will continue to be performed on the verification code picture. Otherwise, the identity authentication process will end, and it will be effective. to prevent spoofing servers and replay attacks. Finally, two-way authentication is realized, which can effectively resist replay attacks and fake servers.
4、与现有技术中相比,现有技术将添加的干扰信息,是当作无效信息进行处理。本发明在验证码图片生成的过程中,将噪声点、干扰线添加进验证码图片的干扰信息,是后续图片进行识别的特征之一。噪声点和干扰线是有效的信息,会使得其他设备识别难度增加,提高了验证码图片身份认证的安全性。4. Compared with the prior art, the prior art treats the added interference information as invalid information. In the present invention, in the process of generating the verification code picture, noise points and interference lines are added to the interference information of the verification code picture, which is one of the characteristics of identifying the subsequent pictures. Noise points and interference lines are effective information, which will make it more difficult for other devices to identify, and improve the security of verification code image authentication.
5、与现有的验证码图片识别相比,现有的验证码图片识别需要经历:灰度化、二值化、去噪、图像分割和字符识别。而本发明的识别过程是:区域划分、灰度化、二值化和字符匹配。本发明的识别过程省去了去噪处理,并且对验证码图片的顺序进行修改。先对验证码图片进行区域划分,后面只需要对划分出的区域图片进行灰度化、二值化处理,不用对整个验证码图片进行灰度化、二值化处理,使得设备的识别速度更快,认证效率高,而且有效的防止OCR技术的识别破解。5. Compared with the existing verification code image recognition, the existing verification code image recognition needs to go through: grayscale, binarization, denoising, image segmentation and character recognition. The identification process of the present invention is: area division, gray scale, binarization and character matching. The identification process of the present invention omits the denoising process and modifies the sequence of the verification code pictures. First, divide the verification code picture into regions, and then only need to perform grayscale and binarization processing on the divided regional pictures, and do not need to grayscale and binarize the entire verification code picture, so that the recognition speed of the device is faster. It is fast, has high authentication efficiency, and effectively prevents the identification and cracking of OCR technology.
6、在区域划分和字符识别中,根据双方约定的规则,在设定好的区域中对图片进行区域划分、灰度化处理、二值化处理,最后生成黑白图像,并通过对黑白中的黑色像素点进行计数,将得到的像素点数与设定规则中的字符关联表对应起来,来确定是什么字符。配对方便快捷,不需要对字符进行模板匹配等操作,设备操作起来,更快速有效。6. In the area division and character recognition, according to the rules agreed by both parties, the image is divided into areas, grayscaled, and binarized in the set area, and finally a black and white image is generated. The black pixels are counted, and the number of pixels obtained corresponds to the character association table in the setting rule to determine what character it is. The pairing is convenient and fast, and there is no need to perform template matching and other operations on the characters, and the device is faster and more effective to operate.
附图说明Description of drawings
为了更清楚地说明本发明的技术方案,下面将对实施方式中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions of the present invention more clearly, the following will briefly introduce the accompanying drawings used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention, which are common in the art. As far as technical personnel are concerned, other drawings can also be obtained based on these drawings without any creative effort.
图1是本发明某一实施例提供的验证码的生成方法的流程示意图;1 is a schematic flowchart of a method for generating a verification code according to an embodiment of the present invention;
图2是本发明某一实施例提供的验证码的验证方法的流程示意图;2 is a schematic flowchart of a verification method for a verification code provided by an embodiment of the present invention;
图3是本发明某一实施例提供的验证码的生成装置的结构示意图;3 is a schematic structural diagram of an apparatus for generating a verification code provided by an embodiment of the present invention;
图4是本发明某一实施例提供的验证码的验证装置的结构示意图。FIG. 4 is a schematic structural diagram of an apparatus for verifying a verification code provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
应当理解,文中所使用的步骤编号仅是为了方便描述,不对作为对步骤执行先后顺序的限定。It should be understood that the step numbers used in the text are only for the convenience of description, and are not intended to limit the order in which the steps are performed.
应当理解,在本发明说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本发明。如在本发明说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should be understood that the terms used in the present specification are only for the purpose of describing particular embodiments and are not intended to limit the present invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural unless the context clearly dictates otherwise.
术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。The terms "comprising" and "comprising" indicate the presence of the described features, integers, steps, operations, elements and/or components, but do not exclude one or more other features, integers, steps, operations, elements, components and/or the existence or addition of its collection.
术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。The term "and/or" refers to and including any and all possible combinations of one or more of the associated listed items.
请参阅图1,本发明某一实施例提供一种图片验证码的生成方法。如图1所示,该图片验证码的生成方法包括步骤S10至步骤S40。各步骤具体如下:Referring to FIG. 1, an embodiment of the present invention provides a method for generating a picture verification code. As shown in FIG. 1 , the method for generating a picture verification code includes steps S10 to S40. The specific steps are as follows:
S10、生成验证码的第一背景图片,并存储所述第一背景图片的生成时间数据。S10. Generate a first background picture of the verification code, and store the generation time data of the first background picture.
具体地,响应设备或者用户发起身份认证请求,服务器接收到身份认证请求后,读取服务器随机生成或者储存的图片,作为验证码的第一背景图片,并存储所述第一背景图片的生成时间数据。Specifically, in response to the identity authentication request initiated by the device or the user, after the server receives the identity authentication request, the server reads the image randomly generated or stored by the server as the first background image of the verification code, and stores the generation time of the first background image. data.
S20、对所述生成时间数据采用预设的编码规则进行编码,获得所述生成时间数据对应的时间编码数据。S20. Encode the generation time data using a preset encoding rule, and obtain time encoding data corresponding to the generation time data.
具体地,将所述生成时间数据进行预处理,获得第二生成时间数据;其中,所述预处理包括:对所述生成时间进行划分为年数、月数、日数和第一分钟数,其中,所述第一分钟数包括小时数和分钟数;将所述年数和所述第一分钟数相加,在与所述月数和日数进行组合,获得第二生成时间数据;Specifically, preprocessing the generation time data to obtain second generation time data; wherein, the preprocessing includes: dividing the generation time into years, months, days, and first minutes, wherein, The first number of minutes includes the number of hours and the number of minutes; the number of years and the number of first minutes are added, and then combined with the number of months and days to obtain second generation time data;
将所述第二生成时间数据除以一个预设的数值,获得第三生成时间数据;其中,所述预设的数据为四位数及以上的数值;Dividing the second generation time data by a preset value to obtain the third generation time data; wherein, the preset data is a value of four digits and above;
将所述第三生成时间数据的整数部分和小数部分的前四位的数值进行相加,获得相加的结果,并将所述相加结果的前四位作为所述生成时间数据对应时间编码。The integer part and the numerical value of the first four digits of the decimal part of the third generation time data are added to obtain an addition result, and the first four digits of the addition result are used as the corresponding time code of the generation time data .
例如:当前时间为2021年10月23日15时11分(即202110231511),将小时数乘以60后加上分钟数,即911。再加911与年数相加,即911+2021=2932。再与月日组合为29321023,最后除于一个较大的约定数(例如为8888),得到的商F为3297.8198694,将商F中的整数3297加上商F中小数的前四位8198得到结果J为11495,取结果J后四位得到时间编码为1495。For example: the current time is 15:11 on October 23, 2021 (ie 202110231511), multiply the hours by 60 and add the minutes, that is, 911. Add 911 and add the number of years, that is, 911+2021=2932. Then combine with month and day to 29321023, and finally divide by a larger convention number (for example, 8888), the obtained quotient F is 3297.8198694, add the integer 3297 in quotient F to the first four digits of the decimal in quotient F 8198 to get the result J is 11495, and the time code is 1495 by taking the last four digits of the result J.
需要说明的是,当整数部分或者小数部分不足四位数字时,采用补零的方式构成四位数字。It should be noted that, when the integer part or the fractional part is less than four digits, the four digits are formed by filling zeros.
S30、将所述第一背景图片中划分出多个时间区域图片,并根据所述时间编码数据对每个所述时间区域图片预处理,获得第二背景图片。S30: Divide the first background picture into multiple time region pictures, and preprocess each of the time region pictures according to the time encoding data to obtain a second background picture.
具体地,将所述第一背景图片中划分出多个第一时间区域图片,并对每个所述时间区域图片进行灰度化和二值化处理,获得多个第二时间区域图片;Specifically, dividing the first background picture into a plurality of first time region pictures, and performing grayscale and binarization processing on each of the time region pictures to obtain a plurality of second time region pictures;
作为优选地,将第一背景图片中的四个角分别划分出四个M*M的区域图片Ai,左上角、左下角、右上角、右下角区域图片分别为A1、A2、A3、A4。明确时间编码P1、P2、P3、P4写入区域图片A1、A2、A3、A4的对应关系。Preferably, the four corners of the first background picture are divided into four M*M area pictures Ai, the upper left corner, the lower left corner, the upper right corner and the lower right corner area pictures are A1, A2, A3 and A4 respectively. The correspondence between the time codes P1, P2, P3, and P4 written in the area pictures A1, A2, A3, and A4 is clarified.
例如:假设时间编码得到的是1495,取M=5,划分的区域是5*5;对图片的四个边角进行划分:左上角是第一行至第五行、第一列至第五列。右上角是第一行至第五行、倒数第一列至倒数第五列。右下角是倒数第一行至倒数第五行、倒数第一列至倒数第五列。左下角则是倒数第一行至倒数第五行、第一列至第五列。步骤一得到时间编码为1495,将时间编码中的第一个数值1与左上角区域图片是对应关系,第二个数值4与右上角区域图片是对应关系,第三个数值9与右下角区域图片是对应关系,第四个数值5与左下角区域图片是对应关系。For example: Assuming that the time encoding is 1495, take M=5, and the divided area is 5*5; divide the four corners of the picture: the upper left corner is the first row to the fifth row, and the first column to the fifth column . The upper right corner is the first row to the fifth row, and the penultimate column to the penultimate fifth column. In the lower right corner are the first-to-last row to the fifth-last row, and the first-to-last column to the fifth-to-last column. In the lower left corner are the penultimate row to the fifth row and the first column to the fifth column. In step 1, the time code is obtained as 1495. The first value 1 in the time code corresponds to the upper left area picture, the second value 4 corresponds to the upper right area picture, and the third value 9 corresponds to the lower right area. The picture is the corresponding relationship, and the fourth value 5 is the corresponding relationship with the picture in the lower left corner.
根据所述时间编码数据和所述第二时间区域图片中的黑色像素点个数,对所述第一时间区域图片的像素点的RGB值进行调整处理,使得多个背景图片时间区域经过进行灰度化和二值化处理后的黑色像素点个数与所述时间编码数据相对应。According to the time-encoded data and the number of black pixels in the second time-area picture, the RGB values of the pixels in the first time-area picture are adjusted, so that the time areas of a plurality of background pictures are grayed out. The number of black pixel points after scale and binarization processing corresponds to the time-encoded data.
具体地,对第二时间区域图片按照预设的权值WR、WG、WB和阈值T,进行灰度化和二值化处理;然后循环统计每个第二时间区域图片中的黑色像素点是否和对应的时间编码数据相等,若不相等,则随机在第二时间区域图片中,对黑色像素点的RGB值,进行调整,使得每个第二时间区域图片在区域经过进行灰度化和二值化处理后的黑色像素点个数与与对应时间编码数据相等。Specifically, gray-scale and binarization processing is performed on the second time area picture according to the preset weights WR, WG , WB and the threshold value T ; Whether the pixel is equal to the corresponding time-encoded data, if not, then randomly adjust the RGB value of the black pixel in the second time area image, so that each second time area image is grayscaled as it passes through the area The number of black pixels after binarization and binarization is equal to the corresponding time-coded data.
将所述经过调整处理后的第一时间区域图片作为最终的时间区域图片,并结合第一背景图片中没有被划分的图片区域部分,构成第二背景图片。The adjusted first time region picture is used as the final time region picture, and combined with the undivided picture region parts in the first background picture, a second background picture is formed.
S40、对所述第二背景图片进行区域划分,获得多个验证码字符区域图片,并在每个所述验证码字符区域图片内,随机生成验证码字符,再对所述验证码字符添加预设的干扰规则,获得人与合法设备通用验证码。S40, performing region division on the second background picture to obtain a plurality of verification code character region pictures, and randomly generating a verification code character in each of the verification code character region pictures, and then adding a pre-set to the verification code character Set interference rules, and obtain universal verification codes for people and legitimate devices.
具体地,预先构建验证码字符表,所述验证码字符表中包括:验证码字符以及验证码字符对应的黑色像素点个数;Specifically, a verification code character table is constructed in advance, and the verification code character table includes: verification code characters and the number of black pixels corresponding to the verification code characters;
对所述第二背景图片进行区域划分,获得多个验证码字符区域图片;The second background picture is divided into regions to obtain a plurality of verification code character region pictures;
需要说明的是,对第二背景图片划分验证码字符区域图片的范围是要去掉在上述步骤中的时间区域图片范围。It should be noted that, dividing the range of the captcha character area image for the second background image is to remove the time area image range in the above steps.
从所述验证码字符表中随机挑选字符,写入每个所述验证码字符区域图片内,并添加干扰噪声点和干扰线;Characters are randomly selected from the verification code character table, written into each of the verification code character area pictures, and interference noise points and interference lines are added;
对所述验证码字符区域图片中的像素点的RGB值进行调整处理,使得验证码字符区域图片经过预设的规则进行灰度化和二值化处理后的黑色像素点个数与所述验证码字符对应的黑色像素点个数相等;The RGB values of the pixels in the verification code character area picture are adjusted and processed, so that the number of black pixels after the verification code character area picture is grayed and binarized through preset rules is the same as the number of black pixels in the verification code. The number of black pixels corresponding to the code characters is equal;
需要说明的是,所述预设的规则具体指的是,可以根据实际情况,设定灰度化和二值化处理过程中的参数值,例如:灰度化参数WR、WG、WB;二值化参数T等。It should be noted that the preset rule specifically refers to that the parameter values in the grayscale and binarization process can be set according to the actual situation, for example: the grayscale parameters W R , W G , W B ; binarization parameter T, etc.
将所述经过调整处理后的验证码字符区域图片作为最终的验证码字符区域图片,并结合所述第二背景图片的其他区域部分,构成人与合法设备通用验证码。The adjusted verification code character area picture is used as the final verification code character area picture, and combined with other areas of the second background picture, to form a general verification code for people and legal devices.
相对于现有技术,本发明提供的一种验证码的生成方法,其有益效果在于:Compared with the prior art, the method for generating a verification code provided by the present invention has the following beneficial effects:
本发明利用当前时间的转化为时间编码,写入到验证码图片的四个边角上,作为后面验证码图片生成的基础。设备在身份认证过程先对验证码图片四个边角进行识别得到时间编码,设备基于设备当前时间、当前时间向前推一分钟生成两个时间编码。识别到的时间编码与设备生成的两个时间编码进行验证,只要设备生成时间编码的有其中一个验证通过,才继续对验证码图片进行识别验证码信息流程,否则就结束身份认证流程,可以有效的防止出现假冒服务器和重放攻击。最终实现了双向认证,可以有效的抵抗重放攻击、假冒服务器等。The present invention utilizes the conversion of the current time into time code, and writes it into the four corners of the verification code picture as the basis for the subsequent verification code picture generation. During the identity authentication process, the device first identifies the four corners of the verification code picture to obtain the time code. The device generates two time codes based on the current time of the device and the current time is pushed forward by one minute. The recognized time code is verified with the two time codes generated by the device. As long as one of the time codes generated by the device passes the verification, the verification code information process will continue to be performed on the verification code picture. Otherwise, the identity authentication process will end, and it will be effective. to prevent spoofing servers and replay attacks. Finally, two-way authentication is realized, which can effectively resist replay attacks and fake servers.
如图2所示,本发明还提供一种验证码的验证方法,应用于对如上述任意一项所述的验证码的生成方法所生成的验证码进行验证,所述验证方法包括:As shown in Figure 2, the present invention also provides a verification code verification method, which is applied to verify the verification code generated by the verification code generation method described in any of the above, and the verification method includes:
S100、获取验证码的信息数据,所述信息数据包括:验证码的时间区域图片范围和验证码的字符区域图片;S100, obtaining information data of the verification code, the information data includes: the time area picture range of the verification code and the character area picture of the verification code;
具体地,设备在接收到验证码图片后,读取设备储存模块中的参数,例如:时间图片区域划分参数、初始化时间编码数组L的数值、灰度化处理中的权值WR、WG和WB二值化处理中的阈值T、循环初始值i=1等等。Specifically, after receiving the verification code picture, the device reads the parameters in the device storage module, such as: the time picture area division parameter, the value of the initialization time code array L , the weights WR and WG in the grayscale processing and the threshold value T in the binarization process of WB , the initial value of the cycle i=1, and so on.
S110、根据所述验证码的时间区域图片,获取验证码背景图片的生成时间的对应时间编码数据;S110, according to the time area picture of the verification code, obtain the corresponding time code data of the generation time of the background picture of the verification code;
具体地,对验证码图片中的四个角进行划分,得到四个区域图片分别为A1、A2、A3、A4,并分别对上述4个区域图片进行灰度化和二值化处理,并计算每个A1、A2、A3、A4四个区域图片中的黑色像素点个数L1、L2、L3、L4,按字符连接组合起来,就得到时间编码数据。Specifically, the four corners in the verification code picture are divided to obtain four regional pictures respectively A1, A2, A3, and A4, and grayscale and binarization processing is performed on the above four regional pictures respectively, and the calculation The numbers of black pixels L1, L2, L3, and L4 in each of the four area pictures of A1, A2, A3, and A4 are combined by character connection to obtain time-encoded data.
S120、根据所述验证码的字符区域图片,获取验证码的字符;S120, obtaining the characters of the verification code according to the character area picture of the verification code;
具体地,获取验证码的字符区域图片,并分别对字符区域图片进行灰度化和二值化处理,并计算每个字符区域图片的黑色像素点个数,在根据字符关联表,获取到验证码字符,生成验证码信息。Specifically, obtain the character area picture of the verification code, perform grayscale and binarization processing on the character area picture, and calculate the number of black pixels in each character area picture, and then obtain the verification code according to the character association table. code characters to generate verification code information.
S130、根据所述验证码背景图片的生成时间和所述验证码的字符,判断所述验证码是否正确。S130. Determine whether the verification code is correct according to the generation time of the verification code background picture and the characters of the verification code.
相对于现有技术,本发明提供的一种验证码的验证方法,其有益效果在于:Compared with the prior art, the method for verifying a verification code provided by the present invention has the following beneficial effects:
本发明的识别过程省去了去噪处理,并且对验证码图片的顺序进行修改。先对验证码图片进行区域划分,后面只需要对划分出的区域图片进行灰度化、二值化处理,不用对整个验证码图片进行灰度化、二值化处理,使得设备的识别速度更快,认证效率高,而且有效的防止OCR技术的识别破解。The identification process of the present invention omits the denoising process and modifies the sequence of the verification code pictures. First, divide the verification code picture into regions, and then only need to perform grayscale and binarization processing on the divided regional pictures, and do not need to grayscale and binarize the entire verification code picture, so that the recognition speed of the device is faster. It is fast, has high authentication efficiency, and effectively prevents the identification and cracking of OCR technology.
如图3所示,本发明还提供一种验证码的生成装置200,包括:生成模块201、编码模块202、预处理模块203和获取模块204,其中;As shown in FIG. 3 , the present invention further provides a verification
所述生成模块201,用于生成验证码的第一背景图片,并存储所述第一背景图片的生成时间数据;The
所述编码模块202,用于对所述生成时间数据采用预设的编码规则进行编码,获得所述生成时间数据对应的时间编码数据;The
所述预处理模块203,用于将所述第一背景图片中划分出多个时间区域图片,并根据所述时间编码数据对每个所述时间区域图片预处理,获得第二背景图片;The
所述获取模块204,用于对所述第二背景图片进行区域划分,获得多个验证码字符区域图片,并在每个所述验证码字符区域图片内,随机生成验证码字符,获得验证码。The obtaining
在本发明的某一个实施例中,所述编码模块,具体用于:In an embodiment of the present invention, the encoding module is specifically used for:
将所述生成时间数据进行预处理,获得第二生成时间数据;其中,所述预处理包括:对所述生成时间进行划分为年数、月数、日数和第一分钟数,其中,所述第一分钟数包括小时数和分钟数;将所述年数和所述第一分钟数相加,在与所述月数和日数进行组合,获得第二生成时间数据;Preprocessing the generation time data to obtain second generation time data; wherein, the preprocessing includes: dividing the generation time into years, months, days, and first minutes, wherein the first The number of one minute includes the number of hours and the number of minutes; adding the number of years and the number of the first minutes, and combining with the number of months and days, the second generation time data is obtained;
将所述第二生成时间数据除以一个预设的数值,获得第三生成时间数据;其中,所述预设的数据为四位数及以上的数值;Dividing the second generation time data by a preset value to obtain the third generation time data; wherein, the preset data is a value of four digits and above;
将所述第三生成时间数据的整数部分和小数部分的前四位的数值进行相加,获得相加的结果,并将所述相加结果的前四位作为所述生成时间数据对应时间编码。The integer part and the numerical value of the first four digits of the decimal part of the third generation time data are added to obtain an addition result, and the first four digits of the addition result are used as the corresponding time code of the generation time data .
在本发明的某一个实施例中,所述预处理模块,具体用于:In an embodiment of the present invention, the preprocessing module is specifically used for:
将所述第一背景图片中划分出多个第一时间区域图片,并对每个所述时间区域图片进行灰度化和二值化处理,获得多个第二时间区域图片;Dividing the first background picture into a plurality of first time region pictures, and performing grayscale and binarization processing on each of the time region pictures to obtain a plurality of second time region pictures;
根据所述时间编码数据和所述第二时间区域图片中的黑色像素点个数,对所述第一时间区域图片的像素点的RGB值进行调整处理,使得多个背景图片时间区域经过按照预设的规则进行灰度化和二值化处理后的黑色像素点个数与所述时间编码数据相对应;According to the time-encoded data and the number of black pixels in the second time-area picture, the RGB values of the pixels in the first time-area picture are adjusted, so that the time-area of the background pictures are processed according to the predetermined time area. The number of black pixels after grayscale and binarization processing according to the set rule corresponds to the time-coded data;
将所述经过调整处理后的第一时间区域图片作为最终的时间区域图片,并结合第一背景图片中没有被划分的图片区域部分,构成第二背景图片。The adjusted first time region picture is used as the final time region picture, and combined with the undivided picture region parts in the first background picture, a second background picture is formed.
在本发明的某一个实施例中,所述获取模块,具体用于:In an embodiment of the present invention, the acquisition module is specifically used for:
预先构建验证码字符表,所述验证码字符表中包括:验证码字符以及验证码字符对应的黑色像素点个数;Build a verification code character table in advance, and the verification code character table includes: verification code characters and the number of black pixels corresponding to the verification code characters;
对所述第二背景图片进行区域划分,获得多个验证码字符区域图片;The second background picture is divided into regions to obtain a plurality of verification code character region pictures;
从所述验证码字符表中随机挑选字符,写入每个所述验证码字符区域图片内,并添加干扰噪声点和干扰线;Characters are randomly selected from the verification code character table, written into each of the verification code character area pictures, and interference noise points and interference lines are added;
对所述验证码字符区域图片中的像素点的RGB值进行调整处理,使得验证码字符区域图片经过按照预设的规则进行灰度化和二值化处理后的黑色像素点个数与所述验证码字符对应的黑色像素点个数相等;The RGB values of the pixels in the verification code character area picture are adjusted and processed, so that the number of black pixels after the verification code character area picture is grayed and binarized according to preset rules is the same as the number of black pixels in the verification code character area picture. The number of black pixels corresponding to the verification code characters is equal;
将所述经过调整处理后的验证码字符区域图片作为最终的验证码字符区域图片,并结合所述第二背景图片的其他区域部分,构成人与合法设备通用验证码。The adjusted verification code character area picture is used as the final verification code character area picture, and combined with other areas of the second background picture, to form a general verification code for people and legal devices.
如图4所示,本发明还提供一种验证码的验证装置300,包括:获取模块301、解码模块302、字符模块303和验证模块304,其中;As shown in FIG. 4, the present invention also provides a
所述获取模块301,用于根据预设的注册规则,生成合法设备,并获取验证码图片的信息数据,所述信息数据包括:验证码图片的灰度化参数、二值化参数、验证码图片的区域划分信息以及验证码字符关联表;The obtaining
所述时间编码模块302,用于根据所述验证码图片的区域划分信息和验证码图片的灰度化参数、二值化参数,获取验证码背景图片的生成时间的对应时间编码;The
所述字符模块303,所述字符模块,用于根据所述验证码图片的灰度化参数、二值化参数、验证码图片的区域划分信息以及验证码字符关联表,获取验证码的字符;The
所述验证模块304,用于根据所述验证码背景图片的生成时间和所述验证码的字符,判断所述验证码是否正确。The
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。The above are the preferred embodiments of the present invention. It should be pointed out that for those skilled in the art, without departing from the principles of the present invention, several improvements and modifications can be made, and these improvements and modifications may also be regarded as It is the protection scope of the present invention.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210051928.7A CN114494474B (en) | 2022-01-17 | 2022-01-17 | Generation method, verification method and device of universal verification code of human and legal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210051928.7A CN114494474B (en) | 2022-01-17 | 2022-01-17 | Generation method, verification method and device of universal verification code of human and legal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114494474A CN114494474A (en) | 2022-05-13 |
CN114494474B true CN114494474B (en) | 2022-09-20 |
Family
ID=81512556
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210051928.7A Active CN114494474B (en) | 2022-01-17 | 2022-01-17 | Generation method, verification method and device of universal verification code of human and legal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114494474B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101236561A (en) * | 2007-01-31 | 2008-08-06 | 株式会社理光 | Coding device, data searching and image processing device, data searching and image processing system, and data searching and image processing method |
CN102831568A (en) * | 2012-08-03 | 2012-12-19 | 网易(杭州)网络有限公司 | Method and device for generating verification code picture |
CN104346557A (en) * | 2013-08-06 | 2015-02-11 | 深圳市腾讯计算机系统有限公司 | Verification code generation method and device and verification code display control method and device |
CN104778432A (en) * | 2014-01-10 | 2015-07-15 | 携程计算机技术(上海)有限公司 | Image recognition method |
CN104852889A (en) * | 2014-02-18 | 2015-08-19 | 腾讯科技(深圳)有限公司 | Picture identifying code generation method and system, and verify method and client side, and server |
CN107908946A (en) * | 2017-10-27 | 2018-04-13 | 链家网(北京)科技有限公司 | Method for generating picture verification codes, picture validation code, verification method and device |
CN111259365A (en) * | 2020-01-10 | 2020-06-09 | 河北先见软件科技股份有限公司 | Dynamic verification code generation method |
EP3690686A1 (en) * | 2019-02-01 | 2020-08-05 | Idemia Identity & Security France | Authentication procedure, server and electronic identity device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7313251B2 (en) * | 1993-11-18 | 2007-12-25 | Digimarc Corporation | Method and system for managing and controlling electronic media |
-
2022
- 2022-01-17 CN CN202210051928.7A patent/CN114494474B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101236561A (en) * | 2007-01-31 | 2008-08-06 | 株式会社理光 | Coding device, data searching and image processing device, data searching and image processing system, and data searching and image processing method |
CN102831568A (en) * | 2012-08-03 | 2012-12-19 | 网易(杭州)网络有限公司 | Method and device for generating verification code picture |
CN104346557A (en) * | 2013-08-06 | 2015-02-11 | 深圳市腾讯计算机系统有限公司 | Verification code generation method and device and verification code display control method and device |
CN104778432A (en) * | 2014-01-10 | 2015-07-15 | 携程计算机技术(上海)有限公司 | Image recognition method |
CN104852889A (en) * | 2014-02-18 | 2015-08-19 | 腾讯科技(深圳)有限公司 | Picture identifying code generation method and system, and verify method and client side, and server |
CN107908946A (en) * | 2017-10-27 | 2018-04-13 | 链家网(北京)科技有限公司 | Method for generating picture verification codes, picture validation code, verification method and device |
EP3690686A1 (en) * | 2019-02-01 | 2020-08-05 | Idemia Identity & Security France | Authentication procedure, server and electronic identity device |
CN111259365A (en) * | 2020-01-10 | 2020-06-09 | 河北先见软件科技股份有限公司 | Dynamic verification code generation method |
Also Published As
Publication number | Publication date |
---|---|
CN114494474A (en) | 2022-05-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111008923B (en) | Watermark embedding method, watermark extracting method, watermark embedding device, watermark extracting device and watermark extracting equipment | |
US9805296B2 (en) | Method and apparatus for decoding or generating multi-layer color QR code, method for recommending setting parameters in generation of multi-layer QR code, and product comprising multi-layer color QR code | |
WO2015192669A1 (en) | Two-dimensional code scanning positioning prompt method and system | |
CN103745151B (en) | Method for authenticating identity through combination of two-dimension codes and dynamic passwords | |
KR20200005639A (en) | Data check | |
US9059852B2 (en) | Validating a user's identity utilizing information embedded in a image file | |
Majumder et al. | Singular value decomposition and wavelet‐based iris biometric watermarking | |
CN102306305A (en) | Method for authenticating safety identity based on organic characteristic watermark | |
CN103825744A (en) | Off-site personal digital certificate application method and system | |
Wojtowicz et al. | Digital images authentication scheme based on bimodal biometric watermarking in an independent domain | |
CN104426879B (en) | Processing method and the corresponding methods, devices and systems of identifying code generation and verifying | |
CN104636925B (en) | Based on the electronic transaction identification method of face recognition | |
CN106096348A (en) | A kind of card based on multidimensional code checking system and method | |
Ayoup et al. | Cancellable Multi-Biometric Template Generation Based on Arnold Cat Map and Aliasing. | |
CN107845118A (en) | A kind of digitization image processing method | |
WO2015062441A1 (en) | Cgi web interface multi-session verification code generation and verification method | |
CN110111477B (en) | Lottery information anti-counterfeiting authentication method and system based on information hiding | |
CN114494474B (en) | Generation method, verification method and device of universal verification code of human and legal equipment | |
CN116055129B (en) | Internet of things equipment identity authentication method and system based on dynamic graphic password picture | |
Kolekar et al. | Click and session based—Captcha as graphical password authentication schemes for smart phone and web | |
Shashidhar et al. | Novel framework for optimized digital forensic for mitigating complex image attacks | |
CN115526282A (en) | Watermark encryption method, watermark extraction method, device and storage medium | |
CN111611567B (en) | Authentication method and device, electronic whiteboard and computer readable storage medium | |
CN113780029A (en) | Verification method and device of novel three-dimensional code combined with portrait | |
Alam et al. | An investigation into image hiding steganography with digital signature framework |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |