void OnApplicationQuit() { if (_ready) { OpenCVInterop.Close(); } }
void Update() { // attempt to reinitialize if connection was lost last frame or is not present on start if (cameraState == CameraState.disconnected || lastError < 0) { bool initialized = Initialize(); if (!initialized) { return; } } // this is the main call to the dll that does the face detection processing on an OpenCV frame // it returns the data needed to build output in Unity cvFrame = GetFaceDetectionResults(); //Debug.LogFormat("from frame, x = {0}, y = {1}, bufferSize = {2}, memPtr = {3}, error = {4}", cvFrame.x, cvFrame.y, cvFrame.bufferSize, cvFrame.memPtr, cvFrame.error); // handle error cases returend by dll; i.e. disconnected usb device if (cvFrame.error < 0) { //Debug.LogFormat("RunFaceDetection returned error {0}", cvFrame.error); OpenCVInterop.Close(); cameraState = CameraState.disconnected; lastError = cvFrame.error; // so we know to reinitialize rather than run demo next frame return; } // create array, marshal data from pointer, output, then free the pointer byte[] bytes = new byte[cvFrame.bufferSize]; Marshal.Copy(cvFrame.memPtr, bytes, 0, cvFrame.bufferSize); OutputFrame(cvFrame, bytes); OpenCVInterop.FreeMemory(); }
void OnApplicationQuit() { if (cameraState == CameraState.connected) { OpenCVInterop.Close(); Destroy(tex); } }
void OnApplicationQuit() { if (_ready) { Debug.Log("sdfsdf"); OpenCVInterop.Close(); } }
void OnApplicationQuit() { if (_ready) { Debug.LogWarningFormat("before closing application", GetType()); OpenCVInterop.Close(); Debug.LogWarningFormat("before closing application", GetType()); } }
private void OnApplicationQuit() { OpenCVInterop.Close(); }