Skip to content

Instantly share code, notes, and snippets.

@electrolobzik
Last active April 22, 2016 14:20
Show Gist options
  • Save electrolobzik/c4e58f4850c9d74b329cad7e241ca924 to your computer and use it in GitHub Desktop.
Save electrolobzik/c4e58f4850c9d74b329cad7e241ca924 to your computer and use it in GitHub Desktop.
/**
* Factory for creating a face tracker to be associated with a new face. The multiprocessor
* uses this factory to create face trackers as needed -- one for each individual.
*/
private class GraphicFaceTrackerFactory implements MultiProcessor.Factory<Face> {
@Override
public Tracker<Face> create(Face face) {
return FaceTracker.builder()
.withCameraType(CameraType.FrontCamera)
.withPreviewWidth(cameraSource.getPreviewSize().getHeight())
.withPreviewHeight(cameraSource.getPreviewSize().getWidth())
.withPictureWidth(cameraSource.getPictureSize().getWidth())
.withPreviewViewWidth(cameraSourcePreview.getWidth())
.withPreviewViewHeight(cameraSourcePreview.getHeight())
.withFrame(selfieFrameImg.getLeft(), centralLayout.getTop(), selfieFrameImg.getRight(), centralLayout.getBottom())
.withListener(new TestFaceTrackerListener())
.withTrackingLoggingEnabled(graphicOverlay)
.build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment