Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
PictureBox1.Image = New Bitmap("C:\oleo.jpg")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ScanSendImage(PictureBox1.Image)
PictureBox1.Refresh()
End Sub
Private Function ScanSendImage(ByRef aBitmap As Bitmap) As Array
Dim i As Integer, j As Integer
Dim ColorActual As Integer
Dim Colores(aBitmap.Width - 1, aBitmap.Height - 1) As Boolean
For i = 0 To aBitmap.Width - 1
For j = 0 To aBitmap.Height - 1
ColorActual = aBitmap.GetPixel(i, j).ToArgb()
If Math
.Abs(ColorActual
) < RGB
(128,
128,
128) Then Colores(i, j) = False
aBitmap.SetPixel(i, j, Color.White)
Else
Colores(i, j) = True
aBitmap.SetPixel(i, j, Color.Black)
End If
Next
Next
Return Colores
End Function
End Class