0

In my android application I need both face detection and ORC function at the same time. Can I implement both on same CameraSource? Is it possible?

Context context = getApplicationContext();

TextRecognizer textRecognizer = new TextRecognizer.Builder(context).build();
textRecognizer.setProcessor(new OcrDetectorProcessor(mGraphicOverlay));

FaceDetector detector = new FaceDetector.Builder(context).setClassificationType(FaceDetector.ALL_CLASSIFICATIONS).build();
detector.setProcessor(new MultiProcessor.Builder<>(new GraphicFaceTrackerFactory()).build());

mCameraSource = new CameraSource.Builder(getApplicationContext(), detector)
                    .setFacing(CameraSource.CAMERA_FACING_BACK)
                    .setRequestedPreviewSize(1280, 1024)
                    .setRequestedFps(15.0f)
                    .setFlashMode(useFlash ? Camera.Parameters.FLASH_MODE_TORCH : null)
                    .setFocusMode(autoFocus ? Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE : null)
                    .build();

In the sample codes they pass only one detector at a time to the CameraSource. textRecognizer or detector

Sathindu
  • 407
  • 1
  • 5
  • 21

1 Answers1

1

Update: I have found a way. You can create a MultiDetector and add both FaceDetector and TextRecognizer in to that and pass the MultiDetector object in to CameraSource.Builder

MultiDetector multiDetector = new MultiDetector.Builder()
            .add(textRecognizer)
            .add(detector)
            .build();

The multi-detector will receive a series of frames from the camera source. Each frame is submitted to both detectors. MultiFetector

Sathindu
  • 407
  • 1
  • 5
  • 21