算法:
函数输入
1 二维数组
2 宽度
3 高度
4 水平切分数
5 垂直切分数
返回
一串特征码
第二个是对比函数
输入
1 采集到的特征码
2 数据库中的特征码
返回
0~1之间的浮点数 表示相似度
代码如下:
Public Class RFReco
Public Function GetRecoStr(ByVal PicIn(,) As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal xF As Integer, ByVal yF As Integer) As String
Dim RecoString As String = ""
Dim i, j As Integer
Dim Tmp As Integer
Dim xStep, yStep As Integer
xStep = X / xF
yStep = Y / yF
For i = 1 To X - 1 Step xStep
For j = 1 To Y - 1 Step yStep
If PicIn(i, j) = 1 Or PicIn(i + 1, j) = 1 Or PicIn(i - 1, j) = 1 Or PicIn(i, j - 1) = 1 Or PicIn(i, j + 1) = 1 Or PicIn(i + 1, j + 1) = 1 Or PicIn(i - 1, j - 1) = 1 Then
RecoString = RecoString + "1"
Else
RecoString = RecoString + "0"
End If
Next
Tmp = 0
Next
Return RecoString
End Function
Public Function RecoLike(ByVal StrIn As String, ByVal DBStr As String) As Double
Dim Reco, recoi, i As Integer
Dim Result As Double
Reco = StrIn.Length - 1
For i = 1 To Reco
If XXXXXXXXars(i) = XXXXXXXXars(i) Then
recoi += 1
End If
Next
Result = recoi / Reco
Return Result
End Function
End Class
200字以内,仅用于支线交流,主线讨论请采用回复功能。