private void ProcessLandmarks() { FaceData faceData = faceModule.CreateOutput(); faceData.Update(); int numOfFaces = faceData.NumberOfDetectedFaces > maxTrackedFaces ? maxTrackedFaces : faceData.NumberOfDetectedFaces; boundingBoxes.Clear(); landmarks.Clear(); Face face; RectI32 boundingRect; LandmarkPoint[] groupPoints; LandmarkPoint[] allPoints; for (int i = 0; i < numOfFaces; i++) { face = faceData.QueryFaceByIndex(i); boundingRect = face.Detection.BoundingRect; boundingBoxes.Add(boundingRect); if (face != null && face.Landmarks != null) { if (extractLandmarkGroup) { face.Landmarks.QueryPointsByGroup(landmarkGroup, out groupPoints); } else { groupPoints = face.Landmarks.Points; } if (groupPoints != null) { landmarks.Add(groupPoints); } allPoints = face.Landmarks.Points; if (allPoints != null) { allLandmarks.Add(allPoints); } } } faceData.Dispose(); faceModule.Dispose(); }
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(); } }