{"id":15527755,"url":"https://github.com/gentique/visionfaceaware","last_synced_at":"2025-04-23T12:31:22.787Z","repository":{"id":46297614,"uuid":"514683230","full_name":"gentique/VisionFaceAware","owner":"gentique","description":"An extension that gives UIImageView the ability to focus on faces through Vision Framework within an image","archived":false,"fork":false,"pushed_at":"2022-07-29T18:50:13.000Z","size":433,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T19:49:36.284Z","etag":null,"topics":["detect-faces","extension","face-detection","faceaware","ios","photos","spm","swift","uiimageview","vision"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gentique.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-16T20:56:46.000Z","updated_at":"2024-08-14T06:38:50.000Z","dependencies_parsed_at":"2022-08-22T06:40:45.277Z","dependency_job_id":null,"html_url":"https://github.com/gentique/VisionFaceAware","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gentique%2FVisionFaceAware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gentique%2FVisionFaceAware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gentique%2FVisionFaceAware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gentique%2FVisionFaceAware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gentique","download_url":"https://codeload.github.com/gentique/VisionFaceAware/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250434761,"owners_count":21430159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detect-faces","extension","face-detection","faceaware","ios","photos","spm","swift","uiimageview","vision"],"created_at":"2024-10-02T11:08:53.063Z","updated_at":"2025-04-23T12:31:22.746Z","avatar_url":"https://github.com/gentique.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VisionFaceAware\n![license](https://img.shields.io/github/license/gentique/VisionFaceAware) ![spm](https://img.shields.io/badge/Dependency-SPM-blue) ![platform](https://img.shields.io/badge/Supported%20platform-iOS%2012%2B%20-brightgreen) ![stars](https://img.shields.io/github/stars/gentique/VisionFaceAware) ![issues](https://img.shields.io/github/issues/gentique/VisionFaceAware) ![release](https://img.shields.io/github/v/release/gentique/visionfaceaware)  \n## Foreword\nThis package is based on https://github.com/BeauNouvelle/FaceAware which isn't maintained anymore.\nNow it uses Apple's Vision Framework instead of Core Image, based on a  [comparison result](https://www.cognizantsoftvision.com/blog/face-detection-vision-core-image-opencv/)  it performs much faster and looking at the trend with ML it will be better with each new cpu iteration.  \n\n![avatar_example](./Images/comparison.png) \n\n## Use case\nSometimes the aspect ratios of images we need to work with don't quite fit within the confines of our UIImageViews.\n\n![avatar_example](./Images/avatarExample.png) \n\nIn most cases we can use AspectFill to fit the image to the bounds of a UIImageView without stretching or leaving whitespace, however when it comes to photos of people, it's quite often to have the faces cropped out if they're not perfectly centered.\n\nThis is where VisionFaceAware comes in.\nIt will analyze an image either through `UIImageView`'s `image` property, or one you set using one of the built in functions and focus in on any faces it can find within.\n\nThe most common use is with avatars. \n\nWith this library users will no longer have to crop and adjust their profile pictures.\n![example](./Images/largeExample.jpg ) \n\n## Installation\n### Swift Package Manager\n- In Xcode, click `File` -\u003e `Add Packages...`  \n- Insert `https://github.com/gentique/VisionFaceAware` in the search field.\n- Select `Dependency Rule` \"Up to Next Major Version\" with \"1.0.0\"\n\n## Usage \nThere are a few ways to get your image views focussing in on faces within images.\n\n### Interface Builder \nThis is the easiest method and doesn't require writing any code.\nThe extension makes use of `@IBDesignable` and `@IBInspectable` so you can turn on focusOnFaces from within IB. However you won't actually see the extension working until you run your project.\n\n![inspectable](./Images/inspectable.png ) \n\n### Code \nYou can set `focusOnFaces` to `true`.\n```swift\nsomeImageView.focusOnFaces = true\n```\nBe sure to set this *after* setting your image. If no image is present when this is called, there will be no faces to focus on.\n\n------\nAlternatively you can use:\n```swift\nsomeImageView.set(image: myImage, focusOnFaces: true)\n```\nWhich eliminates the worry of not having an image previously set.\n\n------\nYou can also receive a callback for when face detection and any image adjustments have been completed by passing in a closure to the `didFocusOnFaces` property.\n```swift\nsomeImageView.didFocusOnFaces = {\n     print(\"Did finish focussing\")\n}\n```\n\n### Debugging \nIt  features a debug mode which draws red squares around any detected faces within an image. To enable you can set the `debug` property to true.\n```swift\nsomeImageView.debug = true\n```\nYou can also set this flag within interface builder.\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgentique%2Fvisionfaceaware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgentique%2Fvisionfaceaware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgentique%2Fvisionfaceaware/lists"}