Problems with the flash of the Samsung Galaxy S5 camera

I am working on an application with custom camera features. The camera works great on the Galaxy S3, S4, HTC, Nexus, but on S5 all the photos that require a flash look dark. In the preview mode, the photo looks great, the flash fires, but what the sensor picks up is always too dark, as if the flash never fires, or the flash fires and the image is captured at different times. The flash can either be set to auto or always on, with the same effect. I tried FOCUS_MODE_CONTINUOUS_PICTURE and FOCUS_MODE_AUTO with the same result.

Does anyone have any suggestions what else to try?

Thanks Gary

+6
source share
2 answers

There seem to be 2 unrelated errors, one on the Nexus 4, the other on the Samsung S5. It seems that they both manifest themselves as one and the same problem, photographs taken in low light conditions, with the flash looking extremely dark, but has very different root causes.

Nexus 4

Nexus 4 breaks when using continuous focus in combination with a flash. This seems like a relatively well-known problem , and the only solution is to use FOCUS_MODE_AUTO instead of FOCUS_MODE_CONTINUOUS_PICTURE . The root cause seems to be taking the picture too soon before the flash gets a chance to fire.

As far as I know, Nexus 4 is the only device that needs such a special case (that is, it reports support for FOCUS_MODE_CONTINUOUS_PICTURE , but it breaks terribly with it).

 // dummy method, replace with wherever you setup camera params public void onCameraOpened(Camera camera) { Camera.Parameters params = camera.getParameters(); setFocusModeParameter( params, Build.MODEL.equals("Nexus 4") ? new String[] { Camera.Parameters.FOCUS_MODE_AUTO } : new String[] { Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE, Camera.Parameters.FOCUS_MODE_AUTO, } ); camera.setParameters(params); } public static void setFocusModeParameter(Camera.Parameters params, String... preferences) { List<String> supported_focus_modes = params.getSupportedFocusModes(); if (supported_focus_modes == null) { return; } for (String pref : preferences) { if (supported_focus_modes.contains(pref)) { params.setFocusMode(pref); return; } } } 

Samsung S5

Unlike the Nexus 4, the Samsung S5 seems to lag behind the flash, which causes a dark picture. As far as I can tell, turning on the latent latent delay delay option (in a safe way, described in the reliable section) does not seem to have a harmful effect on the following devices: Nexus 4, Nexus 5, Samsung S3, Samsung S4, Samsung Galaxy Tab S ( SM-T700).

Enable Zero Shutter Delay

Try setting the following hidden camera option, which seems to solve the problem on my S5.

 Camera.Parameters params = camera.getParameters(); params.set("zsl", "on"); camera.setParameters(params); 

More reliable solution.

If the solution above works, I use a slightly more reliable way to detect when the zsl option is zsl :

 // dummy method, replace with whatever sets up camera parameters public void onCameraOpened(Camera camera) { Camera.Parameters params = camera.getParameters(); setHiddenParameter(params, "zsl-values", "zsl", "on"); camera.setParameters(params); } public static void setHiddenParameter(Camera.Parameters params, String values_key, String key, String value) { if (params.get(key) == null) { return; } String possible_values_str = params.get(values_key); if (possible_values_str == null) { return; } String[] possible_values = possible_values_str.split(","); for (String possible : possible_values) { if (possible.equals(value)) { params.set(key, value); return; } } } 

Explanation

This part is only here to document the rabbit hole, to find this parameter, hopefully someone who knows more than me can expand this.

Symptoms

  • On the Samsung S5, shooting in extremely dark conditions with a flash set to FLASH_MODE_ON or FLASH_MODE_AUTO results in dark or completely black photographs.
  • This is not like the other device I tested (Nexus 4, Nexus 5, Samsung S3, Samsung S4)
  • If I take pictures standing next to objects (~ 3 feet) in a completely dark room, I get an extremely dark image with only a few things visible.
  • If I shoot in front of an open space (> 5 feet) in a completely dark room, I get a completely black picture.

The first thing I tried was messing around with the settings related to focus, arguing that open space would cause the focus to take longer, and thus deteriorate from the moment you take the picture with the flash. Neither FOCUS_MODE_AUTO nor FOCUS_MODE_CONTINUOUS_PICTURE seemed to help.

I also tried to lock the auto exposure and auto white balance settings before calling camera.takePicture(...) to make sure that this process does not throw out the flash time, but that didn't help either.

It still looked like a synchronization issue, so I started comparing the difference in settings between the settings used by my application and the built-in camera application.

