【问题标题】:Color Normalization颜色标准化
【发布时间】:2012-07-22 09:01:45
【问题描述】:

我正在对我的图像进行标准化,并且我已经完成了图像的 RGB 值。任何人都可以帮助我对 c# 代码进行 RGB 规范化,比如一些关于如何写出规范化代码的初学者。谢谢!


private void normalization_Click(object sender, EventArgs e) { // for (int x = 0; x

           // for (int y = 0; y < pictureBox1.Height; y++)
            {


                try
                {
                    Bitmap img = new Bitmap(pictureBox1.Image);
                    Color c;
                    for (int i = 0; i < img.Width; i++)
                    {
                        for (int j = 0; j < img.Height; j++)
                        {
                            c = img.GetPixel(i, j);
                            int r = Convert.ToInt16(c.R);
                            int g = Convert.ToInt16(c.G);
                            int b = Convert.ToInt16(c.B);

                            d = r / (r + g + b);
                            h = g / (r + g + b);
                            f = b / (r + g + b);

                            img.SetPixel(i, j, Color.FromArgb(d, h, f));

                            Color pixelColor = img.GetPixel(i, j);
                            float normalizedPixel = (d + h + f);
                            Color normalizedPixelColor = System.Drawing.ColorConverter.(normalizedPixel);
                            img.SetPixel(x, y, normalizedPixelColor);

                        }
                    }

                }
                catch (Exception ex) { }

嗨。我已经完成了公式和所有规范化。我现在面临的问题是我无法从列表框中获取 RGB 像素的值并使用公式对其进行规范化,然后将像素放回图片框/图像中。以上是我尝试将标准化的 RGB 像素放回图片框的代码。我可以寻求一些帮助吗,因为它仍然无法正常化我的图像。谢谢。

【问题讨论】:

  • 您可能会发现Normalizing Image Brightness in C# 很有用。
  • 嗨。谢谢..我已经看过它并尝试弄清楚如何将其编译到我的程序中,但我无法弄清楚。你还有其他网站吗?哈哈。谢谢!

标签: c# image-processing colors normalization


【解决方案1】:

如果您不介意项目中有依赖项,请查看AForge.NET。作为奖励,您将可以使用大量其他算法,而无需重新发明 for 循环...

【讨论】:

  • 你好。感谢您的网站,但我已经搜索并浏览了,没有特定的主题或样本进行规范化。您还知道更多仅用于 RGB 标准化的网站吗?
猜你喜欢
  • 1970-01-01
  • 2012-11-29
  • 2011-02-12
  • 1970-01-01
  • 2017-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-24
相关资源
最近更新 更多