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 :)
Check Example Project.
func didNoFaceDetected()
func didFaceDetected()
func didSmile()
func didNotSmile()
func didBlinked()
func didNotBlinked()
func didWinked()
func didNotWinked()
func didLeftEyeClosed()
func didLeftEyeOpened()
func didRightEyeClosed()
func didRightEyeOpened()
You can easily take a picture or save it to photo album.
vDetect.addTakenImageChangeHandler { (image) in
self.imageView.image = image
self.vDetect.saveTakenImageToPhotos()
}
- iOS 11.0+
- Xcode 11+
- Swift 5.0+
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
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"
- Download and drop
VisionDetect.swift
in your project. - Congratulations!
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()
}
}
We would love you for the contribution to VisionDetect, check the LICENSE
file for more info.
Yusuf Miletli – @ysfmltli – miletliyusuf@gmail.com
Distributed under the MIT license. See LICENSE
for more information.