Пример #1
0
        public void Draw(Histogram hist, Graphics gr, Rectangle bounds)
        {
            var w = bounds.Width;
            var kx = 1f / bounds.Width;
            var ky = 1f * bounds.Height;
            var cy = bounds.Top + bounds.Height;
            var cx = bounds.Left;

            var ddd = hist[1f];

            var max = 0f;

            for (float i = 0; i <= 1; i += 1f / w)
            {
                var v = hist[i];
                if (v > max)
                    max = v;
            }

            ky = bounds.Height / max;

            using (var pen = new Pen(ForeColor))
                for (float i = 0; i <= 1; i += 1f/w)
                {
                    var x = i * w;
                    var y = hist[i] * ky;
                    gr.DrawLine(pen, cx + x, cy, cx + x, cy - y);
                }

            using (var pen = new Pen(ForeColor))
                gr.DrawLine(pen, cx, cy, cx + w, cy);
        }
Пример #2
0
        public float Distance(Histogram other)
        {
            if (other == null)
                return 1;
            var size = Size;
            var res = 0f;
            if (size == other.Size)
                for (int i = 0; i < size; i++)
                    res += Math.Abs(values[i] - other.values[i])/255f;
            else
                for (int i = 0; i < size; i++)
                    res += Math.Abs(values[i]/255f - other[1f * i / size]);

            return res / size;
        }
Пример #3
0
 public Tempogram()
 {
     LongTempogram = new Histogram(size);
     ShortTempogram = new Histogram(size);
 }
Пример #4
0
 public Tempogram()
 {
     LongTempogram  = new Histogram(size);
     ShortTempogram = new Histogram(size);
 }