Own camera

 12-10 15:49:08.659: W/QCameraParameters(265): [FW_DBG] setFirmwareMode: none 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] Requested preview size 1920 x 1080 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] dualrecording-hint : 0 m_FaceAE=1 Camera ID=0 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] Requested video size 1920 x 1080 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] Requested picture size 2048 x 1152 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] Requested FOV 62.000000 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] requested jpeg thumbnail size 512 x 288 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] set optimal jpeg thumbnail size 512 x 288 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] rotation val = 90 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] m_bNoDisplayMode = 0 12-10 15:49:08.659: W/QCameraParameters(265): setZslMode : m_nDualMode=0, mHdrMode=0, mTakeLowlight=0, m_bRecordingHint=0, mAutoLLS=0, m_nDualRecordingHint=0 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] ZSL = ON 12-10 15:49:08.659: I/QCameraParameters(265): [PARM_DBG] Requested FpsRange Values:(15000, 30000) 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] flash mode = on 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] AEC lock = false 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] AWB lock = false 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] mHdrMode 0 mTakeLowlight 0 12-10 15:49:08.659: E/QCameraParameters(265): SAMSUNG APPS HDR MODE 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] live snapshot size 2048 x 1152 12-10 15:49:08.659: E/QCameraParameters(265): [syscamera][setRthdrModes::2831][str::off][prev_str::off] 12-10 15:49:08.659: E/QCameraParameters(265): [syscamera][setPafModes::2863][str::on][prev_str::on] 12-10 15:49:08.659: E/QCameraParameters(265): [syscamera][setDrcModes::2891][str::on][prev_str::on] 12-10 15:49:08.659: W/QCameraParameters(265): updateParameters : X - mCameraId=0, final_rc=0, line=4465 12-10 15:49:08.659: W/QCameraParameters(265): [PARM_DBG] setNumOfSnapshot : nBurstNum = 1, nExpnum = 1 

My application

 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] Requested preview size 1920 x 1080 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] dualrecording-hint : 0 m_FaceAE=1 Camera ID=0 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] Requested video size 1920 x 1080 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] Requested picture size 2048 x 1152 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] Requested FOV 62.000000 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] requested jpeg thumbnail size 512 x 288 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] set optimal jpeg thumbnail size 512 x 288 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] m_bNoDisplayMode = 0 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] ZSL = off 12-10 15:48:33.109: I/QCameraParameters(265): [PARM_DBG] Requested FpsRange Values:(10000, 30000) 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] flash mode = on 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] AEC lock = false 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] AWB lock = false 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] mHdrMode 0 mTakeLowlight 0 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] live snapshot size 2048 x 1152 12-10 15:48:33.109: E/QCameraParameters(265): [syscamera][setPafModes::2863][str::off][prev_str::off] 12-10 15:48:33.109: E/QCameraParameters(265): [syscamera][setDrcModes::2891][str::off][prev_str::off] 12-10 15:48:33.109: W/QCameraParameters(265): updateParameters : X - mCameraId=0, final_rc=0, line=4465 12-10 15:48:33.109: W/QCameraParameters(265): [PARM_DBG] setNumOfSnapshot : nBurstNum = 1, nExpnum = 1 

Native vs. My app

The AEC (auto exposure) and AWB (white balance) lines are the same, so according to what I tried before. The only difference is the ZSL parameter, which I have never heard of before.

Googling for ZSL finds this SO answer :

To achieve zero shutter lag, the camera driver must support a small round buffer pool containing full-size frames. Images are recorded at the speed of the sensor and sent to the preview and to the round buffer pool (either as a raw buyer or as a processed / semi-professional YUV). When use presses the shutter, a new buffer in the circular pool is retrieved, processed and compressed as a JPEG. On older cameras for mobile phones, the sensor is not able to capture full-resolution frames with a sufficiently high frame rate, so ZSL cannot be implemented.

Thus, it seems that the shutter lag causes a time mismatch between when the flash fires and when the image is captured. Enabling ZSL seems to completely fix the problem. It should probably be turned on by default, given that the behavior of the flash breaks without it, but I'm not going to hold my breath on it.

+7
source

I solved it on my galaxy S5. I took the camera off by setting (top left) and turned off everything except the flash. Now he takes a photo when he blinks (not after he blinks). Photos are clean and lit. For more information, here is my setting, which appeared in automatic mode after I turned off everything. 16M Image Size 5312X2988 Flashes Low light detection Face detection ISD AUTO ISO Auto Metering modes Center-weighted Press to take photographs Selective focus off Effects No effects blink Off timer hdr (saturated tone) Metering modes Center weighted

0
source

Source: https://habr.com/ru/post/976616/


All Articles