From cb0cbac51c74f0eb9cdafd93285a0e6b4feed301 Mon Sep 17 00:00:00 2001 From: Tuan Pham Date: Wed, 29 Nov 2023 14:12:43 -0600 Subject: [PATCH] chore: update magic number for face height --- .../FaceLiveness/FaceDetection/BlazeFace/DetectedFace.swift | 2 +- Tests/FaceLivenessTests/DetectedFaceTests.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/FaceLiveness/FaceDetection/BlazeFace/DetectedFace.swift b/Sources/FaceLiveness/FaceDetection/BlazeFace/DetectedFace.swift index de71cb86..d6879848 100644 --- a/Sources/FaceLiveness/FaceDetection/BlazeFace/DetectedFace.swift +++ b/Sources/FaceLiveness/FaceDetection/BlazeFace/DetectedFace.swift @@ -34,7 +34,7 @@ struct DetectedFace { } let faceWidth = ow - let faceHeight = 1.68 * faceWidth + let faceHeight = 1.618 * faceWidth let faceBoxBottom = boundingBox.maxY let faceBoxTop = faceBoxBottom - faceHeight let faceBoxLeft = min(cx - ow / 2, rightEar.x) diff --git a/Tests/FaceLivenessTests/DetectedFaceTests.swift b/Tests/FaceLivenessTests/DetectedFaceTests.swift index 7c78e0c0..4bee8292 100644 --- a/Tests/FaceLivenessTests/DetectedFaceTests.swift +++ b/Tests/FaceLivenessTests/DetectedFaceTests.swift @@ -100,9 +100,9 @@ final class DetectedFaceTests: XCTestCase { let ovalRect = CGRect.zero let expectedBoundingBox = CGRect( x: 0.1658528943614037, - y: 0.041756969751750916, + y: 0.072967669448238516, width: 0.6240418540649166, - height: 0.8457092820983773 + height: 0.8144985824018897 ) let boundingBox = detectedFace.boundingBoxFromLandmarks(ovalRect: ovalRect) XCTAssertEqual(boundingBox.origin.x, expectedBoundingBox.origin.x)