- Код: Выделить всё
Option Explicit
Public Pic1(1 to 3, 1 to 320, 1 to 240) as Byte
Public Pic2(1 to 3, 1 to 320, 1 to 240) as Byte
Public Rezultat(1 to 3, 1 to 320, 1 to 240) as Byte
Sub Sravnit_massivy()
Dim k As Byte, x As Long, y As Long
For i = 2 To 320 Step 4
For j = 2 To 240 Step 3
If Module.SR(i, j) = True Then
If Module.SR(i + 2, j) = True Then
For k = 1 To 3
Rezultat(k, i, j) = Pic2(k, i, j)
Rezultat(k, i + 2, j) = Pic2(k, i + 2, j)
Rezultat(k, i - 1, j) = Pic2(k, i - 1, j)
Rezultat(k, i + 1, j) = Pic2(k, i + 1, j)
Next k
For x = -1 To 1 Step 2
For y = -1 To 1 Step 2
If Module.SR(i + x, j + y) = True Then
For k = 1 To 3
Rezultat(k, i + x, j + y) = Pic2(k, i + x, j + y)
Rezultat(k, i + x + 1, j + y) = Pic2(k, i + x + 1, j + y)
Next k
End If
Next y
Next x
End If
End If
Next j
Next i
End Sub
Public Function SR(i, j) As Boolean
If Pic2(1, i, j) > CLng(Pic1(1, i, j)) + 8 Or Pic2(1, i, j) < CLng(Pic1(1, i, j)) - 8 Or_
Pic2(2, i, j) > CLng(Pic1(2, i, j)) + 8 Or Pic2(2, i, j) < CLng(Pic1(2, i, j)) - 8 Or_
Pic2(3, i, j) > CLng(Pic1(3, i, j)) + 8 Or Pic2(3, i, j) < CLng(Pic1(3, i, j)) - 8 Then
SR = True
Else
SR = False
End If
End Function
Заранее спасибо.