public static Bitmap
Sobel3x3Filter(this Bitmap sourceBitmap,
bool grayscale = true)
{
Bitmap resultBitmap =
ExtBitmap.ConvolutionFilter(sourceBitmap,
Matrix.Sobel3x3Horizontal,
Matrix.Sobel3x3Vertical,
1.0, 0, grayscale);
return resultBitmap;
}
public static double[,] Sobel3x3Horizontal
{
get
{
return new double[,]
{ { -1, 0, 1, },
{ -2, 0, 2, },
{ -1, 0, 1, }, };
}
}
public static double[,] Sobel3x3Vertical
{
get
{
return new double[,]
{ { 1, 2, 1, },
{ 0, 0, 0, },
{ -1, -2, -1, }, };
}
}
Sobel3x3Filter(this Bitmap sourceBitmap,
bool grayscale = true)
{
Bitmap resultBitmap =
ExtBitmap.ConvolutionFilter(sourceBitmap,
Matrix.Sobel3x3Horizontal,
Matrix.Sobel3x3Vertical,
1.0, 0, grayscale);
return resultBitmap;
}
public static double[,] Sobel3x3Horizontal
{
get
{
return new double[,]
{ { -1, 0, 1, },
{ -2, 0, 2, },
{ -1, 0, 1, }, };
}
}
public static double[,] Sobel3x3Vertical
{
get
{
return new double[,]
{ { 1, 2, 1, },
{ 0, 0, 0, },
{ -1, -2, -1, }, };
}
}
No comments:
Post a Comment