void OnDestroy() { // 平滑化開放 if (SmoothTongue != null) { SmoothTongue.Dispose(); } if (SmoothMouth != null) { SmoothMouth.Dispose(); } if (SmoothKiss != null) { SmoothKiss.Dispose(); } if (SmoothSmile != null) { SmoothSmile.Dispose(); } if (SmoothBrowLow != null) { SmoothBrowLow.Dispose(); } if (SmoothBrowRai != null) { SmoothBrowRai.Dispose(); } if (SmoothEyesClose != null) { SmoothEyesClose.Dispose(); } if (SmoothEyes != null) { SmoothEyes.Dispose(); } if (SmoothHead != null) { SmoothHead.Dispose(); } if (SmoothBody != null) { SmoothBody.Dispose(); } if (Smoother != null) { Smoother.Dispose(); } // RealSense開放 if (SampleReader != null) { SampleReader.SampleArrived -= SampleReader_SampleArrived; } if (SampleReader != null) { SampleReader.Dispose(); } if (FaceModule != null) { FaceModule.FrameProcessed -= FaceModule_FrameProcessed; } if (FaceData != null) { FaceData.Dispose(); } if (FaceConfig != null) { FaceConfig.Dispose(); } if (FaceModule != null) { FaceModule.Dispose(); } if (SenseManager != null) { SenseManager.Dispose(); } }
private void StartTrackingLoop() { PXCMFaceData FaceData = FaceModule.CreateOutput(); while (!_shouldStop) { pxcmStatus acquireFrameStatus = SenseManager.AcquireFrame(true); if (acquireFrameStatus < pxcmStatus.PXCM_STATUS_NO_ERROR) { ResetTrackData(); Console.WriteLine("SenseManager.AcquireFrame(true) error: " + acquireFrameStatus.ToString()); continue; } PXCMCapture.Sample captureSample = SenseManager.QueryFaceSample(); if (captureSample == null) { ResetTrackData(); SenseManager.ReleaseFrame(); continue; } //TODO: Image Daten holen TrackImageData(captureSample); FaceData.Update(); int numberOfDetectedFaces = FaceData.QueryNumberOfDetectedFaces(); if (numberOfDetectedFaces != 1) { ResetTrackData(); SenseManager.ReleaseFrame(); continue; } PXCMFaceData.Face faceDataFace = FaceData.QueryFaceByIndex(0); TrackPose(faceDataFace); TrackExpressions(faceDataFace); //TrackLandmarks(faceDataFace); //TrackGaze(); //FaceData.QueryRecognitionModule(); //im nächsten object steckt boundingrectangle und avarageDepth drin //PXCMFaceData.DetectionData faceDataDetectionData = faceDataFace.QueryDetection(); //faceDataDetectionData.QueryFaceAverageDepth(); //faceDataDetectionData.QueryBoundingRect(); SenseManager.ReleaseFrame(); Thread.Sleep(250); } if (FaceData != null) { FaceData.Dispose(); } FaceConfiguration.Dispose(); SenseManager.Close(); SenseManager.Dispose(); }