All Projects → toupper → Warhol

toupper / Warhol

Licence: MIT license
Face Detection Made Easy on iOS

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to Warhol

Sod
An Embedded Computer Vision & Machine Learning Library (CPU Optimized & IoT Capable)
Stars: ✭ 1,460 (+5740%)
Mutual labels:  face-detection, vision-framework
Polaris
Polaris is a Face recognition attendance system .
Stars: ✭ 211 (+744%)
Mutual labels:  face-detection
SensorsAndAi
SensorAndAi is an android application which will give you the complete information about all the sensors and some basic information about artificial intelligence.This application will tell you about the use and implementation of the sensor and artificial intelligence.This app will show you how sensor and artificial intelligence is used in any an…
Stars: ✭ 29 (+16%)
Mutual labels:  face-detection
image processing
image-processing exercises.
Stars: ✭ 25 (+0%)
Mutual labels:  face-detection
InsightFace-REST
InsightFace REST API for easy deployment of face recognition services with TensorRT in Docker.
Stars: ✭ 308 (+1132%)
Mutual labels:  face-detection
face-detection-mtcnn
face-detection based on MTCNN and TensorFlow
Stars: ✭ 33 (+32%)
Mutual labels:  face-detection
timeline
Timeline - A photo organizer
Stars: ✭ 39 (+56%)
Mutual labels:  face-detection
Cat-Face-Detector-with-OpenCV-and-JavaFX
📹 A Small OpenCV (Open Source Computer Vision) Example, who has the ability to detect multiple cat faces at the same time 🐱
Stars: ✭ 24 (-4%)
Mutual labels:  face-detection
Arduino-OpenCV-Human-Follower
Face detector and follower using Arduino and OpenCV in Python
Stars: ✭ 30 (+20%)
Mutual labels:  face-detection
brfv4 android examples
Android Studio project (Java)
Stars: ✭ 43 (+72%)
Mutual labels:  face-detection
FaceFilter
Snapchat and Instagram like Face Filter.
Stars: ✭ 72 (+188%)
Mutual labels:  face-detection
FaceAware-Android
this helps to auto zoom for face on ImageView
Stars: ✭ 46 (+84%)
Mutual labels:  face-detection
face-mask-detection-tf2
A face mask detection using ssd with simplified Mobilenet and RFB or Pelee in Tensorflow 2.1. Training on your own dataset. Can be converted to kmodel and run on the edge device of k210
Stars: ✭ 72 (+188%)
Mutual labels:  face-detection
FaceLivenessDetection-SDK
3D Passive Face Liveness Detection (Anti-Spoofing) & Deepfake detection. A single image is needed to compute liveness score. 99,67% accuracy on our dataset and perfect scores on multiple public datasets (NUAA, CASIA FASD, MSU...).
Stars: ✭ 85 (+240%)
Mutual labels:  face-detection
visage
Add virtual makeup to picture of a face.
Stars: ✭ 97 (+288%)
Mutual labels:  face-detection
obs-face-tracker
Face tracking plugin for OBS Studio
Stars: ✭ 185 (+640%)
Mutual labels:  face-detection
aio-rek
Face recognition based attendance system
Stars: ✭ 19 (-24%)
Mutual labels:  face-detection
deepstack-ui
UI for working with Deepstack
Stars: ✭ 115 (+360%)
Mutual labels:  face-detection
terran
A human perception library
Stars: ✭ 98 (+292%)
Mutual labels:  face-detection
faas facebox
OpenFaaS anonymize function. Use MachineBox service.
Stars: ✭ 35 (+40%)
Mutual labels:  face-detection

Warhol

Swift Package Manager Carthage CocoaPods PRs Welcome Medium: @toupper

Welcome to Warhol — A library written in Swift that makes easy the process of Face Detection and drawing on top for IOS.

Warhol acts as a wrapper on top of the Apple Vision Framework, detecting the features of a face from camera or image and providing these elements position in your own coordinates, so you can easily draw on top. Forget about the complex Vision or AVFoundation frameworks, just handle the Warhol Face View Model class that encapsulates the features coordinates.

Features

  • Face Detection from Camera
  • Face Detection from UIImageView
  • Face features conversion to the client coordinates.
  • Draw on top of the face.

Requirements

  • iOS 11.0+
  • Xcode 11.0+

