Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. private void поВидуФункцииПреобразованияToolStripMenuItem_Click(object sender, EventArgs e)
  2. {
  3. new_image = new Bitmap(image);
  4. double C = 3.9;
  5. double val_max = 0;
  6.  
  7. for (int i = 0; i < image.Width; ++i)
  8. {
  9. for (int j = 0; j < image.Height; ++j)
  10. {
  11. double hue, sat, val;
  12. ColorToHSV(image.GetPixel(i, j), out hue, out sat, out val);
  13. if (val > val_max)
  14. val_max = val;
  15. }
  16. }
  17.  
  18.  
  19. for (int i = 0; i < image.Width; ++i)
  20. {
  21. for (int j = 0; j < image.Height; ++j)
  22. {
  23. double hue, sat, val;
  24. ColorToHSV(image.GetPixel(i, j), out hue, out sat, out val);
  25. Color c1 = ColorFromHSV(hue, sat, Math.Min(1.0, (Math.Log(val_max + 1)) * Math.Log((val) + 1) * C));
  26. new_image.SetPixel(i, j, c1);
  27. }
  28. }
  29. pictureBox2.Size = new_image.Size;
  30. pictureBox2.Image = new_image;
  31. pictureBox2.Invalidate();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement