/// <summary>
        /// Apply smooth filter to bitmap
        /// </summary>
        public void ApplyFilter(Bitmap b, int nWeight)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(1);
            m.Pixel  = nWeight;
            m.Factor = nWeight + 8;
            b        = MatrixFunction.Conv3X3(b, m);
        }
Beispiel #2
0
 public Image ProcessImage(ImageFactory factory)
 {
     var nWeight = (int)DynamicParameter;
     ConvMatrix m = new ConvMatrix();
     m.SetAll(1);
     m.Pixel = nWeight;
     m.Factor = nWeight + 8;
     return ImageHelper.Conv3x3(factory.Bitmap, m);
 }
Beispiel #3
0
		public static void Smooth(Bitmap b, int nWeight)
		{
            ConvMatrix m = new ConvMatrix();
			m.SetAll(1);
			m.Pixel = nWeight;
			m.Factor = nWeight + 8;

			Conv3x3(b, m);
		}
		public static bool Smooth(Bitmap b, int nWeight /* default to 1 */)
		{
			ConvMatrix m = new ConvMatrix();
			m.SetAll(1);
			m.Pixel = nWeight;
			m.Factor = nWeight + 8;

			return Conv3x3(b, m);
		}
        /// <summary>
        /// Applying Emboss filter to the bitmap
        /// </summary>
        public void ApplyFilter(Bitmap b)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(-1);
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 0;
            m.Pixel  = 4;
            m.Offset = 127;
            b        = MatrixFunction.Conv3X3(b, m);
        }
Beispiel #6
0
            public static bool MeanRemoval(Bitmap bitmap, int nWeight)
            {
                ConvMatrix m = new ConvMatrix();

                m.SetAll(-1);
                m.Pixel  = nWeight;
                m.Factor = nWeight - 8;

                return(BitmapFilter.Conv3x3(bitmap, m));
            }
Beispiel #7
0
            public static bool Smooth(Bitmap bitmap, int nWeight)
            {
                ConvMatrix m = new ConvMatrix();

                m.SetAll(1);
                m.Pixel  = nWeight;
                m.Factor = nWeight + 8;

                return(BitmapFilter.Conv3x3(bitmap, m));
            }
Beispiel #8
0
        public static void Smooth(Bitmap b, int nWeight)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(1);
            m.Pixel  = nWeight;
            m.Factor = nWeight + 8;

            Conv3x3(b, m);
        }
        public static bool Smooth(Bitmap b, int nWeight /* default to 1 */)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(1);
            m.Pixel  = nWeight;
            m.Factor = nWeight + 8;

            return(Conv3x3(b, m));
        }
        public static bool MeanRemoval(Bitmap b, int nWeight /* default to 9*/)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(-1);
            m.Pixel  = nWeight;
            m.Factor = nWeight - 8;

            return(Conv3x3(b, m));
        }
Beispiel #11
0
        public static bool GaussianBlur(Bitmap b, int nWeight /* default to 4*/)
        {
            ConvMatrix m = new ConvMatrix();
            m.SetAll(1);
            m.Pixel = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 2;
            m.Factor = nWeight + 12;

            return BitmapFilter.Conv3x3(b, m);
        }
Beispiel #12
0
            public static bool Sharpen(Bitmap bitmap, int nWeight)
            {
                ConvMatrix m = new ConvMatrix();

                m.SetAll(0);
                m.Pixel  = nWeight;
                m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = -2;
                m.Factor = nWeight - 8;

                return(BitmapFilter.Conv3x3(bitmap, m));
            }
        public static bool GaussianBlur(this Bitmap b, int nWeight /* default to 4*/)
        {
            var m = new ConvMatrix();

            m.SetAll(1);
            m.Pixel  = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 2;
            m.Factor = nWeight + 30;

            return(b.Conv3X3(m));
        }
        public static bool EmbossLaplacian(Bitmap b)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(-1);
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 0;
            m.Pixel  = 4;
            m.Offset = 127;

            return(Conv3x3(b, m));
        }
        public static bool GaussianBlur(Bitmap b, int nWeight /* default to 4*/)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(1);
            m.Pixel  = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 2;
            m.Factor = nWeight + 12;

            return(BitmapFilter.Conv3x3(b, m));
        }
Beispiel #16
0
        public Image ProcessImage(ImageFactory factory)
        {
            var        nWeight = (int)DynamicParameter;
            ConvMatrix m       = new ConvMatrix();

            m.SetAll(0);
            m.Pixel  = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = -2;
            m.Factor = nWeight - 8;
            return(ImageHelper.Conv3x3(factory.Bitmap, m));
        }
        public static bool Sharpen(Bitmap b, int nWeight /* default to 11*/)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(0);
            m.Pixel  = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = -2;
            m.Factor = nWeight - 8;

            return(Conv3x3(b, m));
        }