Installation

CocoaPods

You can use CocoaPods to install Warhol by adding it to your Podfile:

platform :ios, '11.0'
use_frameworks!
pod 'Warhol'

To get the full benefits import Warhol wherever you use it

import Warhol

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your Cartfile:

github "toupper/Warhol" ~> 0.2.0

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Alamofire does support its use on supported platforms.

Once you have your Swift package set up, adding Warhol as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/toupper/Warhol.git", .upToNextMajor(from: "0.2.0"))
]

Manually

You can also integrate Warhol into your project manually.

Embedded Framework

  • Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:

    $ git init
  • Add Warhol as a git submodule by running the following command:

    $ git submodule add https://github.com/toupper/Warhol.git
  • Open the new Warhol folder, and drag the Warhol.xcodeproj into the Project Navigator of your application's Xcode project.

  • And that's it!

Usage example

From Camera, Draw on Top

Import Warhol in the file you are going to use it. Create an instance of CameraFaceDetectionViewController, and asign the view where you are going to draw to the cameraFrontView property of the former. You can then present the view controller:

import Warhol

let cameraViewController = CameraFaceDetectionViewController()
let faceView = FaceView()
faceView.backgroundColor = .clear
cameraViewController.cameraFrontView = faceView
present(cameraViewController, animated: true, completion: nil)

In order to draw, we should create a subclass of UIView that complies with the Warhol protocol FaceView. We can then draw in their func draw(_ rect: CGRect) function. Anytime Warhol detects a Face change, it will call setNeedsDisplay() on the view so it can trigger the draw process:

import Warhol

final class FaceView: UIView, CameraFrontView {
  var viewModel: FaceViewModel?

  override func draw(_ rect: CGRect) {
    guard let context = UIGraphicsGetCurrentContext(),
          let viewModel = viewModel else {
      return
    }

    context.saveGState()

    defer {
      context.restoreGState()
    }

    context.addRect(viewModel.boundingBox)

    ...

From Camera, Add Images on Face Features

FaceLayouts

If you want to add images on top of each Face Features, you have to compose a FaceLayout object defining an ImageLayout object for each type of Face Landmark you want to draw. You can set the desired offset and Size Ratio for each feature. Once you have it, you should then pass it to the faceLayout property of the CameraFaceDetectionViewController. Please notice that if you do that the cameraFrontView property gets overriden:

let cameraViewController = CameraFaceDetectionViewController()

let leftEye = ImageLayout(image: UIImage(named: "leftEye")!, sizeRatio: SizeRatio(width: 1, height: 4))
let rightEye = ImageLayout(image: UIImage(named: "rightEye")!, sizeRatio: SizeRatio(width: 1, height: 4))
let nose = ImageLayout(image: UIImage(named: "nose")!)

let faceLayout = FaceLayout(landmarkLayouts: [.leftEye: leftEye,
                                                  .rightEye: rightEye,
                                                  .nose: nose])
cameraViewController.faceLayout = faceLayout

present(cameraViewController, animated: true, completion: nil)

Apart from that, you can implement the CameraFaceDetectionDelegate protocol to react to any change in the Face Dectection. This can be convenient for the case when you do not want to draw on top, but just get the face features (landmarks) coordinates. These are encapsulated in the given parameter FaceViewModel.

From Image

In order to detect a face features and draw on top, we should pass the sdk the UIImageView depicting the face, and a closure where we draw on top of the image:

import Warhol

imageView.image = UIImage(named: "Face")
Warhol.drawLandmarks(from: imageView,
                     draw: { (viewModel, context)  in
                      // draw with CGContext
                     },
                     error: {_ in })

If instead of modifying the passed image of the you want to generate a new UIImageView instance, use drawLandmarksInNewImage:

imageView.image = UIImage(named: "Face")
Warhol.drawLandmarksInNewImage(from: imageView,
                               draw: { (viewModel, context)  in
                                  self.draw(viewModel: viewModel, in: context)
                               },
                               completion: { newImage in
                                  self.newImageView.image = newImage
                               },
                               error: {_ in })

Contribute

We would love you for the contribution to Warhol, check the LICENSE file for more info.

Credits

Created and maintained with love by César Vargas Casaseca. You can follow me on Medium @toupper for project updates, releases and more stories.

License

Warhol is released under the MIT license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].