Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-zaitsev authored Jul 12, 2017
1 parent 10beb1c commit 01a8489
Showing 1 changed file with 65 additions and 1 deletion.
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,69 @@ FaceDetector is:
- detects faces
- works on Android
- very simple to use
- comes with (Fotoapparat)[https://github.com/Fotoapparat/Fotoapparat] integration (but you can use it with whatever you like)
- comes with (https://github.com/Fotoapparat/Fotoapparat)[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).

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

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

### Step Three

Attach it as processor to `Fotoapparat`

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

And you are good to go!

## Set up

Add dependency to your `build.grade`

```groovy
```

0 comments on commit 01a8489

Please sign in to comment.