Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // по горизонтали
- for (int y = 0; y < im.Height; y++)
- {
- for (int x = 0; x < im.Width; x++)
- {
- sumR = 0;
- sumG = 0;
- sumB = 0;
- for (int k = 0; k < n; k++)
- {
- cur_x = x - rad + k;
- if (cur_x < 0) cur_x = 0;
- if (cur_x > im.Width - 1) cur_x = im.Width - 1;
- c = im_color[cur_x, y];
- cR = System.Convert.ToInt32(c.R);
- cG = System.Convert.ToInt32(c.G);
- cB = System.Convert.ToInt32(c.B);
- sumR += vect[k] * cR;
- sumG += vect[k] * cG;
- sumB += vect[k] * cB;
- }
- sumR /= sum;
- sumG /= sum;
- sumB /= sum;
- im.SetPixel(x, y, Color.FromArgb((int)sumR, (int)sumG, (int)sumB));
- }
- }
- // по вертикали
- for (int y = 0; y < im.Height; y++)
- {
- for (int x = 0; x < im.Width; x++)
- {
- sumR = 0;
- sumG = 0;
- sumB = 0;
- for (int k = 0; k < n; k++)
- {
- cur_y = y - rad + k;
- if (cur_y < 0) cur_y = 0;
- if (cur_y > im.Height - 1) cur_y = im.Height - 1;
- c = im_color[x, cur_y];
- cR = System.Convert.ToInt32(c.R);
- cG = System.Convert.ToInt32(c.G);
- cB = System.Convert.ToInt32(c.B);
- sumR += vect[k] * cR;
- sumG += vect[k] * cG;
- sumB += vect[k] * cB;
- }
- sumR /= sum;
- sumG /= sum;
- sumB /= sum;
- im.SetPixel(x, y, Color.FromArgb((int)sumR, (int)sumG, (int)sumB));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement