c# - EmguCV-将彩色图像转换为rg色度

标签 c# opencv image-processing emgucv

EmguCV是否提供任何内置功能将彩色图像转换为RG色度(see Wikipedia link)?
提前致谢。

最佳答案

至少在v3.1上,我在EmguCV中找不到任何内置方法。因此,我最终还是采用了旧方法。

Image<Bgr, Byte> img_live = Live_Mat.ToImage<Bgr, Byte>();
            for (int i = 0; i < Live_Mat.Height; i++)
            {
                for (int j = 0; j < Live_Mat.Width; j++)
                {
                    float blue = img_live.Data[i, j, 0];
                    float green = img_live.Data[i, j, 1];
                    float red = img_live.Data[i, j, 2];

                    double sum = red + blue + green;
                    double r = red / sum;
                    double g = green / sum;
                    double b = blue / sum;

                    if (sum == 0)
                    {
                        r = 0;
                        g = 0;
                        b = 0;
                    }


                    img_live.Data[i, j, 0] = System.Convert.ToByte(Math.Round((b * AWB_rgb_mult), 0));
                    img_live.Data[i, j, 1] = System.Convert.ToByte(Math.Round((g * AWB_rgb_mult), 0));
                    img_live.Data[i, j, 2] = System.Convert.ToByte(Math.Round((r * AWB_rgb_mult), 0));


            }

关于c# - EmguCV-将彩色图像转换为rg色度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40779833/

相关文章:

python - 计算图像中白色像素的总数

algorithm - 解释了使用 Mean Shift 进行图像分割

c# - 在 UWP C# 中居中 RelativePanels

c++ - OpenCV - 样本 SVM 的集合

algorithm - OpenCV 中此图像的前瞻性算法方法

c++ - 我可以用 g++ 编译,但得到一个有等效 cmake 的错误程序(GTK 错误)

python - 锐化图像以检测纸上标记为 "X"的对象中的边缘/线条

c# - ASPNET_REGIIS : Place AES key and IV into a KeyContainer

c# - 处理不完整或错误的远程注销

c# - 在 VirtualBox 中运行时无法恢复 Firebird 数据库