巧用ASPJPEG做验证码识别程序

在写程序实现 发帖/回帖 中,验证码识别是一个非常重要的工具。今天我就来些这样一个工具。

首先需要创建文字表(A),然后去识别原图(B)。然后截出某字符的图片,比较第一个像素(0,0)的差值,第二个像素的差值(0,1)的差值,然后。。。。最终差值最小的就是识别出的字符。

说起来有点绕口,实际很简单。直接上代码了(VBS对图像处理较弱,所以用到ASPJPEG组件)。

下载地址:http://www.miaoqiyuan.cn/products/ocr.rar

Dim Jpeg,tmpJpeg
cfg_Denug = False  '是否启用调试
Set Jpeg = CreateObject("Persits.Jpeg")
'======================复制于toDic生成的字典======================
dim arrPosRes(9,6,9)
arrPosRes(0,0,0) = Array(243,247,230)
arrPosRes(0,0,1) = Array(255,5,0)
arrPosRes(0,0,2) = Array(246,1,0)
arrPosRes(0,0,3) = Array(255,1,7)
arrPosRes(0,0,4) = Array(253,4,0)
arrPosRes(0,0,5) = Array(253,4,0)
arrPosRes(0,0,6) = Array(248,0,1)
arrPosRes(0,0,7) = Array(254,7,0)
arrPosRes(0,0,8) = Array(251,0,5)
arrPosRes(0,0,9) = Array(246,248,235)
arrPosRes(0,1,0) = Array(249,0,4)
arrPosRes(0,1,1) = Array(253,229,253)
arrPosRes(0,1,2) = Array(244,255,255)
arrPosRes(0,1,3) = Array(235,248,239)
arrPosRes(0,1,4) = Array(255,233,255)
arrPosRes(0,1,5) = Array(223,248,216)
arrPosRes(0,1,6) = Array(255,255,253)
arrPosRes(0,1,7) = Array(246,233,253)
arrPosRes(0,1,8) = Array(253,241,243)
arrPosRes(0,1,9) = Array(254,0,10)
arrPosRes(0,2,0) = Array(246,1,34)
arrPosRes(0,2,1) = Array(249,250,245)
arrPosRes(0,2,2) = Array(253,244,205)
arrPosRes(0,2,3) = Array(244,0,0)
arrPosRes(0,2,4) = Array(255,2,0)
arrPosRes(0,2,5) = Array(255,2,0)
arrPosRes(0,2,6) = Array(243,0,0)
arrPosRes(0,2,7) = Array(255,241,228)
arrPosRes(0,2,8) = Array(247,243,240)
arrPosRes(0,2,9) = Array(253,1,0)
arrPosRes(0,3,0) = Array(254,5,1)
arrPosRes(0,3,1) = Array(227,254,223)
arrPosRes(0,3,2) = Array(234,237,228)
arrPosRes(0,3,3) = Array(239,22,49)
arrPosRes(0,3,4) = Array(252,0,20)
arrPosRes(0,3,5) = Array(255,8,24)
arrPosRes(0,3,6) = Array(231,1,13)
arrPosRes(0,3,7) = Array(254,255,255)
arrPosRes(0,3,8) = Array(255,255,255)
arrPosRes(0,3,9) = Array(252,5,0)
arrPosRes(0,4,0) = Array(251,1,28)
arrPosRes(0,4,1) = Array(246,247,242)
arrPosRes(0,4,2) = Array(249,255,255)
arrPosRes(0,4,3) = Array(245,239,241)
arrPosRes(0,4,4) = Array(228,243,212)
arrPosRes(0,4,5) = Array(225,253,231)
arrPosRes(0,4,6) = Array(249,250,252)
arrPosRes(0,4,7) = Array(246,236,234)
arrPosRes(0,4,8) = Array(240,243,250)
arrPosRes(0,4,9) = Array(253,1,0)
arrPosRes(0,5,0) = Array(234,252,236)
arrPosRes(0,5,1) = Array(254,5,37)
arrPosRes(0,5,2) = Array(237,1,3)
arrPosRes(0,5,3) = Array(254,5,3)
arrPosRes(0,5,4) = Array(255,10,0)
arrPosRes(0,5,5) = Array(233,10,11)
arrPosRes(0,5,6) = Array(246,0,11)
arrPosRes(0,5,7) = Array(255,7,7)
arrPosRes(0,5,8) = Array(255,2,2)
arrPosRes(0,5,9) = Array(239,245,243)
arrPosRes(1,0,0) = Array(246,253,237)
arrPosRes(1,0,1) = Array(250,0,1)
arrPosRes(1,0,2) = Array(252,0,2)
arrPosRes(1,0,3) = Array(254,247,254)
arrPosRes(1,0,4) = Array(255,254,255)
arrPosRes(1,0,5) = Array(255,253,254)
arrPosRes(1,0,6) = Array(236,255,233)
arrPosRes(1,0,7) = Array(254,255,253)
arrPosRes(1,0,8) = Array(246,247,242)
arrPosRes(1,0,9) = Array(254,0,0)
arrPosRes(1,1,0) = Array(238,241,248)
arrPosRes(1,1,1) = Array(239,25,17)
arrPosRes(1,1,2) = Array(251,233,247)
arrPosRes(1,1,3) = Array(254,255,253)
arrPosRes(1,1,4) = Array(253,252,224)
arrPosRes(1,1,5) = Array(254,255,255)
arrPosRes(1,1,6) = Array(242,253,255)
arrPosRes(1,1,7) = Array(224,255,213)
arrPosRes(1,1,8) = Array(243,241,246)
arrPosRes(1,1,9) = Array(255,3,0)
arrPosRes(1,2,0) = Array(239,6,9)
arrPosRes(1,2,1) = Array(246,2,4)
arrPosRes(1,2,2) = Array(253,4,24)
arrPosRes(1,2,3) = Array(242,2,31)
arrPosRes(1,2,4) = Array(249,0,8)
arrPosRes(1,2,5) = Array(255,9,30)
arrPosRes(1,2,6) = Array(242,0,1)
arrPosRes(1,2,7) = Array(255,4,9)
arrPosRes(1,2,8) = Array(249,4,0)
arrPosRes(1,2,9) = Array(255,1,3)
arrPosRes(1,3,0) = Array(255,255,255)
arrPosRes(1,3,1) = Array(234,254,219)
arrPosRes(1,3,2) = Array(232,247,254)
arrPosRes(1,3,3) = Array(244,238,252)
arrPosRes(1,3,4) = Array(255,245,247)
arrPosRes(1,3,5) = Array(249,236,228)
arrPosRes(1,3,6) = Array(255,251,255)
arrPosRes(1,3,7) = Array(254,255,255)
arrPosRes(1,3,8) = Array(240,245,248)
arrPosRes(1,3,9) = Array(252,0,11)
arrPosRes(1,4,0) = Array(255,235,234)
arrPosRes(1,4,1) = Array(254,242,218)
arrPosRes(1,4,2) = Array(248,255,235)
arrPosRes(1,4,3) = Array(241,239,227)
arrPosRes(1,4,4) = Array(239,254,233)
arrPosRes(1,4,5) = Array(254,255,255)
arrPosRes(1,4,6) = Array(234,236,248)
arrPosRes(1,4,7) = Array(254,254,252)
arrPosRes(1,4,8) = Array(249,247,234)
arrPosRes(1,4,9) = Array(254,0,0)
arrPosRes(1,5,0) = Array(240,247,255)
arrPosRes(1,5,1) = Array(219,255,253)
arrPosRes(1,5,2) = Array(238,248,237)
arrPosRes(1,5,3) = Array(248,255,204)
arrPosRes(1,5,4) = Array(255,254,255)
arrPosRes(1,5,5) = Array(251,235,245)
arrPosRes(1,5,6) = Array(239,255,254)
arrPosRes(1,5,7) = Array(238,231,239)
arrPosRes(1,5,8) = Array(240,245,241)
arrPosRes(1,5,9) = Array(250,241,242)
arrPosRes(2,0,0) = Array(246,245,250)
arrPosRes(2,0,1) = Array(236,3,0)
arrPosRes(2,0,2) = Array(255,4,21)
arrPosRes(2,0,3) = Array(252,251,230)
arrPosRes(2,0,4) = Array(254,255,255)
arrPosRes(2,0,5) = Array(250,247,255)
arrPosRes(2,0,6) = Array(248,247,243)
arrPosRes(2,0,7) = Array(224,254,252)
arrPosRes(2,0,8) = Array(254,2,0)
arrPosRes(2,0,9) = Array(253,0,3)
arrPosRes(2,1,0) = Array(246,0,1)
arrPosRes(2,1,1) = Array(255,254,224)
arrPosRes(2,1,2) = Array(243,243,245)
arrPosRes(2,1,3) = Array(246,233,242)
arrPosRes(2,1,4) = Array(255,244,254)
arrPosRes(2,1,5) = Array(244,240,229)
arrPosRes(2,1,6) = Array(246,249,220)
arrPosRes(2,1,7) = Array(254,4,5)
arrPosRes(2,1,8) = Array(230,250,251)
arrPosRes(2,1,9) = Array(255,1,5)
arrPosRes(2,2,0) = Array(255,0,42)
arrPosRes(2,2,1) = Array(239,255,229)
arrPosRes(2,2,2) = Array(230,235,203)
arrPosRes(2,2,3) = Array(241,255,230)
arrPosRes(2,2,4) = Array(242,249,255)
arrPosRes(2,2,5) = Array(237,248,252)
arrPosRes(2,2,6) = Array(250,0,1)
arrPosRes(2,2,7) = Array(255,255,253)
arrPosRes(2,2,8) = Array(253,242,238)
arrPosRes(2,2,9) = Array(252,0,0)
arrPosRes(2,3,0) = Array(231,1,29)
arrPosRes(2,3,1) = Array(252,239,230)
arrPosRes(2,3,2) = Array(255,251,255)
arrPosRes(2,3,3) = Array(255,255,255)
arrPosRes(2,3,4) = Array(246,235,241)
arrPosRes(2,3,5) = Array(243,15,16)
arrPosRes(2,3,6) = Array(249,233,255)
arrPosRes(2,3,7) = Array(255,253,255)
arrPosRes(2,3,8) = Array(245,250,230)
arrPosRes(2,3,9) = Array(253,5,5)
arrPosRes(2,4,0) = Array(255,1,15)
arrPosRes(2,4,1) = Array(255,232,255)
arrPosRes(2,4,2) = Array(255,255,253)
arrPosRes(2,4,3) = Array(227,255,225)
arrPosRes(2,4,4) = Array(249,11,0)
arrPosRes(2,4,5) = Array(255,239,251)
arrPosRes(2,4,6) = Array(238,240,237)
arrPosRes(2,4,7) = Array(255,255,253)
arrPosRes(2,4,8) = Array(244,242,245)
arrPosRes(2,4,9) = Array(252,4,5)
arrPosRes(2,5,0) = Array(241,248,206)
arrPosRes(2,5,1) = Array(223,20,14)
arrPosRes(2,5,2) = Array(255,2,56)
arrPosRes(2,5,3) = Array(243,0,0)
arrPosRes(2,5,4) = Array(241,243,255)
arrPosRes(2,5,5) = Array(233,242,221)
arrPosRes(2,5,6) = Array(254,250,247)
arrPosRes(2,5,7) = Array(246,234,222)
arrPosRes(2,5,8) = Array(254,2,0)
arrPosRes(2,5,9) = Array(252,0,1)
arrPosRes(3,0,0) = Array(255,239,255)
arrPosRes(3,0,1) = Array(251,6,13)
arrPosRes(3,0,2) = Array(247,0,11)
arrPosRes(3,0,3) = Array(240,255,226)
arrPosRes(3,0,4) = Array(240,249,254)
arrPosRes(3,0,5) = Array(235,255,217)
arrPosRes(3,0,6) = Array(254,242,254)
arrPosRes(3,0,7) = Array(252,0,0)
arrPosRes(3,0,8) = Array(253,0,2)
arrPosRes(3,0,9) = Array(239,252,245)
arrPosRes(3,1,0) = Array(241,7,0)
arrPosRes(3,1,1) = Array(243,240,235)
arrPosRes(3,1,2) = Array(255,250,255)
arrPosRes(3,1,3) = Array(246,232,249)
arrPosRes(3,1,4) = Array(236,243,235)
arrPosRes(3,1,5) = Array(241,236,255)
arrPosRes(3,1,6) = Array(225,255,255)
arrPosRes(3,1,7) = Array(234,239,243)
arrPosRes(3,1,8) = Array(250,249,244)
arrPosRes(3,1,9) = Array(249,0,0)
arrPosRes(3,2,0) = Array(255,1,5)
arrPosRes(3,2,1) = Array(248,236,210)
arrPosRes(3,2,2) = Array(255,255,255)
arrPosRes(3,2,3) = Array(237,241,216)
arrPosRes(3,2,4) = Array(254,3,22)
arrPosRes(3,2,5) = Array(254,235,228)
arrPosRes(3,2,6) = Array(254,245,228)
arrPosRes(3,2,7) = Array(253,255,254)
arrPosRes(3,2,8) = Array(244,245,250)
arrPosRes(3,2,9) = Array(254,2,1)
arrPosRes(3,3,0) = Array(248,9,2)
arrPosRes(3,3,1) = Array(222,251,246)
arrPosRes(3,3,2) = Array(238,252,255)
arrPosRes(3,3,3) = Array(251,5,20)
arrPosRes(3,3,4) = Array(220,10,9)
arrPosRes(3,3,5) = Array(250,252,215)
arrPosRes(3,3,6) = Array(255,233,229)
arrPosRes(3,3,7) = Array(229,241,255)
arrPosRes(3,3,8) = Array(242,249,242)
arrPosRes(3,3,9) = Array(252,0,1)
arrPosRes(3,4,0) = Array(254,1,3)
arrPosRes(3,4,1) = Array(255,236,255)
arrPosRes(3,4,2) = Array(237,240,229)
arrPosRes(3,4,3) = Array(255,0,25)
arrPosRes(3,4,4) = Array(255,241,218)
arrPosRes(3,4,5) = Array(254,7,0)
arrPosRes(3,4,6) = Array(219,255,241)
arrPosRes(3,4,7) = Array(244,248,255)
arrPosRes(3,4,8) = Array(236,242,254)
arrPosRes(3,4,9) = Array(254,5,0)
arrPosRes(3,5,0) = Array(254,240,237)
arrPosRes(3,5,1) = Array(243,0,0)
arrPosRes(3,5,2) = Array(246,11,16)
arrPosRes(3,5,3) = Array(236,255,225)
arrPosRes(3,5,4) = Array(245,248,227)
arrPosRes(3,5,5) = Array(254,0,11)
arrPosRes(3,5,6) = Array(232,3,0)
arrPosRes(3,5,7) = Array(253,1,0)
arrPosRes(3,5,8) = Array(255,1,1)
arrPosRes(3,5,9) = Array(242,244,243)
arrPosRes(4,0,0) = Array(252,244,221)
arrPosRes(4,0,1) = Array(230,244,253)
arrPosRes(4,0,2) = Array(249,243,255)
arrPosRes(4,0,3) = Array(236,245,226)
arrPosRes(4,0,4) = Array(234,10,0)
arrPosRes(4,0,5) = Array(255,2,30)
arrPosRes(4,0,6) = Array(245,0,0)
arrPosRes(4,0,7) = Array(247,253,251)
arrPosRes(4,0,8) = Array(249,242,249)
arrPosRes(4,0,9) = Array(248,249,243)
arrPosRes(4,1,0) = Array(253,247,249)
arrPosRes(4,1,1) = Array(251,243,255)
arrPosRes(4,1,2) = Array(255,233,220)
arrPosRes(4,1,3) = Array(254,8,13)
arrPosRes(4,1,4) = Array(250,251,235)
arrPosRes(4,1,5) = Array(238,244,232)
arrPosRes(4,1,6) = Array(240,7,10)
arrPosRes(4,1,7) = Array(237,248,218)
arrPosRes(4,1,8) = Array(244,247,255)
arrPosRes(4,1,9) = Array(241,243,242)
arrPosRes(4,2,0) = Array(244,236,223)
arrPosRes(4,2,1) = Array(239,244,247)
arrPosRes(4,2,2) = Array(241,13,40)
arrPosRes(4,2,3) = Array(255,234,233)
arrPosRes(4,2,4) = Array(243,243,231)
arrPosRes(4,2,5) = Array(229,251,228)
arrPosRes(4,2,6) = Array(255,15,0)
arrPosRes(4,2,7) = Array(251,232,254)
arrPosRes(4,2,8) = Array(250,0,1)
arrPosRes(4,2,9) = Array(254,3,10)
arrPosRes(4,3,0) = Array(237,15,2)
arrPosRes(4,3,1) = Array(253,0,8)
arrPosRes(4,3,2) = Array(247,0,8)
arrPosRes(4,3,3) = Array(251,1,3)
arrPosRes(4,3,4) = Array(249,1,1)
arrPosRes(4,3,5) = Array(254,1,21)
arrPosRes(4,3,6) = Array(230,2,0)
arrPosRes(4,3,7) = Array(255,5,15)
arrPosRes(4,3,8) = Array(252,10,9)
arrPosRes(4,3,9) = Array(249,0,0)
arrPosRes(4,4,0) = Array(247,253,241)
arrPosRes(4,4,1) = Array(255,232,228)
arrPosRes(4,4,2) = Array(252,254,240)
arrPosRes(4,4,3) = Array(242,237,218)
arrPosRes(4,4,4) = Array(248,255,247)
arrPosRes(4,4,5) = Array(255,240,245)
arrPosRes(4,4,6) = Array(243,2,44)
arrPosRes(4,4,7) = Array(239,242,247)
arrPosRes(4,4,8) = Array(249,239,247)
arrPosRes(4,4,9) = Array(253,4,0)
arrPosRes(4,5,0) = Array(254,255,255)
arrPosRes(4,5,1) = Array(255,243,253)
arrPosRes(4,5,2) = Array(227,242,209)
arrPosRes(4,5,3) = Array(254,255,253)
arrPosRes(4,5,4) = Array(255,254,255)
arrPosRes(4,5,5) = Array(227,255,254)
arrPosRes(4,5,6) = Array(255,4,11)
arrPosRes(4,5,7) = Array(250,246,219)
arrPosRes(4,5,8) = Array(243,249,249)
arrPosRes(4,5,9) = Array(254,2,0)
arrPosRes(5,0,0) = Array(250,9,2)
arrPosRes(5,0,1) = Array(248,0,0)
arrPosRes(5,0,2) = Array(251,0,0)
arrPosRes(5,0,3) = Array(226,17,10)
arrPosRes(5,0,4) = Array(252,0,0)
arrPosRes(5,0,5) = Array(250,233,239)
arrPosRes(5,0,6) = Array(255,239,255)
arrPosRes(5,0,7) = Array(245,0,0)
arrPosRes(5,0,8) = Array(252,0,0)
arrPosRes(5,0,9) = Array(240,251,245)
arrPosRes(5,1,0) = Array(251,0,11)
arrPosRes(5,1,1) = Array(249,242,236)
arrPosRes(5,1,2) = Array(232,255,255)
arrPosRes(5,1,3) = Array(255,229,241)
arrPosRes(5,1,4) = Array(245,12,15)
arrPosRes(5,1,5) = Array(247,244,237)
arrPosRes(5,1,6) = Array(230,251,244)
arrPosRes(5,1,7) = Array(241,251,227)
arrPosRes(5,1,8) = Array(250,249,245)
arrPosRes(5,1,9) = Array(249,0,0)
arrPosRes(5,2,0) = Array(244,12,0)
arrPosRes(5,2,1) = Array(243,246,237)
arrPosRes(5,2,2) = Array(234,255,255)
arrPosRes(5,2,3) = Array(230,0,47)
arrPosRes(5,2,4) = Array(252,254,207)
arrPosRes(5,2,5) = Array(255,244,237)
arrPosRes(5,2,6) = Array(240,239,237)
arrPosRes(5,2,7) = Array(245,241,255)
arrPosRes(5,2,8) = Array(244,245,250)
arrPosRes(5,2,9) = Array(254,1,0)
arrPosRes(5,3,0) = Array(255,1,24)
arrPosRes(5,3,1) = Array(246,234,244)
arrPosRes(5,3,2) = Array(240,239,253)
arrPosRes(5,3,3) = Array(255,17,21)
arrPosRes(5,3,4) = Array(243,225,251)
arrPosRes(5,3,5) = Array(247,246,242)
arrPosRes(5,3,6) = Array(232,249,241)
arrPosRes(5,3,7) = Array(255,246,234)
arrPosRes(5,3,8) = Array(242,248,244)
arrPosRes(5,3,9) = Array(252,0,0)
arrPosRes(5,4,0) = Array(233,7,0)
arrPosRes(5,4,1) = Array(255,255,236)
arrPosRes(5,4,2) = Array(255,236,239)
arrPosRes(5,4,3) = Array(245,0,0)
arrPosRes(5,4,4) = Array(251,249,255)
arrPosRes(5,4,5) = Array(230,246,235)
arrPosRes(5,4,6) = Array(245,255,252)
arrPosRes(5,4,7) = Array(230,255,234)
arrPosRes(5,4,8) = Array(236,243,253)
arrPosRes(5,4,9) = Array(255,5,0)
arrPosRes(5,5,0) = Array(253,0,1)
arrPosRes(5,5,1) = Array(243,228,247)
arrPosRes(5,5,2) = Array(246,253,255)
arrPosRes(5,5,3) = Array(249,244,206)
arrPosRes(5,5,4) = Array(252,0,3)
arrPosRes(5,5,5) = Array(222,22,24)
arrPosRes(5,5,6) = Array(246,0,8)
arrPosRes(5,5,7) = Array(251,0,25)
arrPosRes(5,5,8) = Array(255,1,1)
arrPosRes(5,5,9) = Array(242,244,243)
arrPosRes(6,0,0) = Array(241,251,255)
arrPosRes(6,0,1) = Array(255,224,223)
arrPosRes(6,0,2) = Array(246,4,3)
arrPosRes(6,0,3) = Array(249,2,0)
arrPosRes(6,0,4) = Array(254,8,0)
arrPosRes(6,0,5) = Array(245,0,0)
arrPosRes(6,0,6) = Array(254,8,0)
arrPosRes(6,0,7) = Array(255,2,8)
arrPosRes(6,0,8) = Array(252,0,0)
arrPosRes(6,0,9) = Array(240,251,245)
arrPosRes(6,1,0) = Array(251,0,6)
arrPosRes(6,1,1) = Array(255,15,0)
arrPosRes(6,1,2) = Array(232,249,213)
arrPosRes(6,1,3) = Array(242,244,255)
arrPosRes(6,1,4) = Array(255,1,3)
arrPosRes(6,1,5) = Array(244,19,17)
arrPosRes(6,1,6) = Array(235,246,238)
arrPosRes(6,1,7) = Array(245,238,245)
arrPosRes(6,1,8) = Array(250,249,245)
arrPosRes(6,1,9) = Array(249,0,0)
arrPosRes(6,2,0) = Array(239,10,4)
arrPosRes(6,2,1) = Array(250,222,221)
arrPosRes(6,2,2) = Array(238,255,255)
arrPosRes(6,2,3) = Array(235,255,244)
arrPosRes(6,2,4) = Array(252,0,19)
arrPosRes(6,2,5) = Array(238,242,245)
arrPosRes(6,2,6) = Array(255,238,247)
arrPosRes(6,2,7) = Array(255,247,226)
arrPosRes(6,2,8) = Array(244,245,250)
arrPosRes(6,2,9) = Array(254,1,0)
arrPosRes(6,3,0) = Array(254,1,22)
arrPosRes(6,3,1) = Array(248,247,255)
arrPosRes(6,3,2) = Array(231,251,249)
arrPosRes(6,3,3) = Array(250,232,254)
arrPosRes(6,3,4) = Array(245,10,7)
arrPosRes(6,3,5) = Array(246,238,249)
arrPosRes(6,3,6) = Array(250,247,242)
arrPosRes(6,3,7) = Array(245,244,240)
arrPosRes(6,3,8) = Array(242,248,244)
arrPosRes(6,3,9) = Array(252,0,0)
arrPosRes(6,4,0) = Array(255,4,0)
arrPosRes(6,4,1) = Array(235,236,230)
arrPosRes(6,4,2) = Array(255,248,255)
arrPosRes(6,4,3) = Array(251,255,230)
arrPosRes(6,4,4) = Array(252,0,1)
arrPosRes(6,4,5) = Array(242,248,246)
arrPosRes(6,4,6) = Array(241,238,255)
arrPosRes(6,4,7) = Array(217,255,233)
arrPosRes(6,4,8) = Array(236,243,253)
arrPosRes(6,4,9) = Array(255,5,0)
arrPosRes(6,5,0) = Array(255,241,240)
arrPosRes(6,5,1) = Array(240,21,53)
arrPosRes(6,5,2) = Array(247,221,232)
arrPosRes(6,5,3) = Array(246,248,245)
arrPosRes(6,5,4) = Array(253,242,224)
arrPosRes(6,5,5) = Array(255,10,0)
arrPosRes(6,5,6) = Array(251,0,0)
arrPosRes(6,5,7) = Array(250,8,24)
arrPosRes(6,5,8) = Array(255,1,1)
arrPosRes(6,5,9) = Array(242,244,243)
arrPosRes(7,0,0) = Array(255,6,18)
arrPosRes(7,0,1) = Array(249,0,1)
arrPosRes(7,0,2) = Array(233,3,6)
arrPosRes(7,0,3) = Array(254,245,246)
arrPosRes(7,0,4) = Array(255,242,249)
arrPosRes(7,0,5) = Array(254,244,232)
arrPosRes(7,0,6) = Array(245,236,255)
arrPosRes(7,0,7) = Array(247,246,252)
arrPosRes(7,0,8) = Array(239,246,252)
arrPosRes(7,0,9) = Array(241,247,233)
arrPosRes(7,1,0) = Array(228,7,0)
arrPosRes(7,1,1) = Array(251,241,252)
arrPosRes(7,1,2) = Array(250,254,255)
arrPosRes(7,1,3) = Array(229,232,221)
arrPosRes(7,1,4) = Array(231,255,241)
arrPosRes(7,1,5) = Array(245,238,232)
arrPosRes(7,1,6) = Array(231,253,241)
arrPosRes(7,1,7) = Array(241,255,222)
arrPosRes(7,1,8) = Array(255,231,255)
arrPosRes(7,1,9) = Array(239,251,247)
arrPosRes(7,2,0) = Array(237,7,7)
arrPosRes(7,2,1) = Array(253,246,228)
arrPosRes(7,2,2) = Array(255,229,208)
arrPosRes(7,2,3) = Array(238,255,255)
arrPosRes(7,2,4) = Array(255,246,244)
arrPosRes(7,2,5) = Array(229,10,16)
arrPosRes(7,2,6) = Array(255,0,14)
arrPosRes(7,2,7) = Array(243,2,21)
arrPosRes(7,2,8) = Array(249,0,4)
arrPosRes(7,2,9) = Array(251,2,0)
arrPosRes(7,3,0) = Array(244,0,7)
arrPosRes(7,3,1) = Array(244,254,245)
arrPosRes(7,3,2) = Array(254,241,225)
arrPosRes(7,3,3) = Array(230,0,15)
arrPosRes(7,3,4) = Array(255,4,17)
arrPosRes(7,3,5) = Array(241,238,231)
arrPosRes(7,3,6) = Array(232,249,255)
arrPosRes(7,3,7) = Array(254,254,200)
arrPosRes(7,3,8) = Array(251,242,247)
arrPosRes(7,3,9) = Array(242,246,247)
arrPosRes(7,4,0) = Array(255,18,2)
arrPosRes(7,4,1) = Array(249,0,6)
arrPosRes(7,4,2) = Array(251,1,39)
arrPosRes(7,4,3) = Array(251,252,247)
arrPosRes(7,4,4) = Array(239,245,235)
arrPosRes(7,4,5) = Array(252,250,238)
arrPosRes(7,4,6) = Array(255,244,242)
arrPosRes(7,4,7) = Array(255,255,255)
arrPosRes(7,4,8) = Array(252,249,232)
arrPosRes(7,4,9) = Array(244,244,246)
arrPosRes(7,5,0) = Array(235,0,13)
arrPosRes(7,5,1) = Array(255,239,255)
arrPosRes(7,5,2) = Array(239,244,250)
arrPosRes(7,5,3) = Array(253,229,242)
arrPosRes(7,5,4) = Array(255,235,244)
arrPosRes(7,5,5) = Array(242,251,248)
arrPosRes(7,5,6) = Array(223,253,255)
arrPosRes(7,5,7) = Array(224,249,255)
arrPosRes(7,5,8) = Array(243,243,243)
arrPosRes(7,5,9) = Array(255,255,255)
arrPosRes(8,0,0) = Array(253,239,255)
arrPosRes(8,0,1) = Array(245,1,0)
arrPosRes(8,0,2) = Array(239,3,5)
arrPosRes(8,0,3) = Array(251,0,0)
arrPosRes(8,0,4) = Array(234,255,254)
arrPosRes(8,0,5) = Array(240,9,1)
arrPosRes(8,0,6) = Array(251,2,0)
arrPosRes(8,0,7) = Array(255,1,0)
arrPosRes(8,0,8) = Array(253,0,2)
arrPosRes(8,0,9) = Array(239,252,245)
arrPosRes(8,1,0) = Array(249,1,0)
arrPosRes(8,1,1) = Array(238,252,237)
arrPosRes(8,1,2) = Array(240,254,255)
arrPosRes(8,1,3) = Array(255,255,229)
arrPosRes(8,1,4) = Array(248,0,1)
arrPosRes(8,1,5) = Array(253,255,254)
arrPosRes(8,1,6) = Array(255,255,255)
arrPosRes(8,1,7) = Array(245,250,227)
arrPosRes(8,1,8) = Array(250,249,244)
arrPosRes(8,1,9) = Array(249,0,0)
arrPosRes(8,2,0) = Array(254,0,26)
arrPosRes(8,2,1) = Array(226,255,228)
arrPosRes(8,2,2) = Array(237,247,213)
arrPosRes(8,2,3) = Array(255,226,228)
arrPosRes(8,2,4) = Array(251,2,6)
arrPosRes(8,2,5) = Array(252,251,255)
arrPosRes(8,2,6) = Array(243,226,234)
arrPosRes(8,2,7) = Array(255,0,26)
arrPosRes(8,2,8) = Array(244,245,250)
arrPosRes(8,2,9) = Array(254,2,1)
arrPosRes(8,3,0) = Array(251,8,12)
arrPosRes(8,3,1) = Array(247,246,226)
arrPosRes(8,3,2) = Array(250,0,38)
arrPosRes(8,3,3) = Array(249,253,252)
arrPosRes(8,3,4) = Array(241,0,11)
arrPosRes(8,3,5) = Array(255,237,249)
arrPosRes(8,3,6) = Array(245,255,224)
arrPosRes(8,3,7) = Array(253,242,240)
arrPosRes(8,3,8) = Array(242,249,242)
arrPosRes(8,3,9) = Array(252,0,1)
arrPosRes(8,4,0) = Array(250,0,2)
arrPosRes(8,4,1) = Array(255,5,6)
arrPosRes(8,4,2) = Array(244,232,242)
arrPosRes(8,4,3) = Array(255,245,253)
arrPosRes(8,4,4) = Array(253,0,18)
arrPosRes(8,4,5) = Array(245,9,0)
arrPosRes(8,4,6) = Array(229,244,237)
arrPosRes(8,4,7) = Array(254,234,243)
arrPosRes(8,4,8) = Array(236,242,254)
arrPosRes(8,4,9) = Array(254,5,0)
arrPosRes(8,5,0) = Array(226,255,207)
arrPosRes(8,5,1) = Array(255,0,21)
arrPosRes(8,5,2) = Array(230,20,21)
arrPosRes(8,5,3) = Array(252,0,1)
arrPosRes(8,5,4) = Array(239,247,234)
arrPosRes(8,5,5) = Array(240,243,216)
arrPosRes(8,5,6) = Array(234,12,49)
arrPosRes(8,5,7) = Array(254,1,6)
arrPosRes(8,5,8) = Array(255,1,1)
arrPosRes(8,5,9) = Array(242,244,243)
arrPosRes(9,0,0) = Array(251,240,246)
arrPosRes(9,0,1) = Array(254,1,6)
arrPosRes(9,0,2) = Array(255,5,0)
arrPosRes(9,0,3) = Array(250,0,1)
arrPosRes(9,0,4) = Array(248,0,7)
arrPosRes(9,0,5) = Array(255,244,242)
arrPosRes(9,0,6) = Array(235,234,252)
arrPosRes(9,0,7) = Array(255,243,255)
arrPosRes(9,0,8) = Array(252,0,1)
arrPosRes(9,0,9) = Array(246,247,252)
arrPosRes(9,1,0) = Array(243,6,0)
arrPosRes(9,1,1) = Array(252,244,255)
arrPosRes(9,1,2) = Array(236,247,243)
arrPosRes(9,1,3) = Array(231,245,246)
arrPosRes(9,1,4) = Array(255,255,251)
arrPosRes(9,1,5) = Array(237,0,10)
arrPosRes(9,1,6) = Array(241,255,219)
arrPosRes(9,1,7) = Array(244,246,243)
arrPosRes(9,1,8) = Array(246,246,246)
arrPosRes(9,1,9) = Array(252,0,0)
arrPosRes(9,2,0) = Array(240,9,3)
arrPosRes(9,2,1) = Array(255,238,234)
arrPosRes(9,2,2) = Array(252,245,229)
arrPosRes(9,2,3) = Array(255,231,253)
arrPosRes(9,2,4) = Array(247,241,229)
arrPosRes(9,2,5) = Array(255,3,32)
arrPosRes(9,2,6) = Array(233,243,252)
arrPosRes(9,2,7) = Array(247,245,248)
arrPosRes(9,2,8) = Array(251,241,240)
arrPosRes(9,2,9) = Array(249,4,3)
arrPosRes(9,3,0) = Array(241,7,8)
arrPosRes(9,3,1) = Array(249,246,255)
arrPosRes(9,3,2) = Array(238,250,214)
arrPosRes(9,3,3) = Array(252,251,255)
arrPosRes(9,3,4) = Array(245,236,229)
arrPosRes(9,3,5) = Array(255,7,3)
arrPosRes(9,3,6) = Array(248,241,233)
arrPosRes(9,3,7) = Array(250,253,224)
arrPosRes(9,3,8) = Array(244,247,240)
arrPosRes(9,3,9) = Array(254,0,3)
arrPosRes(9,4,0) = Array(238,255,244)
arrPosRes(9,4,1) = Array(238,0,2)
arrPosRes(9,4,2) = Array(255,245,254)
arrPosRes(9,4,3) = Array(249,237,225)
arrPosRes(9,4,4) = Array(245,4,23)
arrPosRes(9,4,5) = Array(230,245,250)
arrPosRes(9,4,6) = Array(245,248,231)
arrPosRes(9,4,7) = Array(252,236,249)
arrPosRes(9,4,8) = Array(254,1,3)
arrPosRes(9,4,9) = Array(244,243,239)
arrPosRes(9,5,0) = Array(255,225,230)
arrPosRes(9,5,1) = Array(249,241,255)
arrPosRes(9,5,2) = Array(250,0,2)
arrPosRes(9,5,3) = Array(233,18,0)
arrPosRes(9,5,4) = Array(255,1,29)
arrPosRes(9,5,5) = Array(251,4,0)
arrPosRes(9,5,6) = Array(252,2,3)
arrPosRes(9,5,7) = Array(245,1,13)
arrPosRes(9,5,8) = Array(255,255,255)
arrPosRes(9,5,9) = Array(244,249,252)
'======================复制于toDic生成的字典======================

