Why doesn't the following code detect a face with the front camera?
@objc private func finishButtonPressed() {
let userVerificationPicture = userVerificationPictureImageView.image!
let options = FaceDetectorOptions()
options.performanceMode = .accurate
let faceDetector = FaceDetector.faceDetector(options: options)
let visionImage = VisionImage(image: userVerificationPicture)
visionImage.orientation = userVerificationPicture.imageOrientation
faceDetector.process(visionImage) { faces, error in
guard error == nil, let faces = faces, !faces.isEmpty else {
return
}
for face in faces {
// faces array is always empty with front camera
print(face)
}
}
}
I am following the documentation here using a UIImage:
https://developers.google.com/ml-kit/vision/face-detection/ios
And the code above will detect a face when the back camera is used every time, but never with the front camera. Why is it not working? I am following the documentation exactly as it says.
question from:
https://stackoverflow.com/questions/65647760/ml-kit-face-detection-front-camera-not-working 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…