MCPcopy Index your code
hub / github.com/RedApparat/FaceDetector

github.com/RedApparat/FaceDetector @1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.0 ↗ · + Follow
83 symbols 167 edges 14 files 15 documented · 18%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

FaceDetector

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

FaceDetector is:

  • detects faces
  • works on Android
  • very simple to use
  • comes with Fotoapparat integration (but you can use it with whatever you like)
  • with a C++ core which can easily be ported to iOS (we have plans for that)

How it works

For simplicity let's assume that you are using Fotoapparat as your camera library. If you don't - plese refer to FaceDetector documentation (it is just 1 method).

Step One

If you would like to display detected faces right on top of camera, set up your layout as following (otherwise skip this step).

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


    <io.fotoapparat.view.CameraView
        android:id="@+id/cameraView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


    <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:

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()

Step Three

Attach it as processor to Fotoapparat

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

And you are good to go!

Set up

Add dependency to your build.grade

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

compile 'io.fotoapparat:facedetector:1.0.0'

// If you are using Fotoapparat add this one as well
compile 'io.fotoapparat.fotoapparat:library:1.1.0'

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.

Extension points exported contracts — how you extend this code

OnFacesDetectedListener (Interface)
Notified when faces are detected. [2 implementers]
Android/facedetector/src/main/java/io/fotoapparat/facedetector/processor/FaceDetectorProcessor.java

Core symbols most depended-on inside this repo

with
called by 4
Android/facedetector/src/main/java/io/fotoapparat/facedetector/processor/FaceDetectorProcessor.java
build
called by 4
Android/facedetector/src/main/java/io/fotoapparat/facedetector/processor/FaceDetectorProcessor.java
requestCameraPermission
called by 2
Android/app/src/main/java/io/fotoapparat/facedetector/app/PermissionsDelegate.java
createFotoapparat
called by 2
Android/app/src/main/java/io/fotoapparat/facedetector/app/MainActivity.java
listener
called by 2
Android/facedetector/src/main/java/io/fotoapparat/facedetector/processor/FaceDetectorProcessor.java
applyAttributes
called by 2
Android/facedetector/src/main/java/io/fotoapparat/facedetector/view/RectanglesView.java
setRectangles
called by 2
Android/facedetector/src/main/java/io/fotoapparat/facedetector/view/RectanglesView.java
requestCameraPermission
called by 2
Example/Android/FaceDetectorExample/app/src/main/java/io/fotoapparat/facedetector/example/PermissionsDelegate.java

Shape

Method 60
Class 13
Function 9
Interface 1

Languages

Java80%
C++20%

Modules by API surface

Android/facedetector/src/main/java/io/fotoapparat/facedetector/processor/FaceDetectorProcessor.java11 symbols
Example/Android/FaceDetectorExample/app/src/main/java/io/fotoapparat/facedetector/example/MainActivity.java10 symbols
Android/app/src/main/java/io/fotoapparat/facedetector/app/MainActivity.java10 symbols
Android/facedetector/src/main/java/io/fotoapparat/facedetector/AssetsExtractor.java9 symbols
Android/facedetector/src/main/java/io/fotoapparat/facedetector/view/RectanglesView.java6 symbols
Android/facedetector/src/main/cpp/FaceDetectorImpl.cpp6 symbols
Example/Android/FaceDetectorExample/app/src/main/java/io/fotoapparat/facedetector/example/PermissionsDelegate.java5 symbols
Core/cli/src/main.cpp5 symbols
Android/facedetector/src/main/java/io/fotoapparat/facedetector/view/CameraOverlayLayout.java5 symbols
Android/facedetector/src/main/java/io/fotoapparat/facedetector/FaceDetector.java5 symbols
Android/app/src/main/java/io/fotoapparat/facedetector/app/PermissionsDelegate.java5 symbols
Core/library/src/FaceDetector.h3 symbols

For agents

$ claude mcp add FaceDetector \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact