Julioacarrettoni/UIImageView_FaceAwareFill
关于
此分类为图像应用 Aspect Fill 内容模式;如果检测到人脸,则以人脸为中心,而不是仅根据图像的几何中心进行居中。
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 0
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文FaceAwareFill
This category applies Aspect Fill content mode to an image and if faces are detected it centers them instead of centering the image just by its geometrical center.
Based on this awesome post by @maniacdev
Example:

Installation
FaceAwareFill is available through CocoaPods, to install it simply add the following line to your Podfile:
pod "FaceAwareFill"
Usage
Import the category to your .m file or to your "prefix" file.
#import "UIImageView+UIImageView_FaceAwareFill.h"
Then AFTER setting the image property of a UIImageView do:
[imageView faceAwareFill];
That's all.
Enjoy!
Debugging
A red rectangle can optionally be displayed on faces for debugging.
To enable, add the following value to the preprocessor macros:
DEBUGGING_FACE_AWARE_FILL
Author
Julio Andrés Carretttoni, @dev_jac
Notes:
- You can change the CIDetectorAccuracy from low to high if it fails to detect faces but it will make the rendering slower :(
- BEWARE of this bug when running face detection on 64bit devices http://stackoverflow.com/questions/19018962/core-image-face-detection-broken-on-64-bit-ios
License
FaceAwareFill is available under the MIT license. See the LICENSE file for more info.
探索相关项目
加载中…