forked from JimBobSquarePants/ImageProcessor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12d22b6
commit 5ab1772
Showing
8 changed files
with
198 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) James Jackson-South and contributors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
namespace ImageProcessor.Processing | ||
{ | ||
/// <summary> | ||
/// Detects edges within an image using Kayyali operators. | ||
/// <see href="https://edgedetection.webs.com/"/>. | ||
/// </summary> | ||
public class Kayyali : EdgeDetection2DProcessor | ||
{ | ||
private static readonly double[,] KernelX = new double[,] | ||
{ | ||
{ 6, 0, -6 }, | ||
{ 0, 0, 0 }, | ||
{ -6, 0, 6 } | ||
}; | ||
|
||
private static readonly double[,] KernelY = new double[,] | ||
{ | ||
{ -6, 0, 6 }, | ||
{ 0, 0, 0 }, | ||
{ 6, 0, -6 } | ||
}; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Kayyali"/> class. | ||
/// </summary> | ||
/// <param name="grayscale">Whether to convert the image to grascale before processing.</param> | ||
public Kayyali(bool grayscale) | ||
: base(new KernelPair(KernelX, KernelY), grayscale) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) James Jackson-South and contributors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
namespace ImageProcessor.Processing | ||
{ | ||
/// <summary> | ||
/// Detects edges within an image using Laplacian 5x5 operators. | ||
/// <see href="http://en.wikipedia.org/wiki/Discrete_Laplace_operator"/>. | ||
/// </summary> | ||
public class Laplacian5x5 : EdgeDetectionProcessor | ||
{ | ||
private static readonly double[,] KernelXY = new double[,] | ||
{ | ||
{ -1, -1, -1, -1, -1 }, | ||
{ -1, -1, -1, -1, -1 }, | ||
{ -1, -1, 24, -1, -1 }, | ||
{ -1, -1, -1, -1, -1 }, | ||
{ -1, -1, -1, -1, -1 } | ||
}; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Laplacian5x5"/> class. | ||
/// </summary> | ||
/// <param name="grayscale">Whether to convert the image to grascale before processing.</param> | ||
public Laplacian5x5(bool grayscale) | ||
: base(KernelXY, grayscale) | ||
{ | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/ImageProcessor/Processing/Convolution/LaplacianOfGaussian.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) James Jackson-South and contributors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
namespace ImageProcessor.Processing | ||
{ | ||
/// <summary> | ||
/// Detects edges within an image using Laplacian of Gaussian operators. | ||
/// <see href="http://fourier.eng.hmc.edu/e161/lectures/gradient/node9.html"/>. | ||
/// </summary> | ||
public class LaplacianOfGaussian : EdgeDetectionProcessor | ||
{ | ||
private static readonly double[,] KernelXY = new double[,] | ||
{ | ||
{ 0, 0, -1, 0, 0 }, | ||
{ 0, -1, -2, -1, 0 }, | ||
{ -1, -2, 16, -2, -1 }, | ||
{ 0, -1, -2, -1, 0 }, | ||
{ 0, 0, -1, 0, 0 } | ||
}; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="LaplacianOfGaussian"/> class. | ||
/// </summary> | ||
/// <param name="grayscale">Whether to convert the image to grascale before processing.</param> | ||
public LaplacianOfGaussian(bool grayscale) | ||
: base(KernelXY, grayscale) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) James Jackson-South and contributors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
namespace ImageProcessor.Processing | ||
{ | ||
/// <summary> | ||
/// Detects edges within an image using Prewitt operators. | ||
/// <see href="http://en.wikipedia.org/wiki/Prewitt_operator"/>. | ||
/// </summary> | ||
public class Prewitt : EdgeDetection2DProcessor | ||
{ | ||
private static readonly double[,] KernelX = new double[,] | ||
{ | ||
{ -1, 0, 1 }, | ||
{ -1, 0, 1 }, | ||
{ -1, 0, 1 } | ||
}; | ||
|
||
private static readonly double[,] KernelY = new double[,] | ||
{ | ||
{ 1, 1, 1 }, | ||
{ 0, 0, 0 }, | ||
{ -1, -1, -1 } | ||
}; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Prewitt"/> class. | ||
/// </summary> | ||
/// <param name="grayscale">Whether to convert the image to grascale before processing.</param> | ||
public Prewitt(bool grayscale) | ||
: base(new KernelPair(KernelX, KernelY), grayscale) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) James Jackson-South and contributors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
namespace ImageProcessor.Processing | ||
{ | ||
/// <summary> | ||
/// Detects edges within an image using RobertsCross operators. | ||
/// <see href="http://en.wikipedia.org/wiki/Roberts_cross"/>. | ||
/// </summary> | ||
public class RobertsCross : EdgeDetection2DProcessor | ||
{ | ||
private static readonly double[,] KernelX = new double[,] | ||
{ | ||
{ 1, 0 }, | ||
{ 0, -1 } | ||
}; | ||
|
||
private static readonly double[,] KernelY = new double[,] | ||
{ | ||
{ 0, 1 }, | ||
{ -1, 0 } | ||
}; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="RobertsCross"/> class. | ||
/// </summary> | ||
/// <param name="grayscale">Whether to convert the image to grascale before processing.</param> | ||
public RobertsCross(bool grayscale) | ||
: base(new KernelPair(KernelX, KernelY), grayscale) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters