1

Is it posible access to Camera parameters in CameraSource on Android's Mobile Vision API 8.4? I want to be able to adjust some Camera parameters (Shutter speed, ISO, aperture,...).

UPDATE I try to do it using this code:

public Camera getCamera(CameraSource cameraSource) {

    Field[] declaredFields = CameraSource.class.getDeclaredFields();
    for (Field field : declaredFields) {
        if (field.getType() == Camera.class) {
            field.setAccessible(true);
            try {
                Camera camera = (Camera) field.get(cameraSource);
                if (camera != null) {
                    return camera;
                }

                return null;
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }

            break;
        }
    }

    return null;
}

But it doesn´t work for me, field.get(cameraSource); return null when get the field with type Camera.class.

Android-Vision team, do you plan to add these feature in the next releases?

Best regards,

Christian

Peña
  • 307
  • 4
  • 10
  • Have you read the documentation? – Code-Apprentice Feb 03 '16 at 22:25
  • Yes, I read the documentation @Code-Apprentice, it is not posible with the API, but some smart guys discover way to get access ([link](https://gist.github.com/Gericop/364dd12b105fdc28a0b6)), but it doesn´t work for me. – Peña Feb 03 '16 at 22:30
  • It sounds like your question is incomplete. Please edit your question to include what you have tried and what happened when you compile and run it. – Code-Apprentice Feb 03 '16 at 22:31

1 Answers1

1

We have no plans to expose the underlying camera in the official API. But there's an open source version of this class that you can use and modify:

https://github.com/googlesamples/android-vision/blob/master/visionSamples/barcode-reader/app/src/main/java/com/google/android/gms/samples/vision/barcodereader/ui/camera/CameraSource.java

pm0733464
  • 2,862
  • 14
  • 16