Exemple #1
0
        /// <summary>
        /// Gets the bounds of the histogram bins.
        /// </summary>
        /// <returns>The array of ranges for the histogram bins.</returns>
        public float[][] GetBinRanges()
        {
            var dims   = bins.GetDims();
            var ranges = new float[dims][];

            unsafe
            {
                var hist = (_CvHistogram *)handle.ToPointer();
                if (IsUniform)
                {
                    for (int i = 0; i < ranges.Length; i++)
                    {
                        ranges[i] = new[] { hist->thresh[i * 2], hist->thresh[i * 2 + 1] };
                    }
                }
                else
                {
                    for (int i = 0; i < ranges.Length; i++)
                    {
                        var dimSize = bins.GetDimSize(i);
                        ranges[i] = new float[dimSize * 2];
                        Marshal.Copy((IntPtr)((float **)hist->thresh2)[i], ranges[i], 0, dimSize * 2);
                    }
                }
            }

            return(ranges);
        }