// 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); }