Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void поВидуФункцииПреобразованияToolStripMenuItem_Click(object sender, EventArgs e)
- {
- new_image = new Bitmap(image);
- double C = 3.9;
- double val_max = 0;
- for (int i = 0; i < image.Width; ++i)
- {
- for (int j = 0; j < image.Height; ++j)
- {
- double hue, sat, val;
- ColorToHSV(image.GetPixel(i, j), out hue, out sat, out val);
- if (val > val_max)
- val_max = val;
- }
- }
- for (int i = 0; i < image.Width; ++i)
- {
- for (int j = 0; j < image.Height; ++j)
- {
- double hue, sat, val;
- ColorToHSV(image.GetPixel(i, j), out hue, out sat, out val);
- Color c1 = ColorFromHSV(hue, sat, Math.Min(1.0, (Math.Log(val_max + 1)) * Math.Log((val) + 1) * C));
- new_image.SetPixel(i, j, c1);
- }
- }
- pictureBox2.Size = new_image.Size;
- pictureBox2.Image = new_image;
- pictureBox2.Invalidate();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement