|
@@ -25,8 +25,19 @@ namespace bbiwarg.Detectors.Fingers
|
|
|
this.edgeImage = edgeImage;
|
|
|
this.fingerImage = fingerImage;
|
|
|
|
|
|
+ Stopwatch sw = new Stopwatch();
|
|
|
+ sw.Start();
|
|
|
+
|
|
|
findFingerPoints();
|
|
|
+
|
|
|
+ sw.Stop();
|
|
|
+ Console.WriteLine("findFingerPoints:" + sw.ElapsedMilliseconds);
|
|
|
+ sw.Restart();
|
|
|
+
|
|
|
findFingers();
|
|
|
+
|
|
|
+ Console.WriteLine("findFingers:" + sw.ElapsedMilliseconds);
|
|
|
+ sw.Stop();
|
|
|
}
|
|
|
|
|
|
public List<Finger> getFingers() {
|
|
@@ -68,13 +79,24 @@ namespace bbiwarg.Detectors.Fingers
|
|
|
float maxYIndex = (direction.y == 0) ? float.MaxValue : ((direction.y > 0) ? ((height - start.y) / direction.y) : (-start.y / direction.y));
|
|
|
|
|
|
float maxIndex = Math.Min(maxFingerSize, Math.Min(maxXIndex, maxYIndex));
|
|
|
-
|
|
|
- while (!edgeFound && index < maxIndex) {
|
|
|
- if (edgeImage.isEdgeAt((int)edge.x, (int)edge.y))
|
|
|
- edgeFound = true;
|
|
|
- else {
|
|
|
- index += stepSize;
|
|
|
- edge += direction;
|
|
|
+
|
|
|
+ if (index < maxIndex)
|
|
|
+ {
|
|
|
+ Int16 depthStart = depthImage.getDepthAt((int)start.x, (int)start.y);
|
|
|
+ Int16 depthEdge = depthImage.getDepthAt((int)edge.x, (int)edge.y);
|
|
|
+
|
|
|
+ if (depthStart > depthEdge)
|
|
|
+ {
|
|
|
+ while (!edgeFound && index < maxIndex)
|
|
|
+ {
|
|
|
+ if (edgeImage.isEdgeAt((int)edge.x, (int)edge.y))
|
|
|
+ edgeFound = true;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ index += stepSize;
|
|
|
+ edge += direction;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|