https://github.com/Ancestry/FaceCrop
Utilizing Apple's Vision Framework to center faces in CGImage.
https://github.com/Ancestry/FaceCrop
Last synced: 20 days ago
JSON representation
Utilizing Apple's Vision Framework to center faces in CGImage.
- Host: GitHub
- URL: https://github.com/Ancestry/FaceCrop
- Owner: Ancestry
- License: mit
- Created: 2020-07-10T19:15:08.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-28T01:23:06.000Z (almost 4 years ago)
- Last Synced: 2024-08-01T15:03:39.703Z (9 months ago)
- Language: Swift
- Size: 16.6 KB
- Stars: 48
- Watchers: 6
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-swift - FaceCrop - Detect and center faces in your images using Apple’s Vision Framework. (Libs / Images)
- awesome-swift - FaceCrop - Detect and center faces in your images using Apple’s Vision Framework. (Libs / Images)
README
# FaceCrop
CGImage extension that utilizes Apple's Vision Framework to detect and center faces.
# Usage
```swift
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](https://developer.apple.com/documentation/uikit/uiimage/1624147-cgimage).===
For more information consider visiting [this in-depth artictle on Medium](https://medium.com/ancestry-engineering/image-face-centering-using-apples-vision-framework-3ff3954ab5cb).
Huge thanks to Anastasios Grigoriou for his work on this project!