• Stars
    star
    50
  • Rank 577,128 (Top 12 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 4 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Utilizing Apple's Vision Framework to center faces in CGImage.

FaceCrop

CGImage extension that utilizes Apple's Vision Framework to detect and center faces.

Example

Usage

cgImage.faceCrop { [weak self] result in
    switch result {
    case .success(let cgImage):
        DispatchQueue.main.async { self?.imageView.image = UIImage(cgImage: cgImage) }
    case .notFound, .failure( _):
        print("error")
    }
}

If you need to crop a UIImage - you can always access its CGImage by calling .cgImage.

===

For more information consider visiting this in-depth artictle on Medium.

Huge thanks to Anastasios Grigoriou for his work on this project!