|
@@ -71,7 +71,7 @@ namespace bbiwarg.Images
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public int[] getHistogram()
|
|
|
+ public int[] getSmoothedHistogram()
|
|
|
{
|
|
|
Int16 minDepth = getMinDepth();
|
|
|
Int16 maxDepth = getMaxDepth();
|
|
@@ -86,10 +86,22 @@ namespace bbiwarg.Images
|
|
|
histogram[depth - minDepth]++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ smoothHistogram();
|
|
|
return histogram;
|
|
|
}
|
|
|
|
|
|
+ private void smoothHistogram()
|
|
|
+ {
|
|
|
+ histogram[0] = (histogram[0] + histogram[1]) / 2;
|
|
|
+ histogram[histogram.Length - 1] = (histogram[histogram.Length - 2] + histogram[histogram.Length - 1]) / 2;
|
|
|
+
|
|
|
+ for (int i = 1; i < histogram.Length - 1; ++i)
|
|
|
+ {
|
|
|
+ histogram[i] = (histogram[i - 1] + histogram[i] + histogram[i + 1]) / 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public Int16 getPeakDepth()
|
|
|
{
|
|
|
Int16 minDepth = getMinDepth();
|