Strabo.Core.ImageProcessing.ColorHistogram.getCount C# (CSharp) Method

getCount() public method

public getCount ( int index ) : int
index int
return int
        public int getCount(int index)
        {
            return this.countArray[index];
        }

Usage Example

        void findRepresentativeColors(int K, ColorHistogram colorHist)
        {
            imageColors = new ColorNode[K];
            for (int i = 0; i < K; i++)
            {
                int rgb = colorHist.getColor(i);
                int cnt = colorHist.getCount(i);
                imageColors[i] = new ColorNode(rgb, cnt);
            }

            //if (K <= qnum_list[0]) // image has fewer colors than Kmax
            //    rCols = imageColors;
            //else
            {
                ColorBox initialBox = new ColorBox(0, K - 1, 0, imageColors);
                List<ColorBox> colorSet = new List<ColorBox>();
                colorSet.Add(initialBox);
                int k = 1;
                for (int i = 0; i < qnum_list.Count; i++)
                {
                    int Kmax = qnum_list[i];
                    bool done = false;
                    while (k < Kmax && !done)
                    {
                        ColorBox nextBox = findBoxToSplit(colorSet);
                        if (nextBox != null)
                        {
                            ColorBox newBox = nextBox.splitBox();
                            colorSet.Add(newBox);
                            k = k + 1;
                        }
                        else
                        {
                            done = true;
                        }
                    }
                    quantColors_list.Add(averageColors(colorSet,i));
                }
            }
            colorHist = null;
            GC.Collect();
        }