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

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

 

你可能感兴趣的:(不用额外插件,最简单的数字识别方法)