请帮我解释下这段VB代码
这是一段关于图象匹配的代码.就是有pic1 pic2 两个图象框.Command后看两个图象 匹配的情况.代码如下: Private Sub Command2_Click()
Dim K As Integer, L As Integer, a As Integer, B As Integer, i As Integer, j As Integer
Dim c, Cmax As Single
Dim Xm As Integer, Ym As Integer
Dim Xn As Integer, Yn As Integer
Screen.MousePointer = 11
'MainForm.Picq2.Cls: MainForm.Pich2.Cls
Me.Picture1.Cls: Me.Picture2.Cls
L = 1
a = 100: B = 100
For i = 50 To Me.Picture2.ScaleWidth - 51 Step 2
For j = 50 To Me.Picture2.ScaleHeight - 51 Step 2
c = MCrn(a, B, i, j)
If i = 50 And j = 50 Then
Cmax = c: Xm = i: Ym = j
ElseIf Cmax < c Then Cmax = c: Xm = i: Ym = j
End If
Next
Next i
'计算出匹配点位置 (Xm,Ym) 误差为正负2像素
For i = Xm - 1 To Xm + 1
For j = Ym - 1 To Ym + 1
c = MCrn(a, B, i, j)
If i = Xm - 1 And j = Ym - 1 Then
Cmax = c: Xn = i: Yn = j
ElseIf Cmax < c Then
Cmax = c: Xn = i: Yn = j
End If
Next j
Next i
' (Xn,Yn) 为整像素位置
Screen.MousePointer = 0
Me.Picture1.Circle (a, B), 2, vbRed
Me.Picture2.Circle (Xn, Yn), 2, vbRed
' Label1.Caption = Xm & ", " & Ym
End Sub
我看不太明白.高手解释下,特别是c = MCrn(a, B, i, j)和Cmax = c: Xm = i: Ym = j两行.