# Picasso face detection transformation
[ ![Download](https://api.bintray.com/packages/aryarohit07/android/picasso-facedetection-transformation/images/download.svg) ](https://bintray.com/aryarohit07/android/picasso-facedetection-transformation/_latestVersion)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-PicassoFaceDetectionTransformation-blue.svg?style=flat)](http://android-arsenal.com/details/1/4015)
### An Android image transformation library providing cropping above Face Detection (Face Centering) for [Picasso](https://github.com/square/picasso)
Are you using **Glide**? [GlideFaceDetectionTransformation](https://github.com/aryarohit07/GlideFaceDetectionTransformation).
Are you using **Fresco**? [FrescoFaceDetectionProcessor](https://github.com/aryarohit07/FrescoFaceDetectionProcessor).
Results
------
**Original Image**
![original image 1](/images/original_image1.jpg?raw=true )
**Results after cropping**
![resulting image 1](/images/result_image1.jpg?raw=true)
**Original Image**
![original image 2](/images/original_image2.jpg?raw=true )
**Results after cropping**
![resulting image 2](/images/result_image2.jpg?raw=true)
**Original Image**
![original image 3](/images/original_image3.jpg?raw=true )
**Results after cropping**
![resulting image 3](/images/result_image3.jpg?raw=true)
**Original Image**
![original image 4](/images/original_image4.jpg?raw=true )
**Results after cropping**
![resulting image 4](/images/result_image4.jpg?raw=true)
You can read more on [my Medium article](https://medium.freecodecamp.com/face-centering-android-library-build-on-top-of-google-vision-api-f88661b97959).
### How to use it?
STEP 1:
Grab via Gradle
```
repositories {
jcenter()
}
dependencies {
compile 'com.github.aryarohit07:picasso-facedetection-transformation:0.3.0'
}
```
Or via Maven
```
<dependency>
<groupId>com.github.aryarohit07</groupId>
<artifactId>picasso-facedetection-transformation</artifactId>
<version>0.3.0</version>
</dependency>
```
STEP 2:
Initialize the detector (May be in `onCreate()` method)
```java
PicassoFaceDetector.initialize(context);
```
STEP 3:
Set picasso transform
-------
```java
Picasso
.with(context)
.load(url)
.fit() // use fit() and centerInside() for making it memory efficient.
.centerInside()
.transform(new FaceCenterCrop(100, 100)) //in pixels. You can also use FaceCenterCrop(width, height, unit) to provide width, height in DP.
.into(imageView);
```
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)
```java
PicassoFaceDetector.releaseDetector();
```
**Note:** If no face is detected, it will fallback to CENTER CROP.
Library dependencies:
------
```java
com.google.android.gms:play-services-vision:9.4.0
com.squareup.picasso:picasso:2.5.2
```
**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.
没有合适的资源?快使用搜索试试~ 我知道了~
带面部识别的裁剪(将人脸裁剪到中间)
共26个文件
jpg:8个
gradle:3个
java:3个
5星 · 超过95%的资源 需积分: 50 42 下载量 181 浏览量
2017-01-07
23:01:36
上传
评论 2
收藏 397KB ZIP 举报
温馨提示
这是一个和Picasso配合使用的图片剪裁库,特点就是自带面部识别,会把脸部剪裁到中间。
资源推荐
资源详情
资源评论
收起资源包目录
PicassoFaceDetectionTransformation-master.zip (26个子文件)
PicassoFaceDetectionTransformation-master
gradlew 5KB
settings.gradle 19B
images
original_image3.jpg 46KB
result_image4.jpg 53KB
original_image2.jpg 23KB
result_image3.jpg 48KB
original_image1.jpg 40KB
result_image2.jpg 29KB
result_image1.jpg 39KB
original_image4.jpg 54KB
library
src
androidTest
java
com
rohitarya
picasso
facedetection
transformation
ApplicationTest.java 381B
main
AndroidManifest.xml 424B
res
values
strings.xml 97B
java
com
rohitarya
picasso
facedetection
transformation
FaceCenterCrop.java 6KB
core
PicassoFaceDetector.java 2KB
.gitignore 7B
build.gradle 979B
proguard-rules.pro 654B
gradle
wrapper
gradle-wrapper.properties 231B
gradle-wrapper.jar 52KB
README.md 4KB
gradlew.bat 2KB
gradle.properties 210B
.gitignore 443B
CHANGELOG.md 785B
build.gradle 498B
共 26 条
- 1
资源评论
- Asama浅间2023-07-29这份文件提供了一个非常实用的功能,可以将人脸裁剪到中间,方便用户快速进行面部识别。
- 傅融2023-07-29这份文件的面部识别功能帮助我将人脸准确地裁剪到中间,节省了很多时间。
- 高工-老罗2023-07-29这个文件的裁剪功能非常方便实用,让人感觉使用起来非常顺手。
- 奔跑的楠子2023-07-29这个文件的面部识别效果非常准确,帮助我快速将人脸裁剪到了合适的位置。
- 練心2023-07-29这份文件的面部识别功能非常实用,可以帮助我轻松裁剪人脸到图片的中间,让照片更加专业。
android-feiniao
- 粉丝: 3
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功