Ejemplo n.º 1
0
 public Pixel Map(ISourceData data)
 {
     return(data.GetPixel(0, 0)
            - data.GetPixel(1, 0)
            - data.GetPixel(-1, 0)
            - data.GetPixel(0, 1)
            - (data.GetPixel(0, -1) * (1 / 64d)));
 }
Ejemplo n.º 2
0
        public Pixel Map(ISourceData data)
        {
            Pixel p0 = data.GetPixel(0, 0);
            Pixel p1 = data.GetPixel(-1 * _amount, -1 * _amount);
            Pixel p2 = data.GetPixel(1 * _amount, 1 * _amount);
            Pixel p3 = data.GetPixel(-1 * _amount, 1 * _amount);
            Pixel p4 = data.GetPixel(1 * _amount, -1 * _amount);

            int r = ((p1.R + p2.R + p3.R + p4.R + p0.R)) / 5;
            int g = ((p1.G + p2.G + p3.G + p4.G + p0.G)) / 5;
            int b = ((p1.B + p2.B + p3.B + p4.B + p0.B)) / 5;

            return(new Pixel(r, g, b, 255));
        }
Ejemplo n.º 3
0
        public Pixel Map(ISourceData data)
        {
            Pixel p = data.GetPixel(0, 0);
            int   r = PixelUtils.Clamp((int)((255.0 * Math.Pow(p.R / 255.0, 1.0 / _gammaCorrection)) + 0.5), 255, 0);
            int   g = PixelUtils.Clamp((int)((255.0 * Math.Pow(p.G / 255.0, 1.0 / _gammaCorrection)) + 0.5), 255, 0);
            int   b = PixelUtils.Clamp((int)((255.0 * Math.Pow(p.B / 255.0, 1.0 / _gammaCorrection)) + 0.5), 255, 0);
            int   a = PixelUtils.Clamp((int)((255.0 * Math.Pow(p.A / 255.0, 1.0 / _gammaCorrection)) + 0.5), 255, 0);

            return(new Pixel(r, g, b, a));
        }
Ejemplo n.º 4
0
 public Pixel Map(ISourceData data)
 {
     return(Pixel.GetMeanValuePixel(
                data.GetPixel(0 * amount, -1 * amount),
                data.GetPixel(1 * amount, -1 * amount),
                data.GetPixel(1 * amount, 0 * amount),
                data.GetPixel(1 * amount, 1 * amount),
                data.GetPixel(0 * amount, 1 * amount),
                data.GetPixel(-1 * amount, -1 * amount),
                data.GetPixel(-1 * amount, 0 * amount),
                data.GetPixel(-1 * amount, 1 * amount)));
 }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="data"></param>
        /// <param name="scale">The number of surounding pixels. Input 1 yeals a 3x3 matrix</param>
        /// <returns></returns>
        public static Pixel[,] GetPixelMatrix(ISourceData data, int scale)
        {
            if (scale < 1)
            {
                scale = 1;
            }

            int dimLength = scale * 3;

            Pixel[,] matrix = new Pixel[dimLength, dimLength];

            for (int r = 0; r < dimLength; r++)
            {
                int y = r - 1;
                for (int i = 0; i < dimLength; i++)
                {
                    int x = i - 1;
                    matrix[r, i] = data.GetPixel(x, y);
                }
            }

            //matrix[0, 0] = data.GetPixel(-1, -1);
            //matrix[0, 1] = data.GetPixel(0, -1);
            //matrix[0, 2] = data.GetPixel(1, -1);

            //matrix[1, 0] = data.GetPixel(-1, 0);
            //matrix[1, 1] = data.GetPixel(0, 0);
            //matrix[1, 2] = data.GetPixel(1, 0);

            //matrix[2, 0] = data.GetPixel(-1, 1);
            //matrix[2, 1] = data.GetPixel(0, 1);
            //matrix[2, 2] = data.GetPixel(1, 1);


            return(matrix);
        }
Ejemplo n.º 6
0
 //TODO
 public Pixel Map(ISourceData data)
 {
     return(data.GetPixel(0, 0));
 }
 public Pixel Map(ISourceData data)
 {
     //TODO implement Gaussian filter
     return(data.GetPixel(0, 0));
 }