public void FullEdgeDetector(Bitmap source) { int[,] verticalMatrix = { { -1, 0, 1 }, { -2, 0, 2 }, { -1, 0, 1 } }; int[,] horizontalMatrix = { { -1, -2, -1 }, { 0, 0, 0 }, { 1, 2, 1 } }; Bitmap i1 = CreateBlankBitmap(source); Bitmap i2 = CreateBlankBitmap(source); var convolveOp = new ConvolveOp(); var kernel = new ConvolutionKernel { Size = 3, Matrix = verticalMatrix }; i1 = convolveOp.Convolve(source, kernel); kernel = new ConvolutionKernel(); kernel.Size = 3; kernel.Matrix = horizontalMatrix; i2 = convolveOp.Convolve(source, kernel); int w = source.Width; int h = source.Height; for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { float sum = 0.0f; sum += GetBrightness(i1, x, y); sum += GetBrightness(i2, x, y); SetBrightness(source, x, y, Math.Min(1.0f, sum)); } } }
public void HorizontalEdgeBi(Bitmap image) { int[,] matrix = { { -1, 0, 1 } }; Bitmap destination = DuplicateBitmap(image); var convolveOp = new ConvolveOp(); var kernel = new ConvolutionKernel { Size = 3, Matrix = matrix }; destination = convolveOp.Convolve(image, kernel); }
public new void VerticalEdgeDetector(Bitmap source) { int[,] matrix = { { -1, 0, 1 } }; Bitmap destination = DuplicateBitmap(source); var convolveOp = new ConvolveOp(); var kernel = new ConvolutionKernel { Size = 3, Matrix = matrix }; destination = convolveOp.Convolve(source, kernel); }
public void VerticalEdgeBitmap(Bitmap image) { Bitmap imageCopy = DuplicateBitmap(image); int[,] data = { { -1, 0, 1 }, { -1, 0, 1 }, { -1, 0, 1 }, { -1, 0, 1 } }; ConvolveOp convolveOp = new ConvolveOp(); var kernel = new ConvolutionKernel(); kernel.Size = 3; kernel.Matrix = data; imageCopy = convolveOp.Convolve(image, kernel); }
public void HorizontalEdgeDetector(Bitmap source) { Bitmap destination = DuplicateBitmap(source); int[,] matrix = { { -1, -2, -1 }, { 0, 0, 0 }, { 1, 2, 1 } }; var convolveOp = new ConvolveOp(); var kernel = new ConvolutionKernel { Size = 3, Matrix = matrix }; destination = convolveOp.Convolve(source, kernel); }
public void VerticalEdgeDetector(Bitmap source) { Bitmap destination = DuplicateBitmap(source); int[,] datset1 = { { -1, 0, 1 }, { -2, 0, 2 }, { -1, 0, 1 } }; var convolveOp = new ConvolveOp(); var kernel = new ConvolutionKernel { Size = 3, Matrix = datset1 }; destination = convolveOp.Convolve(source, kernel); }