void Update() { if (detection == null || !useLandmarkToDetection) { faceDetect.Invoke(webcamTexture); cameraView.material = faceDetect.transformMat; detection = faceDetect.GetResults().FirstOrDefault(); if (detection == null) { return; } } faceMesh.Invoke(webcamTexture, detection); croppedView.texture = faceMesh.inputTex; var meshResult = faceMesh.GetResult(); if (meshResult.score < 0.5f) { detection = null; return; } DrawResults(detection, meshResult); if (useLandmarkToDetection) { detection = faceMesh.LandmarkToDetection(meshResult); } }
private void OnTextureUpdate(Texture texture) { if (detectionResult == null || !useLandmarkToDetection) { faceDetect.Invoke(texture); cameraView.material = faceDetect.transformMat; detectionResult = faceDetect.GetResults().FirstOrDefault(); if (detectionResult == null) { return; } } faceMesh.Invoke(texture, detectionResult); croppedView.texture = faceMesh.inputTex; meshResult = faceMesh.GetResult(); if (meshResult.score < 0.5f) { detectionResult = null; return; } if (useLandmarkToDetection) { detectionResult = faceMesh.LandmarkToDetection(meshResult); } }
void Update() { faceDetect.Invoke(webcamTexture); cameraView.material = faceDetect.transformMat; var detectionResult = faceDetect.GetResults().FirstOrDefault(); if (detectionResult == null) { return; } faceMesh.Invoke(webcamTexture, detectionResult); croppedView.texture = faceMesh.inputTex; var meshResult = faceMesh.GetResult(); if (meshResult.score < 0.5f) { return; } DrawResults(detectionResult, meshResult); }
void Update() { ////////////////////////////////////////////////////////////////////////////////////////// // Face Detection // TODO: detected points should be 6 and it works for the first run but then they are only 2 if (m_faceDetectionResult == null || !useLandmarkToDetection) { m_faceDetect.Invoke(m_webcamTexture); viewWebCam.material = m_faceDetect.transformMat; m_faceDetectionResult = m_faceDetect.GetResults().FirstOrDefault(); if (m_faceDetectionResult == null) { return; } } ////////////////////////////////////////////////////////////////////////////////////////// // Face Mesh Landmarks Detection m_faceMesh.Invoke(m_webcamTexture, m_faceDetectionResult); viewFaceDetect.texture = m_faceMesh.inputTex; var faceMeshResult = m_faceMesh.GetResult(); if (faceMeshResult.score < 0.5f) { m_faceDetectionResult = null; return; } ////////////////////////////////////////////////////////////////////////////////////////// // Eye and Iris Landmarks Detection int[] indxLeftEye = { 33, 133 }; int[] indxRightEye = { 362, 263 }; m_irisLeftDetect.Invoke(m_webcamTexture, indxLeftEye, m_faceDetectionResult, faceMeshResult, 1); m_irisRightDetect.Invoke(m_webcamTexture, indxRightEye, m_faceDetectionResult, faceMeshResult, -1); viewEyeLeft.texture = m_irisLeftDetect.inputTex; viewEyeRight.texture = m_irisRightDetect.inputTex; m_irisLeftResult = m_irisLeftDetect.GetResult(1); m_irisRightResult = m_irisRightDetect.GetResult(-1); ////////////////////////////////////////////////////////////////////////////////////////// // Draw Results DrawResults(m_faceDetectionResult, faceMeshResult, m_irisLeftResult, m_irisRightResult); if (useLandmarkToDetection) { m_faceDetectionResult = m_faceMesh.LandmarkToDetection(faceMeshResult); } }