123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using MathNet.Numerics.LinearAlgebra.Single;
- namespace bbiwarg.DataSource
- {
- class PalmDetection
- {
- private IInputProvider input;
- private IVideoHandle videoHandle;
- private ForeFingerDetection foreFingerDetection;
- public PalmDetection(IInputProvider input, IVideoHandle videoHandle)
- {
- this.input = input;
- this.videoHandle = videoHandle;
- this.foreFingerDetection = new ForeFingerDetection(input, videoHandle);
- }
- public Palm getPalm(uint handIndex)
- {
- DenseVector palmMiddle = (DenseVector) input.getPalmPosition3D(handIndex);
- DenseVector tipPosition = (DenseVector)input.getTipPosition3D(handIndex);
- DenseVector palmNormal = (DenseVector)input.getPalmNormal3D(handIndex);
- //DenseVector thumbPosition = (DenseVector) input.getFingerTipPositions3D(handIndex)[0];
- //DenseVector palmToThumb_2 = (thumbPosition - palmMiddle) / 2.0f;
- DenseVector tipToForeFinger = tipPosition - palmMiddle;
- DenseVector palmToThumb_2 = (DenseVector) tipToForeFinger.Cross(palmNormal) / 3.0f;
-
- return new Palm(palmMiddle + palmToThumb_2 + tipToForeFinger,
- palmMiddle - palmToThumb_2 + tipToForeFinger,
- palmMiddle - palmToThumb_2 - tipToForeFinger / 2.0f,
- palmMiddle + palmToThumb_2 - tipToForeFinger / 2.0f);
- }
- }
- }
|