Skip to content

Cleveroad/ARFaceDetection

Repository files navigation

ARFaceDetection Awesome

Header image

Meet ARFaceDetection by Cleveroad

We’re glad to share with you our latest AR-based library for Android. It’s designed with ARCore technology and is capable of detecting faces and overlaying images above the user’s head considering multiple parameters to make them look realistic (e.g. head movements).

Demo image

You can try the functionality of the library right on your devices! Go to this link to download our application from Google Play Store.

Awesome

Awesome

Setup

To use ARFaceDetection first add dependency to your project:

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.cleveroad.ARFaceDetection:ar-face-detection:1.0.2'
}

AndroidManifest

<manifest ...>
    ...
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
    <uses-feature android:name="android.hardware.camera"/>
    <uses-feature android:name="android.hardware.camera.autofocus"/>
    <application ...>
    ....
        <meta-data 
            android:name="com.google.ar.core" 
            android:value="required"/>
        <meta-data
            android:name="com.google.firebase.ml.vision.DEPENDENCIES"
            android:value="face"/>
    ...
   </application>
</manifest>

Firebase

  • Create a Firebase project to connect to your Android app and setup it. Link to firebase console https://console.firebase.google.com/
  • Move your config file(google-services.json) into the module (app-level) directory of your app. Application class
class MyApp : Application() {
    ...
    override fun onCreate() {
        super.onCreate()
        ...
        FirebaseApp.initializeApp(this)
        ...   
   }
}

Usage

Face detection val MLKit

val fragment = FaceDetectorFragment.newInstance(R.drawable.icon)       
supportFragmentManager.beginTransaction().apply {
    replace(R.id.container, fragment, fragment.javaClass.simpleName)
}.commit()

Face detection val ARCore

val fragment = AugmentedFacesFragment.newInstance(R.drawable.icon)
supportFragmentManager.beginTransaction().apply {
   replace(R.id.container, fragment, fragment.javaClass.simpleName)
}.commit()

Restrictions

ARCore minSdkVersion ≥ 24 supported devices: https://developers.google.com/ar/discover/supported-devices MLKIt minSdkVersion ≥ 21

Changelog

See changelog history.

Support


If you have any other questions regarding the use of this library, please contact us for support at info@cleveroad.com (email subject: "ARFaceDetection. Support request.")

License


The MIT License (MIT)

Copyright (c) 2019 Cleveroad Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.