创建黑白图像像素值直方图C#EmguCv

时间:2014-09-03 16:34:34

标签: c# emgucv

这是我正在使用的代码

        int[] histogram = new int[256];
        for (int i = 0; i < 256; i++)
        {
            histogram[i] = 0;
        }

        for (int i = 0; i < img.Height; i++)
        {
            for (int j = 0; j < img.Width; j++)
            {
                int n = (int)img.Data[i, j, 0];
                histogram[n] = histogram[n] + 1;
                //list.Add(n, hist[n]);
            }
        }

        float sum = 0;
        for (int i = 0; i < 256; i++)
        {
            Console.WriteLine("i = " + i + " hist = " + histogram[i]);
        }

有人可以帮助我,为什么每17个位置总结价值

i = 0 hist = 52
i = 1 hist = 0  
i = 2 hist = 0
i = 3 hist = 0
i = 4 hist = 0  
i = 5 hist = 0
i = 6 hist = 0 
i = 7 hist = 0
i = 8 hist = 0
i = 9 hist = 0
i = 10 hist = 0
i = 11 hist = 0
i = 12 hist = 0 
i = 13 hist = 0 
i = 14 hist = 0 
i = 15 hist = 0
i = 16 hist = 0
i = 17 hist = 1025

等等...... 有人可以帮助我吗

0 个答案:

没有答案