I'm developing an App that uses Surfaceview. I can take pictures and everything's fine.
My problem is: the image of the preview is too dark. I try to change the SceneMode of the camera, but nothing is working (I've tried AUTO, NIGHT and NIGHT_PORTRAIT).
Here is the difference between pictures taken with my app:
and the Android Camera App (native):
Here's my code (the params used on cam):
c = Camera.open(0);
Camera.Parameters params = c.getParameters();
params.setSceneMode(Camera.Parameters.SCENE_MODE_NIGHT);
params.setAutoExposureLock(true);
params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
if (params.getMaxNumMeteringAreas() > 0){ // check that metering areas are supported
List<Camera.Area> meteringAreas = new ArrayList<>();
Rect areaRect1 = new Rect(-100, -100, 100, 100); // specify an area in center of image
meteringAreas.add(new Camera.Area(areaRect1, 600)); // set weight to 60%
Rect areaRect2 = new Rect(800, -1000, 1000, -800); // specify an area in upper right of image
meteringAreas.add(new Camera.Area(areaRect2, 400)); // set weight to 40%
params.setMeteringAreas(meteringAreas);
}
c.setParameters(params);
Anyone can help me?
Thanks!