VisionDetect let you track user face gestures like blink, smile etc.
Inspired from https://github.com/aaronabentheuer/AAFaceDetection , added some new features(like take a photo) and will add in near future. Moved from KVO to Delegation structure to easy use :)
Delegate Methods
func didNoFaceDetected()
func didFaceDetected()
func didSmile()
func didNotSmile()
func didBlinked()
func didNotBlinked()
func didWinked()
func didNotWinked()
func didLeftEyeClosed()
func didLeftEyeOpened()
func didRightEyeClosed()
func didRightEyeOpened()
Features
You can easily take a picture or save it to photo album.
vDetect.addTakenImageChangeHandler { (image) in
self.imageView.image = image
self.vDetect.saveTakenImageToPhotos()
}
Requirements
- iOS 11.0+
- Xcode 11+
- Swift 5.0+
Installation
CocoaPods
You can use CocoaPods to install VisionDetect
by adding it to your Podfile
:
platform :ios, '11.0'
use_frameworks!
pod 'VisionDetect', :git=>'https://github.com/miletliyusuf/VisionDetect.git'
To get the full benefits import VisionDetect
wherever you import UIKit
import VisionDetect
Carthage
Check out the Carthage docs on how to add a install. The VisionDetect
framework is already setup with shared schemes.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate VisionDetect into your Xcode project using Carthage, specify it in your Cartfile
:
github "miletliyusuf/VisionDetect"
Manually
- Download and drop
VisionDetect.swift
in your project. - Congratulations!
Usage example
import VisionDetect
class VisionDetectViewController: UIViewController {
@IBOutlet private weak var imageView: UIImageView!
var vDetect = VisionDetect(
cameraPosition: .FaceTimeCamera,
optimizeFor: .HigherPerformance
)
override func viewDidLoad() {
super.viewDidLoad()
vDetect.delegate = self
vDetect.onlyFireNotificatonOnStatusChange = true
vDetect.beginFaceDetection()
vDetect.addTakenImageChangeHandler { (image) in
self.imageView.image = image
self.vDetect.saveTakenImageToPhotos()
}
self.view.addSubview(vDetect.visageCameraView)
self.view.bringSubviewToFront(imageView)
}
}
extension VisionDetectViewController: VisionDetectDelegate {
func didLeftEyeClosed() {
vDetect.takeAPicture()
}
}
Contribute
We would love you for the contribution to VisionDetect, check the LICENSE
file for more info.
Meta
Yusuf Miletli – @ysfmltli – [email protected]
Distributed under the MIT license. See LICENSE
for more information.