网上介绍的用按键精灵识别验证码的想法如下:
我们知道,每一个数字都唯一对应一个只包涵0和1的二维数组
例如:
这样,我们可以从左至右,从上到下的扫描每一个数字,将其组装成一个个数组,如下所示:
var1 = Array(0,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0)
var2 = Array(0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0)
var3 = Array(0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0)
var4 = Array(0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0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,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,1,1,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0)
var0 = Array(0,0,0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1,0,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,1,1,1,0,0,0)
如果我们将验证码中的数字也转换成一个数组,然后将其与标准数字进行比较,得出其值为哪个数字即可。但可惜的是,验证码中有噪点,即使通过将验证码进行灰度处理(R+B+C)/3 后,转换成的数组与标准数字的数组也不能完全匹配。如果进行模糊匹配的话,那么可能会得出多个结果。需要进一步的研究。
//定义数字1-9的二维码阵列
Dim var1, var2, var3, var4, var5, var6, var7, var8, var9, var0
var1 = Array(0,0,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0)
var2 = Array(0,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1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,0,0,0,1,1,1,0,0,0)
varAll = Array(var0, var1, var2, var3, var4, var5, var6, var7, var8, var9)
//验证码图片第一个数字的左上角坐标
init_x = 685 //x轴
init_y = 609 //y轴
//把坐标值复制给变量
var_x = init_x
var_y = init_y
//定义一个临时数组,用于存放扫描到的数字二维码
Dim tempArray(117)
//存放4位验证码结果
Dim resultArray(4)
For i = 0 To 3
index = 0
//从第一行开始扫描,总共扫描13行
var_y = init_y
TracePrint "----------------------------------------"
row = 0
While row < 13
//从第一列开始扫描,总共扫描9列
column = 0
var_temp_x = var_x
Dim row_print
row_print = ""
While column < 9
//变量m,若该像素不为白色,则i等于1,否则等于0
m = 0
//获取指定点颜色
GetColor = GetPixelColor(var_temp_x, var_y)
//获取颜色的RGB分量
Call Plugin.Color.ColorToRGB(GetColor, GetColor_R, GetColor_G, GetColor_B)
//进行灰度化处理
grayColor = (GetColor_R+GetColor_G+GetColor_B)/3
//调试移动鼠标
//MoveTo var_temp_x, var_y
If grayColor < 115 Then
m = 1
End If
row_print = row_print&m
//为临时数组赋值
tempArray(index) = m
//临时数组向后移动一位
index = index + 1
//扫描下一列
column = column + 1
var_temp_x = var_temp_x + 1
Wend
TracePrint row_print
//扫描下一行
row = row + 1
var_y = var_y + 1
Wend
//x坐标向右移动13位,指向下一个数字
var_x = var_x + 13
//与标准的0-9的阿拉伯数字的二维码进行比较,找出匹配到的数字
matchIndex = - 1
maxSameCount = 0
For j = 0 To UBound(varAll)-1
var_array = varAll(j)
//数字的二维码是否与标准相同
sameCount = 0
For k = 0 To UBound(var_array)-1
If (var_array(k) = tempArray(k)) Then
sameCount = sameCount + 1
End If
Next
TracePrint "###########################" & sameCount
If sameCount > maxSameCount Then
maxSameCount = sameCount
matchIndex = j
End If
Next
resultArray(i) = matchIndex
Next
Dim result
result = ""
For j = 0 To UBound(resultArray) - 1
result = result&"#"&resultArray(j)&"#"
Next
MessageBox result
- 大小: 9.1 KB
- 大小: 49.2 KB
分享到:
相关推荐
总的来说,利用按键精灵识别验证码是一项涉及图像处理、OCR技术和自动化脚本编写技能的任务,对于初学者来说,这是一个很好的实践项目,能够提升他们的编程能力和自动化解决问题的能力。通过深入学习和实践,不仅...
按键精灵虽然不具备内置的图像处理能力,但可以通过调用外部图像处理库,如OpenCV,对验证码图片进行预处理,然后通过比较模板或者使用OCR(光学字符识别)技术,找出并转换验证码中的字符。 "识别验证码的视屏教程...
【按键精灵验证码识别及后台技术】是针对自动化测试和数据输入场景的一种技术,它结合了“按键精灵”这款工具的功能,以及验证码识别和后台运行脚本的策略。按键精灵是一款强大的自动化工具,能够模拟用户的键盘和...
使用按键精灵手机助手旋转验证码上传插件,开发者和自动化测试人员可以更有效地应对复杂的验证码识别任务,提高工作效率,同时减少了人工操作带来的错误可能。需要注意的是,虽然此类工具在合法用途下非常有用,但...
【按键精灵后台及验证码】教程主要涵盖了两个核心领域:一是按键精灵在后台运行的技术与应用场景,二是验证码识别的实现方法。按键精灵是一款自动化工具,它允许用户通过录制和编辑脚本来模拟键盘和鼠标操作,极大地...
《按键精灵本地识别插件(无坐标版)详解与应用》 按键精灵本地识别插件,作为一款基于百度飞桨OCR技术的工具,为用户提供了一种无需坐标即可进行文字识别的强大功能。这款插件的独特之处在于它通过命令回显的方式...
1.本插件需一台电脑或者服务器做验证码...4.几乎所有语言都能调用,将需要识别的验证码图片进行BASE64编码后POST给插件开放的服务即可,压缩包内涵详细使用说明,程序新手也能轻松看懂。 5.不会用找我 我帮忙调通。
经过不段改进程序源代码,最终实现了原生COM组件放到按键精灵目录下面就可以使用了,函数调用方法参考COM版函数说明,示例语句在下面 注:不需要regsvr32注册 旧插件: [2013.7.2]---按键精灵插件完全版--基于...
【按键精灵 百度OCR文字识别】是一种技术结合,它利用了按键精灵(AutoHotkey)的自动化功能和百度OCR(Optical Character Recognition,光学字符识别)服务来实现对图像中的文字进行识别。按键精灵是一款强大的...
【按键精灵易语言本地识别OCR(带坐标)】是一个基于易语言编程的工具,用于实现图像中的文字识别功能。易语言是一种中文编程环境,它的设计目标是让编程变得更加简单、直观,适合初学者和专业人士使用。这个工具的...
python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵工具合集python实现按键精灵...
在IT领域,特别是自动化操作与图像识别技术中,“按键精灵”作为一款强大的自动化软件,被广泛应用于游戏辅助、数据抓取、批量操作等场景。本文将深入解析“按键精灵”中如何识别屏幕上的数字源代码,这是一个涉及...
百度文字识别
这是按键精灵的源码,为迅码短信验证码的获取函数,分别为登录,获取手机 拉黑操作
无忧验证码支持按键精灵 内置多种滤镜,去杂点、去色块、去色什...去干扰功能强大,方式灵活多变! 批量建模+智能过滤功能,制作一个新的验证码识别项目仅几分钟时间! 独创识别处理加速算法引擎,速度提高几十倍!...
在实际应用中,"超级鹰按键精灵手机版(lua插件)"可能是一个自动化工具,允许用户通过Lua脚本来控制手机执行特定任务,包括识别验证码。按键精灵提供了一套API,使得lua脚本可以与手机系统交互,例如模拟点击、滑动等...
例如,通过自动识别验证码,可以突破网站的反爬虫策略,获取大量公开数据。然而,需要注意的是,这种技术应遵循合法合规的原则,不得用于非法活动,否则可能会引起严重的法律后果。 “大漠综合工具.exe”和“验证码...