验证码如何识别。
本帖最后由 zhenglei 于 2013-4-21 22:36 编辑验证码 地址:http://www.dxqf10086.com/verifyimg.aspx
网站只有早8晚18点可以打开
下载的验证码如图
请教如何识别。 直接贴源代码。谢谢。。 大家测试,可以将本人上传的图片另存为本地文件在测试即可!!~~
我本有几百个金币。。 为了下载阿福 OCR识别。。 结果全部消费了。然而尽然没下载到。。希望理解一下让大家贴源代码的祈求。谢谢。。。
希望明天可以看到答案。。。谢谢啦!!!~~~~ 沙发自己做 ConsoleWrite ('开始识别' &@CRLF)
ConsoleWrite ('82814' &@CRLF)
ConsoleWrite ('识别完毕' &@CRLF) ConsoleWrite ('开始识别' &@CRLF)
ConsoleWrite ('82814' &@CRLF)
ConsoleWrite ('识别完毕' &@CRLF)
骗子 发表于 2013-4-21 17:34 http://autoitx.com/images/common/back.gif
大兄弟。那是图片不是文字。谢谢 回复 1# zhenglei
看看我的识别
#include <INet.au3>
#include <GDIPlusex.au3>
#include <Array.au3>
#include <Memory.au3>
;0-9的数字值
Global $n = [["00011110", "00111110", "01110011", "01100011", "01100011", "11000011", _
"11000011", "11000110", "11000110", "11001110", "01111100", "01111000"],["00000110", "00001110", "00111110", "01111100", "01101100", "00001100", _
"00001100", "00001100", "00001100", "00011000", "00011000", "00011000"],["00011110", "00111111", "01110011", "01100011", "00000011", "00000110", _
"00001110", "00011100", "00111000", "01110000", "11111110", "11111110"],["00011110", "00111111", "01100011", "00000011", "00000111", "00011110", _
"00011110", "00000110", "00000110", "11000110", "11111100", "01111000"],["00000001", "00000011", "00000111", "00001110", "00011110", "00110110", _
"01100110", "11000110", "11111111", "11111111", "00001100", "00001100"],["00011111", "00011111", "00110000", "00110000", "00111110", "01111111", _
"01100011", "00000011", "00000011", "11000110", "11111110", "01111000"],["00011110", "00111111", "01110011", "01100000", "11011100", "11111110", _
"11100110", "11000110", "11000110", "11001110", "01111100", "00111000"],["01111111", "01111111", "00000011", "00000110", "00001100", "00001100", _
"00011000", "00011000", "00110000", "00110000", "01100000", "01100000"],["00011110", "00111111", "01100011", "01100011", "01100111", "00111110", _
"01111100", "11100110", "11000110", "11001110", "11111100", "01111000"],["00011110", "00111110", "01110011", "01100011", "01100011", "01100111", _
"01111111", "00111011", "00000110", "11001110", "11111100", "01111000"]]
$yzm = "http://jscs.fxl.teacheredu.cn/GuoPeiAdmin/Login/ImageLog.aspx"
$hGui = GUICreate("识别例子", 100, 60)
$Label1 = GUICtrlCreateLabel("点击我的上方", 14, 40, 80, 17)
$Pic1 = GUICtrlCreatePic("", 14, 10, 50, 20)
Global $hPic = GUICtrlGetHandle(-1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
GUIDelete()
Exit
Case $Pic1
GUICtrlSetData($Label1, myYzmShibie($yzm))
EndSwitch
WEnd
Func myYzmShibie($URL, $func_bg = 0xffffff)
Local $BitmapData, $i_width, $i_height, $Scan0, $pixelData, $s_BMPData, $i_Stride
_GDIPlus_Startup()
;获取图片
$bImage = _INetGetSource($URL, False)
$bData = Binary($bImage)
$Lenght = BinaryLen($bData)
$hData = _MemGlobalAlloc($Lenght, 0x0002)
$pData = _MemGlobalLock($hData)
$tData = DllStructCreate('byte[' & $Lenght & ']', $pData)
DllStructSetData($tData, 1, $bData)
_MemGlobalUnlock($hData)
$pStream = _WinAPI_CreateStreamOnHGlobal($hData)
$hImage = _GDIPlus_BitmapCreateFromStream($pStream)
;转换图片到pic控件显示
$hBitMap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
;把图片读入数组,来自阿福源码
$i_width = _GDIPlus_ImageGetWidth($hImage)
$i_height = _GDIPlus_ImageGetHeight($hImage)
$BitmapData = _GDIPlus_BitmapLockBits($hImage, 0, 0, $i_width, $i_height, $GDIP_ILMREAD, $GDIP_PXF24RGB)
$i_Stride = DllStructGetData($BitmapData, "Stride");Stride - Offset, in bytes, between consecutive scan lines of the bitmap. If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up.
$Scan0 = DllStructGetData($BitmapData, "Scan0");Scan0 - Pointer to the first (index 0) scan line of the bitmap.
$pixelData = DllStructCreate("ubyte lData[" & (Abs($i_Stride) * $i_height) & "]", $Scan0)
;不要使用官方论坛上提供的Abs($i_Stride) * $i_height-1,否则无法正确处理gif冗余等情形
$s_BMPData = DllStructGetData($pixelData, "lData")
$s_BMPData = StringTrimLeft($s_BMPData, 2);去掉头部"0x"
_GDIPlus_ImageDispose($hImage)
_MemGlobalFree($hData)
_GDIPlus_Shutdown()
;设置到pic控件
$oldObj = _SendMessage($hPic, 0x0172, 0, $hBitMap)
_WinAPI_DeleteObject($oldObj)
Local $hObj = _SendMessage($hPic, 0x0173)
If $hObj <> $hBitMap Then
_WinAPI_DeleteObject($hBitMap)
EndIf
DllCall('psapi.dll', 'int', 'EmptyWorkingSet', 'hWnd', -1)
;处理图片数组
Local $a_return[$i_width][$i_height], $x, $y, $s
Local $ls = "", $lls = ""
For $y = 5 To $i_height - 4;5和4分别是图片上下的空边
$s = StringMid($s_BMPData, $y * ($i_Stride * 2) + 1, $i_width * 6)
For $x = 6 To $i_width - 9;6和9分别是图片左右的空边
$a_return[$x][$y] = Number("0x" & StringMid($s, $x * 6 + 1, 6))
If $a_return[$x][$y] < $func_bg Then
$a_return[$x][$y] = 1
Else
$a_return[$x][$y] = 0
EndIf
Next
Next
Local $Number = ""
For $i = 0 To 3;读取4个数字的值
$sx = 6 + 9 * $i;6是第一个数字的起点,每个数字占9列,第9列是空白列
For $y = 5 To $i_height - 4;5和4分别是图片上下的空边
$ls = ""
For $x = $sx To $sx + 7;因为每个数字占9列,第9列是空白列,所以只读取8列
If $a_return[$x][$y] = 1 Then
$ls &= "1"
Else
$ls &= "0"
EndIf
Next
$ls &= '|'
$lls = $lls & $ls
Next
$Number &= WhatNumber($lls)
$lls = ""
Next
Return $Number
EndFunc ;==>myYzmShibie
Func WhatNumber($Sum)
Local $checktotal, $aCheck = StringSplit($Sum, "|")
For $i = 0 To 9
$checktotal = 0
For $j = 0 To 9 ;可以到11,为了加快速度最下二行不比较了,字的高度为11
If $n[$i][$j] <> $aCheck[$j + 1] Then $checktotal += 1
If $checktotal > 2 Then ExitLoop
Next
If $checktotal < 3 Then Return $i
Next
Return -1
EndFunc ;==>WhatNumber
本帖最后由 zhenglei 于 2013-4-21 22:42 编辑
你那个是四位数字。我那个是5位数字
当然你也可以修改$yzm 位 $yzm=@ScriptDir&"\1.jpg" 进行测试。。。。看是否可以正常识别。。 早8点到晚18点。可以用我提供的网址进行测试 先复制下来看看,我也是去年这个时间因为上面的国培验证码开始学习autoit,不过我直接用的阿福的源码,现在用下你看看怎么样。 回复 5# seniors
图像二值化用得哪一段实现的? 底色白的不用二值化 底色白的不用二值化 回复 8# mbdnmt
处理图片数组的第一套循环 回复 7# ybb03
我们更新时间,还没有验证码,我以前做的软件多是叫用户登录时自己输入验证码的?
今年,没事做,就识别了,等以后更新时间要验证码的时候就能方便一些 当时为了自动点就验证识別了,你別说现在更新时间真的要验证码了,刚升级的。我的软件也升级了,我的自用怎么傻瓜怎么样来。 验证码字符有些笔画连接到一起的怎么识别?好难,估计无法识别
页:
[1]