Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void wykrycieWzorca2(Bitmap obrazek)
- {
- int licznikWObszarze = 0;
- for (int i = 0; i < obrazek.Width; i++)
- {
- for (int j = 0; j < obrazek.Height; j++)
- {
- Color Kolor = obrazek.GetPixel(i, j);
- if ((Kolor.R > 250) && (Kolor.G > 150) && (Kolor.B > 35))
- {
- Point Piksel = new Point(i, j);
- if (spelniajaceZalozenia2.Contains(Piksel) == false)
- {
- licznikWObszarze++;
- spelniajaceZalozenia2.Add(Piksel);
- for (int ObszarY = (i - 15); ObszarY < (i + 15); ObszarY++)
- {
- for (int ObszarX = (j - 15); ObszarX < (j + 15); ObszarX++)
- {
- Color Kolor2 = obrazek.GetPixel(ObszarY, ObszarX);
- if ((Kolor2.R > 250) && (Kolor2.G > 150) && (Kolor2.B > 35))
- {
- Point Piksel2 = new Point(ObszarY, ObszarX);
- if (spelniajaceZalozenia2.Contains(Piksel2) == false)
- {
- spelniajaceZalozenia2.Add(Piksel2);
- licznikWObszarze++;
- }
- }
- }
- }
- }
- }
- if (licznikWObszarze < 20)
- {
- spelniajaceZalozenia2.RemoveRange((spelniajaceZalozenia2.Count() - licznikWObszarze), licznikWObszarze);
- }
- licznikWObszarze = 0;
- }
- }
- foreach (Point piksel in spelniajaceZalozenia2)
- {
- obrazek.SetPixel(piksel.X, piksel.Y, Color.Black);
- }
- MessageBox.Show("ilosc piksli " + spelniajaceZalozenia2.Count().ToString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement