Coder Social home page Coder Social logo

facedetector's Introduction

FaceDetector

Want to detect human faces on a camera preview stream in real time? Well, you came to the right place.

FaceDetector is a library which:

  • detects faces
  • works on Android
  • very simple to use
  • works greatly with Fotoapparat
  • you can use it with whichever camera library or source you like
  • uses C++ core which can easily be ported to iOS (we have plans for that)

Detecting faces with Fotoapparat is as simple as:

Fotoapparat
    .with(context)
    .into(cameraView)
    .frameProcessor(
      FaceDetectorProcessor
        .with(context)
        .build()
    )
    .build()

How it works

Step One (optional)

To display detected faces on top of the camera view, set up your layout as following.

<io.fotoapparat.facedetector.view.CameraOverlayLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <!-- Adjust parameters as you like. But cameraView has to be inside CameraOverlayLayout -->
    <io.fotoapparat.view.CameraView
        android:id="@+id/cameraView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- This view will display detected faces -->
    <io.fotoapparat.facedetector.view.RectanglesView
        android:id="@+id/rectanglesView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:rectanglesColor="@color/colorAccent"
        app:rectanglesStrokeWidth="2dp"/>

</io.fotoapparat.facedetector.view.CameraOverlayLayout>

Step Two

Create FaceDetectorProcessor:

Java:

FaceDetectorProcessor processor = FaceDetectorProcessor.with(this)
    .listener(faces -> {
        rectanglesView.setRectangles(faces);  // (Optional) Show detected faces on the view.

        // ... or do whatever you want with the result
    })
    .build()

or Kotlin:

private val processor = FaceDetectorProcessor.with(this)
    .listener({ faces ->
        rectanglesView.setRectangles(faces)  // (Optional) Show detected faces on the view.

        // ... or do whatever you want with the result
    })
    .build()

Step Three

Attach the processor to Fotoapparat

Fotoapparat.with(this)
    .into(cameraView)
    // the rest of configuration
    .frameProcessor(processor)
    .build()

And you are good to go!

Set up

Add dependency to your build.gradle

repositories {
    maven { 
        url  "http://dl.bintray.com/fotoapparat/fotoapparat" 
    }
}

implementation 'io.fotoapparat:facedetector:1.0.0'

// If you are using Fotoapparat add this one as well
implementation 'io.fotoapparat.fotoapparat:library:1.2.0' // or later version

Contact us

Impressed? We are actually open for your projects.

If you want some particular computer vision algorithm (document recognition, photo processing or more), drop us a line at [email protected].

License

Copyright 2017 Fotoapparat

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.

facedetector's People

Contributors

aballano avatar diolor avatar dmitry-zaitsev avatar dnldttmr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facedetector's Issues

How to extrat faces when detected?

Hello, I found your work and it was amazing. I'm developing such app as well, just out of curiosity.
Now everything works perfectly and I want to know to to extract peoples' faces when detected?
For example I know detected 3 people in one image and I want to classify their faces based on different labels. My first attempt was to look into what exactly was in faces list but I could understand a thing.
Hopefully you may give me some decent ideas. Thank you!

WRITE_EXTERNAL_STORAGE Permission are lost

I already added <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> in AndroidManifest.xml ,but permission are lost when i compile 'io.fotoapparat:facedetector:1.0.0'.
In order to validate the bug further,i create a new project ,config with this:

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.femtoapp.newface"
        minSdkVersion 18
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    testCompile 'junit:junit:4.12'

    compile 'io.fotoapparat:facedetector:1.0.0'
}
repositories {
    maven { url  "http://dl.bintray.com/fotoapparat/fotoapparat" }
    maven { url 'https://jitpack.io' }
}

The AndroidManifest.xml is:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.femtoapp.newface">

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

The Activity is:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initPath();
    }

    public void initPath() {
        String path = Environment.getExternalStorageDirectory().getPath() + File.separator + "AAAnewFace";
        File picture = new File(path);
        if (!picture.exists()) {
            boolean succ = picture.mkdirs();
            Log.e("mkdirs", succ + ",path=" + path);
        }
    }
}

It print E/mkdirs: false,path=/storage/emulated/0/AAAnewFace

But it works when i