Beispiel #18
0
        public static Bitmap Emboss(Bitmap b, int Offset)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(-1);
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 0;
            m.Pixel  = 4;
            m.Offset = Offset;

            return(Conv3x3(b, m));
        }
Beispiel #19
0
        public static void Smooth(Bitmap b, int nWeight)
        {
            if (nWeight == 0)
            {
                return;
            }

            var m = new ConvMatrix();

            m.SetAll(1);
            m.Pixel  = nWeight;
            m.Factor = nWeight + 8;

            Conv3X3(b, m);
        }
Beispiel #20
0
        public static bool Blur(ref Bitmap b, int intensity = 1)
        {
            int        step0 = intensity;
            int        step1 = intensity / 2;
            int        step2 = intensity / 4;
            ConvMatrix blur  = new ConvMatrix();

            //ConvMatrix blur = new ConvMatrix(
            //    new int[,] {
            //    { step2, step1, step2 },
            //    { step1, step0, step1 },
            //    { step2, step1, step2 }
            //    });
            //blur.Factor = intensity * intensity;
            blur.SetAll(1);
            blur.Pixel  = intensity;
            blur.Factor = intensity + 8;
            return(Conv3x3(ref b, blur));
        }
Beispiel #21
0
		public static bool EmbossLaplacian(Bitmap b)
		{
			ConvMatrix m = new ConvMatrix();
			m.SetAll(-1);
			m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 0;
			m.Pixel = 4;
			m.Offset = 127;

			return  Conv3x3(b, m);
		}	
Beispiel #22
0
        public static void GaussianBlur(Bitmap img, int nWeight)
        {
            Bitmap b = img;
            ConvMatrix m = new ConvMatrix();
            m.SetAll(1);
            m.Pixel = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 2;
            m.Factor = nWeight + 12;

            if (Conv3x3(b, m))
            {
                //if (Rounded)                
                //    RoundImage(b, 30);
            }
        }
Beispiel #23
0
        public static Bitmap Sharpen(Bitmap img, int nWeight /* default to 11*/ )
        {
            Bitmap b = (Bitmap)img.Clone();
            ConvMatrix m = new ConvMatrix();
            m.SetAll(0);
            m.Pixel = nWeight;
            m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = -2;
            m.Factor = nWeight - 8;

            if (Conv3x3(b, m))
            {

                if (Rounded)
                    RoundImage(b, 30);
                return b;
            }

            else return null;
        }
        /// see: http://www.codeproject.com/KB/GDI-plus/edge_detection.aspx
        /// <summary>
        /// Sobel Edge Detection
        /// 
        /// [  1   2   1 ]
        /// [  0   0   0 ]
        /// [ -1  -2  -1 ] /1+0
        /// 
        /// Edge detection filters work essentially by looking for contrast in an image.   
        /// 
        /// </summary>
        /// <param name="b">The source bitmap</param>
        public static bool Sobel(Bitmap b)
        {
            ConvMatrix m = new ConvMatrix();

            m.SetAll(0);
            m.TopLeft = m.TopRight = 1;
            m.BottomLeft = m.BottomRight = -1;
            m.TopMid = 2;
            m.BottomMid = -2;
            m.Offset = 0;

            return Conv3x3(b, m);
        }
Beispiel #25
0
		public static Bitmap Emboss(Bitmap b, int Offset)
		{
			ConvMatrix m = new ConvMatrix();
			m.SetAll(-1);
			m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = 0;
			m.Pixel = 4;
			m.Offset = Offset;

			return  Conv3x3(b, m);
		}	
Beispiel #26
0
		public static bool MeanRemoval(Bitmap b, int nWeight /* default to 9*/ )
		{
			ConvMatrix m = new ConvMatrix();
			m.SetAll(-1);
			m.Pixel = nWeight;
			m.Factor = nWeight - 8;

			return Conv3x3(b, m);
		}
Beispiel #27
0
		public static bool Sharpen(Bitmap b, int nWeight /* default to 11*/ )
		{
			ConvMatrix m = new ConvMatrix();
			m.SetAll(0);
			m.Pixel = nWeight;
			m.TopMid = m.MidLeft = m.MidRight = m.BottomMid = -2;
			m.Factor = nWeight - 8;

			return  Conv3x3(b, m);
		}