|
@@ -73,7 +73,18 @@ namespace bbiwarg.Images
|
|
|
|
|
|
public void thresholdBinary(Int16 thresholdDepth)
|
|
|
{
|
|
|
- image = image.ThresholdBinary(new Gray(thresholdDepth), new Gray(Int16.MaxValue));
|
|
|
+ Int16 maxDepth = getMaxDepth();
|
|
|
+ for (int x = 0; x < width; ++x)
|
|
|
+ {
|
|
|
+ for (int y = 0; y < height; ++y)
|
|
|
+ {
|
|
|
+ Int16 depth = getDepth(x, y);
|
|
|
+ if (depth <= thresholdDepth)
|
|
|
+ setDepth(x, y, 0);
|
|
|
+ else if (depth != maxDepth)
|
|
|
+ setDepth(x, y, (short) (maxDepth / 2));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public int[] getSmoothedHistogram()
|