GlideFaceDetectionTransformation
A memory efficient Android image transformation library providing cropping above Face Detection (Face Centering) for Glide.
Install / Use
/learn @aryarohit07/GlideFaceDetectionTransformationREADME
Glide face detection transformation
An Android image transformation library providing cropping above Face Detection for Glide
Are you using Picasso? PicassoFaceDetectionTransformation.
Are you using Fresco? FrescoFaceDetectionProcessor.
Results
Original Image

Results after cropping

Original Image

Results after cropping

Original Image

Results after cropping

Original Image

Results after cropping

You can read more on my Medium article.
How to use it?
STEP 1:
Grab via Gradle
repositories {
jcenter()
}
dependencies {
compile 'com.github.aryarohit07:glide-facedetection-transformation:0.3.0'
}
Or via Maven
<dependency>
<groupId>com.github.aryarohit07</groupId>
<artifactId>glide-facedetection-transformation</artifactId>
<version>0.3.0</version>
</dependency>
STEP 2:
Initialize the detector (May be in onCreate() method)
GlideFaceDetector.initialize(context);
STEP 3:
Set glide transform
Glide.with(yourFragment)
.load(yourUrl)
.transform(new FaceCenterCrop())
.into(yourView);
STEP 4:
The face detector uses native resources in order to do detection. For this reason, it is necessary to release the detector instance once it is no longer needed (May be in onDestory() method)
GlideFaceDetector.releaseDetector();
Note: If no face is detected, it will fallback to CENTER CROP.
Library dependencies:
com.google.android.gms:play-services-vision:9.4.0
com.github.bumptech.glide:glide:3.7.0
If you liked it, please Star it.
TODO
- Making it generic for any point.
Performance: Time taken to detect faces in the original image.
| width | height | time taken(ms) | |-------|--------|----------------| | 640 | 360 | 60-150 | | 900 | 600 | 100-200 | | 1280 | 720 | 250-350 | | 1920 | 1080 | 350-400 | | 2048 | 1536 | 500-550 |
License
Copyright 2016 Rohit Arya
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Related Skills
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
