Ejemplo n.º 1
0
        public static Complex2D GenerateUniquePixels()
        {
            var result = new Complex2D(16, 16);
            var d      = result.Data;

            for (var i = 0; i < d.Length; i++)
            {
                d[i] = i;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public ComplexImage(Complex2D channel0, Complex2D channel1, Complex2D channel2, bool copy = true)
        {
            if (channel0.Width != channel1.Width ||
                channel0.Width != channel2.Width ||
                channel0.Height != channel1.Height ||
                channel0.Height != channel2.Height)
            {
                throw new Exception("Not in the same size");
            }

            C0 = copy ? new Complex2D(channel0) : channel0;
            C1 = copy ? new Complex2D(channel1) : channel1;
            C2 = copy ? new Complex2D(channel2) : channel2;
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Creates an image in frequenzy domain which one or more diagonal sinus
        /// </summary>
        /// <param name="w"></param>
        /// <param name="h"></param>
        /// <param name="cycles0">index where the first sinus begin, a higher value creates a sinus with a higher frequenz</param>
        /// <param name="numSin">number - 1 of the next higher sinus</param>
        /// <returns></returns>
        public static Complex2D CreateDiagFreqz(int w, int h, int cycles0, int numSin)
        {
            var l = w * h;
            var c = new Complex2D(w, h);
            var d = c.Data;

            d[0] = Complex.FromPolarCoordinates(.5 * l, 0);
            var mag  = (.25 * l) / numSin;
            var cplx = Complex.FromPolarCoordinates(mag, 0);

            for (var i = 0; i < numSin; i++)
            {
                d[(cycles0 + i) * (w + 1)] = d[(w * h) - 1 - ((h + 1) * ((cycles0 + i) - 1))] = cplx;
            }

            return(c);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///   Create a sin funktion with frequency f along the given direction
        /// </summary>
        /// <param name="f"></param>
        /// <param name="angle">direction of the sin in degrees</param>
        /// <returns></returns>
        public static Complex2D GenerateSin(int w, int h, double f, double angle)
        {
            var result = new Complex2D(w, h);
            var a      = ((2 * Math.PI * f) / w) * Math.Cos(angle = MathCV.ToRad(angle));
            var b      = ((2 * Math.PI * f) / h) * Math.Sin(angle);
            var d      = result.Data;

            for (int y = 0,
                 i = 0;
                 y < h;
                 y++)
            {
                var v = y * b;
                for (var x = 0; x < w; x++, i++)
                {
                    d[i] = Math.Sin(v + (x * a));
                }
            }

            return(result);
        }
Ejemplo n.º 5
0
 public ComplexImage(Complex2D channel, bool copy = true)
     : this(copy ? channel = new Complex2D(channel) : channel, channel, channel, false)
 {
 }
Ejemplo n.º 6
0
 public ComplexImage(Complex2D channel)
 {
     C0 = new Complex2D(channel);
     C1 = new Complex2D(channel);
     C2 = new Complex2D(channel);
 }
Ejemplo n.º 7
0
 public ComplexImage(ComplexImage image)
 {
     C0 = new Complex2D(image.C0);
     C1 = new Complex2D(image.C1);
     C2 = new Complex2D(image.C2);
 }
Ejemplo n.º 8
0
 public ComplexImage(Size size)
 {
     C0 = new Complex2D(size.Width, size.Height);
     C1 = new Complex2D(size.Width, size.Height);
     C2 = new Complex2D(size.Width, size.Height);
 }
Ejemplo n.º 9
0
 public ComplexImage(int width, int height)
 {
     C0 = new Complex2D(width, height);
     C1 = new Complex2D(width, height);
     C2 = new Complex2D(width, height);
 }