FaceCropper is an open source library that utilizes the new iOS 11 Vision API to automatically find images within a photo from Taejun Kim

.


FaceCropper will automatically create new images containing each face found within a given image.


This snippet shows basic usage of FaceCropper:


let image = UIImage(named: "image_contains_faces")

image.face.crop { result in

  switch result {

  case .success(let faces):

    // When the <code>Vision</code> successfully find faces, and <code>FaceCropper</code> cropped it.

    // <code>faces</code> argument is a collection of cropped images.

  case .notFound:

    // When the image doesn't contain any face, <code>result</code> will be <code>.notFound</code>.

  case .failure(let error):

    // When the any error occured, <code>result</code> will be <code>failure</code>.

  }

}

This image from the readme shows an image with faces extracted:


FaceCropper


You can find FaceCropper on Github here.


A nice example of using the new vision API.


Original article: FaceCropper – A Library That Crops Out All Faces From A Given Image Using The iOS 11 Vision API

©2018 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.