diff --git a/src/ImageProcessor/ImageProcessor.csproj b/src/ImageProcessor/ImageProcessor.csproj
index 4bb47105a..a2d74b754 100644
--- a/src/ImageProcessor/ImageProcessor.csproj
+++ b/src/ImageProcessor/ImageProcessor.csproj
@@ -78,10 +78,11 @@
+
-
+
Code
diff --git a/src/ImageProcessor/Imaging/EdgeDetection/CostellaEdgeFilter.cs b/src/ImageProcessor/Imaging/EdgeDetection/CostellaEdgeFilter.cs
deleted file mode 100644
index fe0cb4c9a..000000000
--- a/src/ImageProcessor/Imaging/EdgeDetection/CostellaEdgeFilter.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-//
-// Copyright (c) James South.
-// Licensed under the Apache License, Version 2.0.
-//
-//
-// The Costella operator filter.
-//
-//
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace ImageProcessor.Imaging.EdgeDetection
-{
- ///
- /// The Costella operator filter.
- ///
- ///
- public class CostellaEdgeFilter : IEdgeFilter
- {
- ///
- /// Gets the horizontal gradient operator.
- ///
- public double[,] HorizontalGradientOperator
- {
- get
- {
- //return 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 }, };
- return new double[,]
- {
- { -1, -3, 0, 3, 1 },
- { -1, -3, 0, 3, 1 },
- { -1, -3, 0, 3, 1 },
- { -1, -3, 0, 3, 1 },
- { -1, -3, 0, 3, 1 }
- };
- }
- }
-
- ///
- /// Gets the vertical gradient operator.
- ///
- public double[,] VerticalGradientOperator
- {
- get
- {
- //return 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 }, };
- return new double[,]
- {
- { 1, 1, 1, 1, 1 },
- { 3, 3, 3, 3, 3 },
- { 0, 0, 0, 0, 0 },
- { -3, -3, -3, -3, -3 },
- { -1, -1, -1, -1, -1 }
- };
- }
- }
- }
-}
diff --git a/src/ImageProcessor/Imaging/EdgeDetection/KayyaliEdgeFilter.cs b/src/ImageProcessor/Imaging/EdgeDetection/KayyaliEdgeFilter.cs
new file mode 100644
index 000000000..cbedae2a6
--- /dev/null
+++ b/src/ImageProcessor/Imaging/EdgeDetection/KayyaliEdgeFilter.cs
@@ -0,0 +1,52 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Copyright (c) James South.
+// Licensed under the Apache License, Version 2.0.
+//
+//
+// The Kayyali operator filter.
+//
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace ImageProcessor.Imaging.EdgeDetection
+{
+ ///
+ /// The Kayyali operator filter.
+ ///
+ ///
+ public class KayyaliEdgeFilter : IEdgeFilter
+ {
+ ///
+ /// Gets the horizontal gradient operator.
+ ///
+ public double[,] HorizontalGradientOperator
+ {
+ get
+ {
+ return new double[,]
+ {
+ { 6, 0, -6 },
+ { 0, 0, 0 },
+ { -6, 0, 6 }
+ };
+ }
+ }
+
+ ///
+ /// Gets the vertical gradient operator.
+ ///
+ public double[,] VerticalGradientOperator
+ {
+ get
+ {
+ return new double[,]
+ {
+ { -6, 0, 6 },
+ { 0, 0, 0 },
+ { 6, 0, -6 }
+ };
+ }
+ }
+ }
+}
diff --git a/src/ImageProcessor/Imaging/EdgeDetection/KirschEdgeFilter.cs b/src/ImageProcessor/Imaging/EdgeDetection/KirschEdgeFilter.cs
new file mode 100644
index 000000000..3a57d13a4
--- /dev/null
+++ b/src/ImageProcessor/Imaging/EdgeDetection/KirschEdgeFilter.cs
@@ -0,0 +1,52 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Copyright (c) James South.
+// Licensed under the Apache License, Version 2.0.
+//
+//
+// The Kirsch operator filter.
+//
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace ImageProcessor.Imaging.EdgeDetection
+{
+ ///
+ /// The Kirsch operator filter.
+ ///
+ ///
+ public class KirschEdgeFilter : IEdgeFilter
+ {
+ ///
+ /// Gets the horizontal gradient operator.
+ ///
+ public double[,] HorizontalGradientOperator
+ {
+ get
+ {
+ return new double[,]
+ {
+ { 5, 5, 5 },
+ { -3, 0, -3 },
+ { -3, -3, -3 }
+ };
+ }
+ }
+
+ ///
+ /// Gets the vertical gradient operator.
+ ///
+ public double[,] VerticalGradientOperator
+ {
+ get
+ {
+ return new double[,]
+ {
+ { 5, -3, -3 },
+ { 5, 0, -3 },
+ { 5, -3, -3 }
+ };
+ }
+ }
+ }
+}
diff --git a/src/ImageProcessor/Imaging/FastBitmap.cs b/src/ImageProcessor/Imaging/FastBitmap.cs
index db8d80643..97af88356 100644
--- a/src/ImageProcessor/Imaging/FastBitmap.cs
+++ b/src/ImageProcessor/Imaging/FastBitmap.cs
@@ -156,12 +156,12 @@ namespace ImageProcessor.Imaging
/// The at the given pixel.
public Color GetPixel(int x, int y)
{
- if ((x < 0) || (x > this.width))
+ if ((x < 0) || (x >= this.width))
{
throw new ArgumentOutOfRangeException("x", "Value cannot be less than zero or greater than the bitmap width.");
}
- if ((y < 0) || (y > this.height))
+ if ((y < 0) || (y >= this.height))
{
throw new ArgumentOutOfRangeException("y", "Value cannot be less than zero or greater than the bitmap height.");
}
diff --git a/src/ImageProcessor/Settings.StyleCop b/src/ImageProcessor/Settings.StyleCop
index 9e50dcc98..0a9f862fa 100644
--- a/src/ImageProcessor/Settings.StyleCop
+++ b/src/ImageProcessor/Settings.StyleCop
@@ -6,6 +6,7 @@
ddd
dllimport
gps
+ Kayyali
mmmm
orig
Scharr
diff --git a/src/ImageProcessorConsole/Program.cs b/src/ImageProcessorConsole/Program.cs
index ddfbdd383..07243551b 100644
--- a/src/ImageProcessorConsole/Program.cs
+++ b/src/ImageProcessorConsole/Program.cs
@@ -77,7 +77,7 @@ namespace ImageProcessorConsole
//.Constrain(size)
//.ReplaceColor(Color.FromArgb(255, 1, 107, 165), Color.FromArgb(255, 1, 165, 13), 80)
.Resize(layer)
- .DetectEdges(new PrewittEdgeFilter(), false)
+ .DetectEdges(new KirschEdgeFilter())
//.Filter(MatrixFilters.Comic)
//.Filter(MatrixFilters.HiSatch)
//.Pixelate(8)