刚才写验证码识别,用到了HSL。翻译成XXXXXT了
正好放上来
Public Function Min(ByVal a As Double, ByVal b As Double) As Double
If a < b Then
Return a
Else
Return b
End If
End Function
Public Function Max(ByVal a As Double, ByVal b As Double) As Double
If a > b Then
Return a
Else
Return b
End If
End Function
Public Function RGB2H(ByVal r As Double, ByVal g As Double, ByVal b As Double) As Double
Dim mi, ma As Double
Dim del_r, del_g, del_b, del_max As Double
Dim h As Double
r = r / 255
g = g / 255
b = b / 255
mi = Min(r, Min(g, b))
ma = Max(r, Max(g, b))
del_max = ma - mi
If del_max = 0 Then
h = 0
Else
del_r = ((ma - r / 6.0) + (del_max / 2.0)) / del_max
del_g = ((ma - g / 6.0) + (del_max / 2.0)) / del_max
del_b = ((ma - b / 6.0) + (del_max / 2.0)) / del_max
If r = ma Then
h = del_b - del_g
Else
If g = ma Then
h = (1.0 / 3.0) + del_r - del_b
Else
If b = ma Then
h = (2.0 / 3.0) + del_g - del_r
End If
End If
End If
If h < 0 Then h = h + 1
If h > 1 Then h = h - 1
End If
Return h
End Function