FaceAware-Android
FaceAware-Android copied to clipboard
this helps to auto zoom for face on ImageView
FaceAware for Android
FaceAware is zoom library to face automatically for Android.
This library uses ML Kit for detecting the face. Your application size will be increased around 800kb after you add this library into your project.
Setup
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
def faceAwareVersion = "4.0.1"
implementation "com.github.memishood:FaceAware-Android:$faceAwareVersion"
}
AndroidManifest.xml
This step isn't required but it is nice to have that describing which ML-Kit model will be exactly used in your application. You might want to see example manifest file in here
<meta-data
android:name="com.google.mlkit.vision.DEPENDENCIES"
android:value="face" />
Layout XML
<ee.webmob.faceaware.FaceAware
android:id="@+id/faceAware"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_gravity="center"
android:src="@drawable/image"
app:facePadding="20"
app:shape="rounded"
app:borderRadius="20dp" />
Kotlin
faceAware.setImageResource(R.drawable.test)
// or
faceAware.setImageDrawable(ActivityCompat.getDrawable(this,R.drawable.test))
// or
Glide.with(this).load(uri).into(faceAware)
// or
Picasso.get().load(uri).into(faceAware)
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
| facePadding | double | 0 | Padding that will be given after focusing on the face |
| shape | enum | rounded | Whether it will be circle or rounded |
| borderRadius | dimension | 0dp | Border radius for rounded shape |
For better understanding