//compile 'io.fotoapparat:facedetector:1.0.0'

How can I fix this bug? please.

onFacesDetected one face with two rectangle

when OnFacesDetectedListener callback , it contains two object and first is always a empty Rectangle, which means all field is 0.
Tested on Samsung S8, 7.1 os, along with fotoapparat 2.2.0

can not support internal storage?

Process: io.fotoapparat.facedetector.example, PID: 4320
io.fotoapparat.facedetector.AssetsExtractor$ExtractionException: Not a valid external directory: /mnt/internal_sd/Android/data/io.fotoapparat.facedetector.example/files
    at io.fotoapparat.facedetector.AssetsExtractor.ensureValidDirectory(AssetsExtractor.java:76)
    at io.fotoapparat.facedetector.AssetsExtractor.extractedFile(AssetsExtractor.java:69)
    at io.fotoapparat.facedetector.AssetsExtractor.extractIfNeeded(AssetsExtractor.java:29)
    at io.fotoapparat.facedetector.FaceDetector.ensureInitialized(FaceDetector.java:50)
    at io.fotoapparat.facedetector.FaceDetector.detectFaces(FaceDetector.java:42)
    at io.fotoapparat.facedetector.processor.FaceDetectorProcessor.processFrame(FaceDetectorProcessor.java:37)
    at io.fotoapparat.hardware.v1.PreviewStream1.dispatchFrame(PreviewStream1.java:115)
    at io.fotoapparat.hardware.v1.PreviewStream1.access$200(PreviewStream1.java:21)
    at io.fotoapparat.hardware.v1.PreviewStream1$2.run(PreviewStream1.java:103)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)

The quantity is wrong

Only one face in screen but the faces.size() is two. When two faces in screen the faces.size() is four.
And the image can't recognize
a

Permissions corrupted

Hi !

I'm trying to use this library but as soon as I add "compile 'io.fotoapparat:facedetector:1.0.0'" on my gradle config file, my app who usually asking me permissions to write file on the device stopped asking for it. And now I can't write any file on the device.

Any idea ?

A Little Question

  1. Your front camera can't catch the face
    2.onFacesDetected This method can only call back 1 or 2 times in 1 second, a bit slow, there is a better solution on your side.
    3.Android's FaceDetector method is also very Fast, but can't reach 1s callback more than 10 times

External Native Build Issues

