不用额外插件,最简单的数字识别方法

北城余情 提交于 2019-12-24 10:48:01
Function 文字识别(wzsb_x, wzsb_y, wzsb_ys)
'数字左上角x,y,颜色
/*
1:3,1==2:0,8==4:4,6==7:2,7==8:1,4
3:2,4==5:0,0==6:1,1==9:1,5
12:5,8==47:4,2==56:2,3==38:2,4==09:
*/
    
Dim GetColor
    文字识别=-1
    GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x+5, wzsb_y+8)     '12
    If GetColor = wzsb_ys Then 
        GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x+3, wzsb_y+1) '1
        If GetColor = wzsb_ys Then 
            文字识别 = 1
        Else 
            文字识别 = 2
        End If
        Exit Function 
    End If
    GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x+4, wzsb_y+2)     '47
    If GetColor = wzsb_ys Then 
        GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x+4, wzsb_y+6) '4
        If GetColor = wzsb_ys Then 
            文字识别 = 4
        Else 
            文字识别 = 7
        End If
        Exit Function 
    End If
    GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x+2, wzsb_y+3)   '56
    If GetColor = wzsb_ys Then 
        GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x, wzsb_y)   '5
        If GetColor = wzsb_ys Then 
            文字识别 = 5
        Else 
            文字识别 = 6
        End If
        Exit Function 
    End If
    GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x+2, wzsb_y+4)     '38
    If GetColor = wzsb_ys Then 
        GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x+1, wzsb_y+4) '8
        If GetColor = wzsb_ys Then 
            文字识别 = 8
        Else 
            文字识别 = 3
        End If
        Exit Function 
    End If
    GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x+1, wzsb_y+5)    '09
    If GetColor = wzsb_ys Then 
        文字识别 = 9
    Else 
        GetColor = Plugin.Bkgnd.GetPixelColor(Hwnd, wzsb_x, wzsb_y+5) 
        If GetColor = wzsb_ys Then 
            文字识别 = 0
        End If 
    End If
End Function

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!