Closed KOSURUUDAYSAIKUMAR closed 3 years ago
Hi @KOSURUUDAYSAIKUMAR you can find below code block that saves the image when TakeASelfie detects a face inside green oval overlay. I think you can modify and use it.
fileprivate func handleFaceFeatures(features: [CIFeature],
faceImage: CIImage,
faceUIImage: UIImage) {
guard let features = features as? [CIFaceFeature] else {
return
}
if features.isEmpty || features.count > 2 {
return
}
let image = UIImage(ciImage: faceImage)
let faceFeature = features[0]
let bounds = faceFeature.bounds(for: image, inView: ovalOverlayView.overlayFrame.size)
if ovalOverlayView.overlayFrame.contains(bounds) {
print("TakeASelfie: Face inside the overlay!")
captureSession.stopRunning()
UIImageWriteToSavedPhotosAlbum(faceUIImage,
self,
#selector(image(_:didFinishSavingWithError:contextInfo:)), nil)
}
}
hi @abdullahselek . Thank you for your quick response. Will check and let you know.
Closing because of inactivity.
Sometimes within seconds a selfie is capturing & sometimes taking 10 to 12 seconds time. So I have added custom camera button to capture the image. Can you please let me know how to capture image on button click.