External Native Build issues:
Build command failed. |  
Error while executing process C:\Users\VDHINAKA\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\VDHINAKA\Downloads\FaceDetector-master\Android\facedetector -BC:\Users\VDHINAKA\Downloads\FaceDetector-master\Android\facedetector.externalNativeBuild\cmake\debug\armeabi-v7a -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi-v7a -DANDROID_NDK=C:\Users\VDHINAKA\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\VDHINAKA\Downloads\FaceDetector-master\Android\facedetector\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:\Users\VDHINAKA\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\VDHINAKA\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_PLATFORM=android-15 -DCMAKE_CXX_FLAGS=-std=c++11 -fexceptions -DOPENCV_HOME=C:\Users\VDHINAKA\Downloads\OpenCV-2.4.11-android-sdk\OpenCV-android-sdk -DDJINNI_HOME=C:\Users\VDHINAKA\Downloads\djinni-master} |  
-- Check for working C compiler: C:/Users/VDHINAKA/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe |  
-- Check for working C compiler: C:/Users/VDHINAKA/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works |  
-- Detecting C compiler ABI info |  
-- Detecting C compiler ABI info - done |  
-- Detecting C compile features |  
-- Detecting C compile features - done |  
-- Check for working CXX compiler: C:/Users/VDHINAKA/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe |  
-- Check for working CXX compiler: C:/Users/VDHINAKA/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works |  
-- Detecting CXX compiler ABI info |  
-- Detecting CXX compiler ABI info - done |  
-- Detecting CXX compile features |  
-- Detecting CXX compile features - done |  
CMake Error at CMakeLists.txt:20 (add_library): |  
C:\Users\VDHINAKA\Downloads\djinni-master/support-lib/jni/djinni_main.cpp |  
Invalid character escape '\U'. |  
C:\Users\VDHINAKA\Downloads\djinni-master/support-lib/jni/djinni_support.cpp |  
-- Configuring incomplete, errors occurred! |  
See also "C:/Users/VDHINAKA/Downloads/FaceDetector-master/Android/facedetector/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log". |  
Build command failed. |  
Error while executing process C:\Users\VDHINAKA\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\VDHINAKA\Downloads\FaceDetector-master\Android\facedetector -BC:\Users\VDHINAKA\Downloads\FaceDetector-master\Android\facedetector.externalNativeBuild\cmake\release\armeabi-v7a -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi-v7a -DANDROID_NDK=C:\Users\VDHINAKA\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\VDHINAKA\Downloads\FaceDetector-master\Android\facedetector\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=C:\Users\VDHINAKA\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\VDHINAKA\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_PLATFORM=android-15 -DCMAKE_CXX_FLAGS=-std=c++11 -fexceptions -DOPENCV_HOME=C:\Users\VDHINAKA\Downloads\OpenCV-2.4.11-android-sdk\OpenCV-android-sdk -DDJINNI_HOME=C:\Users\VDHINAKA\Downloads\djinni-master} |  
-- Check for working C compiler: C:/Users/VDHINAKA/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe |  
-- Check for working C compiler: C:/Users/VDHINAKA/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works |  
-- Detecting C compiler ABI info |  
-- Detecting C compiler ABI info - done |  
-- Detecting C compile features |  
-- Detecting C compile features - done |  
-- Check for working CXX compiler: C:/Users/VDHINAKA/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe |  
-- Check for working CXX compiler: C:/Users/VDHINAKA/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works |  
-- Detecting CXX compiler ABI info |  
-- Detecting CXX compiler ABI info - done |  
-- Detecting CXX compile features |  
-- Detecting CXX compile features - done |  
CMake Error at CMakeLists.txt:20 (add_library): |  
C:\Users\VDHINAKA\Downloads\djinni-master/support-lib/jni/djinni_main.cpp |  
Invalid character escape '\U'. |  
C:\Users\VDHINAKA\Downloads\djinni-master/support-lib/jni/djinni_support.cpp |  
-- Configuring incomplete, errors occurred! |  
See also "C:/Users/VDHINAKA/Downloads/FaceDetector-master/Android/facedetector/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log". |  

OPENCV_HOME

Could not get unknown property 'OPENCV_HOME' for object of type com.android.build.gradle.internal.dsl.ExternalNativeCmakeOptions.

How to take photo

How can i take photo the frontFotoapparat takePicture method does not take argument for picture callback kindly help tanx

Use Google Vision API w/ Fotoapparat

I want to use Fotoapparat in combination with the Google Vision API and work with landmarks to detect faces, eyes, nose and mouth; like this:

Landmarks on faces

The Fotoapparat FaceDetector only shows a square around faces.

Can I use your library together with Google's API? If so: how?

open failed: EACCES (Permission denied)

compile this module,and add it in my project, then have this problem.
open failed: EACCES (Permission denied)
i can not access any file in my android phone.

when added to gradle it put a MAX SDK

but when this library is added at my app gradle the manifest became this:

 <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="18" />
    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="18" />

maxSdkVersion added by FaceDetector

the maxSdkVersion is not necessary for me, since most of all my users use sdk 19+

recognize not so accurate

image
thisthis is my java code,when i test it,i fount the log continus,even there is no face in the cameraview
and the action not always take effect

Can not request "Manifest.permission.READ_EXTERNAL_STORAGE" permission

when request the that permission,there is not a dialog to show ,
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_STORAGE); } else { Intent intent = new Intent(MainActivity.this, CameraActivity.class); startActivityForResult(intent, GET_PIC); }

Improve the docs telling needed environment variables with their values

I came to your repo through a StackOverflow answer.
You're CMakeLists.txt file is using environment variables (OpenCV_LIBS in particular).
It would be nice to include the expected variables with their values.
It would save time to those people like me not very accustomed to OpenCV.
Thanks in advance.

how to use V2Provider?

I'm trying to use the V2Provider in some devices which api level is higher than 21, but the lib can not detect the face; when I switched to V1Provider, it's work properly, could you please show me how to use the V2Provider?
my code:

        Fotoapparat
                .with(this)
                .cameraProvider(CameraProviders.v2(this))
                .into(cameraView)
                .lensPosition(lensPosition(position))
                .frameProcessor(faceProcessor)
                .logger(loggers(
                        logcat(),
                        fileLogger(this)
                ))
                .build();

Camera view is black, no video preview and no faces are detected

I am using FotoApparat in my App.
When I try to implement the facedetector the Camera View stays black. Nothing to see.

app/build.gradle:

    implementation 'io.fotoapparat:facedetector:1.0.0'
    implementation 'io.fotoapparat:fotoapparat:2.7.0'

MainActivity.kt:


    override fun onCreate(savedInstanceState: Bundle?) {
            ...
        createFotoapparat()
           ...
     }

    private fun createFotoapparat(){
        val cameraView = findViewById<CameraView>(R.id.cameraView)
        fotoapparat = Fotoapparat(
            context = this,
            view = cameraView,
            scaleType = ScaleType.CenterCrop,
            lensPosition = back(),
            logger = loggers(
                logcat()
            ),
            cameraErrorCallback = { error ->
                println("Recorder errors: $error")
            }
        ) 
        // now the processor - when I delete this and also the layouts in the view, Camera preview is visible again
        val processor = FaceDetectorProcessor.with(this)
            .listener({ faces ->
                rectanglesView.setRectangles(faces)  // (Optional) Show detected faces on the view.
                Log.v("Faces",faces.toString());   // is never called!
                // ... or do whatever you want with the result
            })
            .build()

        Fotoapparat.with(this)
            .into(cameraView)
            // the rest of configuration
            .frameProcessor(processor)
            .build()

    }

activity_main.xml:


    <io.fotoapparat.facedetector.view.CameraOverlayLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        <!-- Adjust parameters as you like. But cameraView has to be inside CameraOverlayLayout -->
        <io.fotoapparat.view.CameraView
                android:id="@+id/cameraView"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        <!-- This view will display detected faces -->
        <io.fotoapparat.facedetector.view.RectanglesView
                android:id="@+id/rectanglesView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:rectanglesColor="@color/colorAccent"
                app:rectanglesStrokeWidth="2dp"/>

    </io.fotoapparat.facedetector.view.CameraOverlayLayout>

I don't get any errors, but I don't see anything. No faces, no camera preview stream.

...

When I add this line, I get the error (I am not sure if this is needed, when I already io.fotoapparat:fotoapparat:2.7.0) :

ERROR: Failed to resolve: io.fotoapparat.fotoapparat:library:1.0.0

for:

    // If you are using Fotoapparat add this one as well
    implementation 'io.fotoapparat.fotoapparat:library:1.2.0' // or later version 

Any ideas?

take photo

How can i take a picture with backFotoapparat object

Camera click

how can we take the picture .and save to gallery

App Theme is failing

I have added the Gradle's for using the FOTOApparat. But, it's crashing my App while I am using Coordinator Layout.

Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) of the design library.
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout

If I remove the Gradle dependency of this Library than everything is working fine. Can you please help me solving this issue.

Proguard rule

We used this library in release configuration which proguard turned on but it gave us error
Warning: io.fotoapparat.facedetector.processor.FaceDetectorProcessor: can't find referenced field 'io.fotoapparat.parameter.Size size' in program class io.fotoapparat.preview.Frame

I think it will be great if you can provide proguard rule. thanks

Incompatible with FotoApparat

Is this repo being maintained?
FotoApparat is already at 2.3.3 and this processor is totally incompatible with it.

Some questions

Hi, thanks for this state-of-the-art library. That's not an issue but just a few questions.

  • What problems I'd possibly face if I try to develop an iOS module on top of Core?
  • Is it possible to use the GPU acceleration with OpenCL and UMat instead of Mat?

Rectangles are mirrored when using front camera

Currently face rectangles are drawn incorrectly when using front camera, because they should be mirrored. At the moment Fotoapparat does not provide us information about whether we should mirror the image or not. So, some changes might be needed there as well.

Release apk is getting crashed with below error

Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception java.lang.ClassNotFoundException: Didn't find class "io.fotoapparat.facedetector.FaceDetectorWrapper$CppProxy" on path: DexPathList[[zip file "/data/app/com.example.andy.myapplication-Srioie4wYP_3uHNep4-U4A==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.andy.myapplication-Srioie4wYP_3uHNep4-U4A==/lib/arm64, /data/app/com.example.andy.myapplication-Srioie4wYP_3uHNep4-U4A==/base.apk!/lib/arm64-v8a, /system/lib64]]
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:196)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class) (Runtime.java:-2)
at java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader) (Runtime.java:1115)
at void java.lang.Runtime.loadLibrary0(java.lang.ClassLoader, java.lang.Class, java.lang.String) (Runtime.java:1069)
at void java.lang.Runtime.loadLibrary0(java.lang.Class, java.lang.String) (Runtime.java:1007)
at void java.lang.System.loadLibrary(java.lang.String) (System.java:1667)
at void e.a.d.b.() (:13)
at e.a.d.b e.a.d.b.a(android.content.Context) (:28)
at void e.a.d.e.a.(e.a.d.e.a$b) (:27)
at void e.a.d.e.a.(e.a.d.e.a$b, e.a.d.e.a$a) (:19)
at e.a.d.e.a e.a.d.e.a$b.a() (:100)
at e.a.a com.example.andy.myapplication.MainActivity.a(e.a.h.c) (:192)
at void com.example.andy.myapplication.MainActivity.onCreate(android.os.Bundle) (:111)
at void android.app.Activity.performCreate(android.os.Bundle, android.os.PersistableBundle) (Activity.java:7955)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:7944)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1307)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:3463)
at android.app.Activity android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.app.servertransaction.PendingTransactionActions, android.content.Intent) (ActivityThread.java:3635)
at void android.app.servertransaction.LaunchActivityItem.execute(android.app.ClientTransactionHandler, android.os.IBinder, android.app.servertransaction.PendingTransactionActions) (LaunchActivityItem.java:83)
at void android.app.servertransaction.TransactionExecutor.executeCallbacks(android.app.servertransaction.ClientTransaction) (TransactionExecutor.java:135)
at void android.app.servertransaction.TransactionExecutor.execute(android.app.servertransaction.ClientTransaction) (TransactionExecutor.java:95)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:2175)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:107)
at void android.os.Looper.loop() (Looper.java:237)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7860)
at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1075)

    in call to NewGlobalRef
    from java.lang.String java.lang.Runtime.nativeLoad(java.lang.String, java.lang.ClassLoader, java.lang.Class)'

Incompatibility with Fotoapparat 2.1.2

Hi!

I'm trying to couple FaceDetector to Fotoapparat but it looks like the newest version of it is incompatible with FaceDetector.

The following code is used to startup the camera and the detector:

val faceDetectorProcessor = FaceDetectorProcessor.with(this).listener { rectanglesView.setRectangles(it) }.build()

fotoApparat = Fotoapparat.with(this) .into(cameraView) .frameProcessor { faceDetectorProcessor.processFrame(it) } .build()

As you can see, the FrameProcessor property is now a lambda, so i've adapted the call.

But i'm receiving the following error (the application is crashing) if i run this code:

E/AndroidRuntime: FATAL EXCEPTION: pool-10-thread-1 Process: br.com.esapiens.ysos, PID: 17567 java.lang.IllegalAccessError: Field 'io.fotoapparat.preview.Frame.image' is inaccessible to class 'io.fotoapparat.facedetector.processor.FaceDetectorProcessor' (declaration of 'io.fotoapparat.facedetector.processor.FaceDetectorProcessor' appears in /data/app/br.com.esapiens.ysos-1/split_lib_dependencies_apk.apk) at io.fotoapparat.facedetector.processor.FaceDetectorProcessor.processFrame(FaceDetectorProcessor.java:37) at br.com.esapiens.ysos.camera.CameraActivity$onCreate$1.invoke(CameraActivity.kt:27) at br.com.esapiens.ysos.camera.CameraActivity$onCreate$1.invoke(CameraActivity.kt:11) at io.fotoapparat.preview.PreviewStream.dispatchFrame(PreviewStream.kt:92) at io.fotoapparat.preview.PreviewStream.access$dispatchFrame(PreviewStream.kt:14) at io.fotoapparat.preview.PreviewStream$dispatchFrameOnBackgroundThread$1.run(PreviewStream.kt:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.