|
@@ -138,12 +138,26 @@ namespace bbiwarg.Images
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (secondMaxIndex < firstMaxIndex) {
|
|
|
+ Int16 dummy = firstMaxIndex;
|
|
|
+ firstMaxIndex = secondMaxIndex;
|
|
|
+ secondMaxIndex = dummy;
|
|
|
+ }
|
|
|
+
|
|
|
+ // get min in between
|
|
|
+ Int16 minIndex = firstMaxIndex;
|
|
|
+ for (Int16 i = firstMaxIndex; i < secondMaxIndex; i++) {
|
|
|
+ if (histogram[i] < histogram[minIndex]) {
|
|
|
+ minIndex = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Int16 minDepth = getMinDepth();
|
|
|
|
|
|
Int16[] result = new Int16[3];
|
|
|
- result[0] = (Int16) (Math.Min(firstMaxIndex, secondMaxIndex) + minDepth);
|
|
|
- result[1] = (Int16) ((firstMaxIndex + secondMaxIndex) / 2 + minDepth);
|
|
|
- result[2] = (Int16) (Math.Max(firstMaxIndex, secondMaxIndex) + minDepth);
|
|
|
+ result[0] = firstMaxIndex;
|
|
|
+ result[1] = minIndex;
|
|
|
+ result[2] = secondMaxIndex;
|
|
|
|
|
|
return result;
|
|
|
}
|