Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Medin(ref Color col,int x,int y,int h,int w)
- {
- Color c; int p = 0; int X, Y;
- int[] rg, bg, gg;
- rg = new int[9]; bg = new int[9]; gg = new int[9];
- for (int i = -1; i <= 1; ++i)
- {
- for (int j = -1; j <= 1; ++j)
- {
- X = x + j; Y = y + i;
- if (x + j >= w) X = x-j;
- if (x + j < 0) X = x-j;
- if (y + i >= h) Y = y-i;
- if (y + i < 0) Y = y-i;
- c = bmp.GetPixel(X, Y);
- rg[p] = c.R;
- bg[p] = c.B;
- gg[p]=c.G;
- ++p;
- }
- }
- Array.Sort(rg); Array.Sort(bg); Array.Sort(gg);
- col = Color.FromArgb(rg[4], gg[4], bg[4]);
- }
Add Comment
Please, Sign In to add comment