public int x, y, width, height; // The position and size of the gesture in screen coordinates (x, y) // Constructor to create a new instance with data public GestureFrame(GestureType type, CvDetectedGesture gesture) { this.type = type; this.x = gesture.x; this.y = gesture.y; this.width = gesture.width; this.height = gesture.height; }
// Try to detect gestures given a frame public int DetectInFrame(Color32[] rawImg, int width, int height) { nFoundInFrame = 0; unsafe { // Create a pointer of an array of gestures to pass them as reference foundInFrame = new CvDetectedGesture[maxPerFrame]; fixed(CvDetectedGesture *_foundInFramePtr = foundInFrame) { try { // Call to the C++ library to detect gestures nFoundInFrame = OpenCVInterop.DetectGesture(cascade, rawImg, width, height, _foundInFramePtr, maxPerFrame); } catch (Exception e) { Debug.Log("Error"); } } } return(nFoundInFrame); }