1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using bbiwarg.Recognition.FingerRecognition;
- using bbiwarg.Recognition.PalmRecognition;
- using bbiwarg.Recognition.Tracking;
- using bbiwarg.Utility;
- using Emgu.CV;
- using Emgu.CV.Structure;
- namespace bbiwarg.Recognition.TouchRecognition
- {
- class TouchEvent : TrackableObject
- {
- public Vector2D AbsolutePosition { get; private set; }
- public Vector2D RelativePosition { get; private set; }
- public Image<Gray, byte> TouchMask { get; private set; }
- public Finger Finger { get; private set; }
- public Palm Palm { get; private set; }
- public TouchEvent(Vector2D absolutePosition, Image<Gray, byte> touchMask, Finger finger, Palm palm)
- {
- AbsolutePosition = absolutePosition;
- RelativePosition = palm.getRelativePosition(absolutePosition);
- TouchMask = touchMask;
- Finger = finger;
- Palm = palm;
- }
- public float getTouchValue()
- {
- int touchPixels = TouchMask.CountNonzero()[0];
- int numPixels = TouchMask.Width * TouchMask.Height;
- float touchValue = touchPixels / (float)numPixels;
- return touchValue;
- }
- }
- }
|