@@ -49,8 +49,8 @@ namespace bbiwarg.Detectors.Palm
this.edgeImage = edgeImage;
this.palmImage = palmImage;
- // dst = (src > 254) ? 0 : 1
+ // dst = (src > (MaxDepth - MinDepth)) ? 0 : 1
- handImage = depthImage.Image.ThresholdBinaryInv(new Gray(254), new Gray(1)).Convert<Gray, Byte>();
+ handImage = depthImage.Image.ThresholdBinaryInv(new Gray(depthImage.MaxDepth - depthImage.MinDepth - 1), new Gray(1)).Convert<Gray, Byte>();
fingers = getFingersWithoutThumb(detectedFingers);
buildPointingHandMask();
@@ -26,8 +26,8 @@ namespace bbiwarg.Images
MinDepth = findMinDepth(image);
MaxDepth = (Int16)(MinDepth + 200); // max = minDepth+255 (else it can't fit whole range in byte image)
- //smooth+threshold
+ //smooth+threshold (dst = (src > (MaxDepth - MinDepth)) ? MaxDepth - MinDepth : src)
- Image = image.SmoothMedian(3).ThresholdTrunc(new Gray(MaxDepth)).Convert<Gray, byte>();
+ Image = image.SmoothMedian(3).Sub(new Gray(MinDepth)).ThresholdTrunc(new Gray(MaxDepth - MinDepth)).Convert<Gray, byte>();
}
public Int16 getDepthAt(Point point)