Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Ancestry/FaceCrop
Utilizing Apple's Vision Framework to center faces in CGImage.
https://github.com/Ancestry/FaceCrop
Last synced: 10 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 (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-28T01:23:06.000Z (over 3 years ago)
- Last Synced: 2024-08-01T15:03:39.703Z (3 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.![Example](https://user-images.githubusercontent.com/15527890/87205361-20506000-c2bc-11ea-919a-e0a788d5b303.png)
# 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!