Get Updates By E-mail 

Article Written By:
Johann Dowa

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

  • 8
  •  
  •  
  •  
  •  

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.


  • 8
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments