Ive posted this before.. But the search function will not work for me. I also can't find my posts ? Anyways
Iim counting pixels in a image. I am counting how many red's or black's there are. But my problem is there are different shades. How could i see if the pixel is within range of red for instance ? I forgot how we accomplished it last time..
This is my code so far. Just for checking to see if the pixel is a specific color.
Code:Dim bmp As New Bitmap(picturebox1.Image) Dim b(bmp.Width * bmp.Height - 1) As Integer Dim bd As BitmapData = bmp.LockBits(New Rectangle(Point.Empty, bmp.Size), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb) Marshal.Copy(bd.Scan0, b, 0, b.Length) bmp.UnlockBits(bd) Dim x As Integer = -1, y As Integer = -1 For i As Integer = 0 To b.Length - 1 If b(i) = Color.red.ToArgb Then x = i Mod bmp.Width y = i \ bmp.Width Else counter += 1' Counter counts the # of time's the color is found. End If Next bmp.Dispose()