1

My Nexus 5 isn't supporting the HDR scene mode of the camera api (as well as the camera2 api). Is this due to the manufacturer support? If so, what I want to implement HDR scene mode in a custom camera app as in the stock camera?

I tried using both the camera APIs but none was supporting the SCENE_MODE_HDR parameter.

Using the android.hardware.camera api: (Logs HDR mode not supported)

List<String> sceneModes = params.getSupportedSceneModes();
if (sceneModes.contains(Camera.Parameters.SCENE_MODE_HDR)) {
    Log.d("HDR", "HDR mode supported");
    params.setSceneMode(Camera.Parameters.SCENE_MODE_HDR);
} else {
    Log.d("HDR", "HDR mode not supported");
}

And using the android.hardware.camera2 api: (Logs HDR mode not supported)

CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
int[] sceneModes= characteristics.get(CameraCharacteristics.CONTROL_AVAILABLE_SCENE_MODES);
boolean isHDRsupported = false;
for (int sceneMode : sceneModes) {
    if (sceneMode == CameraCharacteristics.CONTROL_SCENE_MODE_HDR) {
        isHDRsupported = true;
        break;
    }
}
Log.d("HDR", "HDR mode " + (isHDRsupported ? "" : "not ") + "supported");

Am I missing something obvious here?

gopi1410
  • 6,567
  • 9
  • 41
  • 75

2 Answers2

2

The Nexus 5 does not have support for an HDR scene mode.

The HDR+ mode in the included camera app is part of the application itself (there's a blog post about how it works on top of the camera2 API).

Eddy Talvala
  • 17,243
  • 2
  • 42
  • 47
  • Ohh. Thanks! So there is no way I can take HDR pictures using just the android camera APIs, right? – gopi1410 Aug 05 '15 at 04:30
  • Not without implementing an HDR merge yourself, or getting a library from somewhere. The hardware can certainly get you a fast burst of images with different settings to get the necessary data, it just won't do the merge. – Eddy Talvala Aug 05 '15 at 23:27
0

Did you try?

Camera.Parameters cameraParameters = camera.getParameters();
cameraParameters.setSceneMode(Camera.Parameters.SCENE_MODE_HDR);
camera.setParameters(cameraParameters);
Sampath
  • 1,144
  • 1
  • 21
  • 38
  • Yep, this will throw an exception that parameter not supported. It is ALWAYS recommended to check before setting the param whether the param is supported or not by getting the list of available modes. – gopi1410 Aug 03 '15 at 07:31
  • Pleae try to query: SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.DefaultHDR) – Sampath Aug 03 '15 at 07:33
  • which class is `SystemInfo`? I am talking about android api here – gopi1410 Aug 03 '15 at 07:36
  • 1
    Apologies. My mistake. Can you please follow the below link. I hope it might help you: https://developer.android.com/samples/HdrViewfinder/src/com.example.android.hdrviewfinder/HdrViewfinderActivity.html – Sampath Aug 03 '15 at 09:21
  • Or this (line 243 onwards): https://developer.android.com/samples/HdrViewfinder/src/com.example.android.hdrviewfinder/HdrViewfinderActivity.html – Sampath Aug 03 '15 at 09:23
  • This is not meant to be an answer, you should post it as a comment. Links too are meant to be a comment unless you a code snippet. Kindly read the rules of answering on stackoverflow: http://stackoverflow.com/help/promotion and http://stackoverflow.com/help/how-to-answer Thanks! – gopi1410 Aug 03 '15 at 10:04