sub toDic():dim i,j,k:wscript.echo "dim arrPosRes(9,6,9)":for i = 0 to 9:Jpeg.Open "E:\识别\" & i & ".jpg":for j = 0 to 5:for k = 0 to 9:wscript.echo "arrPosRes(" & i & "," & j & "," & k & ") = Array(" & Jpeg(j,k)(0) & "," & Jpeg(j,k)(1) & "," & Jpeg(j,k)(2) & ")":next:next:next:end sub
'call toDic()  'Cscript //NoLogo a.vbs>a.txt

function getDisNumFormRGBArray(arr1,arr2)
  dim sum1,sum2,tmp1,tmp2
  for j = 0 to 2
    sum1 = sum1 + abs(arr1(j) - arr2(j))
    tmp1 = tmp1 - arr1(j)
    tmp2 = tmp2 - arr2(j)
  next
  sum2 = abs(abs(tmp1) - abs(tmp2))
  getDisNumFormRGBArray = sum2
end function

function getNumFormImageObj(objImage,picWidth,picHeight)
  dim checksum(9),i,w,h,j
  for w = 0 to picWidth - 1
    for h = 0 to picHeight - 1
      for i = 0 to 9
        checksum(i) = checksum(i) + getDisNumFormRGBArray(arrPosRes(i,w,h),objImage(w,h))
      next
    next
  next
  getNumFormImageObj = getMinNumFormArray(checksum)
end function

function getMinNumFormArray(arr)
  dim minNum,minNumValue,i
  minNumValue = arr(0)
  minNum      = 0
  if cfg_Denug = True then wscript.echo "  >" & 0 & ":" & arr(0)  'DEBUG
  for i = 1 to ubound(arr)
    if minNumValue > arr(i) then
      minNumValue = arr(i)
      minNum      = i
    end if
    if cfg_Denug = True then wscript.echo "  >" & i & ":" & arr(i)  'DEBUG
  next
  getMinNumFormArray = minNum
end function

function getNumFormPic(picPath)
  dim i
  for i = 0 to 3
    Jpeg.Open picPath
    Jpeg.Crop (i*10)+2,0,(i*10)+8,10
    getNumFormPic = getNumFormPic & getNumFormImageObj(Jpeg,6,10)
  next
end function

tmpArr = Array("0045","0438","1082","1443","1563","2094","2509","3508","4013","4079","5711","6337","6601","6877","7816","8031","8376","9018","9351","9367")
for each tmpJpeg in tmpArr
  tmpline = tmpline & vbCrlf & tmpJpeg & ":" & getNumFormPic("E:\识别\" & tmpJpeg & ".bmp")
next

wscript.echo tmpline

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.