三星Galaxy S5相机闪光灯的问题 [英] Samsung Galaxy S5 Camera Flash Problems

查看:226
本文介绍了三星Galaxy S5相机闪光灯的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的自定义相机功能的应用程序。该相机工作正常在Galaxy S3,S4,HTC,Nexus的,但在S5,所有需要闪光灯的照片显得较暗。照片看起来很好在preVIEW,闪光灯闪光,但什么是传感器捕捉总是太黑了,好像闪光灯从来没有发射过,或闪光灯闪光和图像的捕捉发生在不同的次。闪光灯既可以设置为自动或始终上,具有相同的效果。我试过FOCUS_MODE_CONTINUOUS_PICTURE和FOCUS_MODE_AUTO,具有相同的结果。

I am working on an app with custom Camera functionality. The Camera is working fine on the Galaxy S3, S4, HTC, Nexus, but on the S5, all of the photos that require flash come out dark. The photo looks fine in the preview, the flash fires, but what is captured by the sensor is always too dark, as if the flash never fired off, or the firing of the flash and the capturing of the image happened at different times. The flash can be either set to auto or to always on, with the same effect. I've tried FOCUS_MODE_CONTINUOUS_PICTURE and FOCUS_MODE_AUTO, with the same result.

没有人有任何建议,什么尝试?

Does anyone have any suggestions what else to try?

感谢你, 加里

推荐答案

好像这里有两个不相关的错误,一上的Nexus 4,其他关于三星S5。他们似乎都表现为同样的问题,对采取在低光照条件下闪光灯的照片显得非常黑,但有非常不同的根本原因。

It seems like there are 2 unrelated bugs here, one on the Nexus 4, the other on the Samsung S5. They both seem to manifest as the same issue, pictures taken in low light conditions with the flash on appear extremely dark, but have very different root causes.

Nexus的4断裂与闪光灯一起使用时连续对焦时。这似乎是href="http://stackoverflow.com/a/14761650/1830800">比较知名的问题唯一的解决办法似乎是使用 FOCUS_MODE_AUTO FOCUS_MODE_CONTINUOUS_PICTURE >。根本原因似乎与过早拍摄照片,闪光灯都有机会火了。

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

据我所知,的Nexus 4是一个需要这种特殊的外壳(即它的报告支持 FOCUS_MODE_CONTINUOUS_PICTURE ,但休息可怕吧)的唯一设备。

As far as I know, the Nexus 4 is the only device that needs this kind of special casing (i.e. it reports supporting FOCUS_MODE_CONTINUOUS_PICTURE but breaks horribly 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;
        }
    }
}

三星S5

不像的Nexus 4,三星S5似乎滞后闪光灯引起一团漆黑后面。据我所知道的,打开隐藏的零快门延迟参数(在强劲的部分中描述的安全的方式)似乎对以下设备没有不良影响:的Nexus 4,Nexus的5,三星S3,三星S4,三星Galaxy Tab的S(SM-T700)。

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 hidden zero shutter lag parameter (in the safe manner described in the robust section) seems to have no ill effects on the following devices: Nexus 4, Nexus 5, Samsung S3, Samsung S4, Samsung Galaxy Tab S (SM-T700).

尝试设置下面的隐藏摄像头的参数,这似乎解决了这个问题对我的S5。

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

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

更强大的解决方案

如果上述工程的解决方案,我用一个稍微更可靠的方法来检测,当 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;
        }
    }
}

说明

这部分是只有在这里记录了兔子洞找到这个参数,希望有人知道的比我可以在此展开。

Explanations

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

症状:

  • 在三星S5,采取用闪光灯设置极暗条件图片 FLASH_MODE_ON FLASH_MODE_AUTO 导致深色或全黑的照片。
  • 这似乎并没有发生在我测试过的任何其他设备(的Nexus 4,Nexus的5,三星S3,三星S4)
  • 如果我拍照站在接近一个完全黑暗的房间中的对象(〜3英尺),我得到一个非常黑暗的画面,只有几件事情可见。
  • 如果我拍照的开放空间(> 5英尺)在一个完全黑暗的房间前,我得到一个全黑的画面。
  • On the Samsung S5, taking pictures in extremely dark conditions with the flash set to FLASH_MODE_ON or FLASH_MODE_AUTO leads to dark or completely black photos.
  • This does not seem to happen on any other device I have tested (Nexus 4, Nexus 5, Samsung S3, Samsung S4)
  • If I take pictures standing close to the objects (~3 ft) in a completely dark room, I get a extremely dark picture with only a few things visible.
  • If I take pictures in front of an open space (>5 ft) in a completely dark room, I get a completely black picture.

我试过被搞乱,重点相关的设置,理由是空地将导致焦点需要更长的时间,从而与拍摄照片的闪光的时间搞乱的第一件事。无论是 FOCUS_MODE_AUTO FOCUS_MODE_CONTINUOUS_PICTURE 似乎帮助的情况下。

The first thing I tried was messing with focus related settings, reasoning that the open space would cause the focus to take longer, thus messing with the timing of taking the picture with the flash. Neither FOCUS_MODE_AUTO nor FOCUS_MODE_CONTINUOUS_PICTURE seemed to help the situation.

我也打过电话 camera.takePicture(...)之前锁定自动曝光和自动最大光圈调整,以确保这些过程中没有扔闪光定时关闭,但是这似乎并没有帮助的。

I also tried locking the auto-exposure and auto-whitebalance adjustments before calling camera.takePicture(...) to make sure those process weren't throwing the flash timing off, but that did not seem to help either.

它仍然感觉像虽然是计时问题,所以我开始在我的应用程序是使用与原生相机应用的参数之间的参数比较差。

It still felt like a timing issue though, so I started comparing the difference in parameters between the parameters my app was using vs. the native camera app.

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

我的应用程序

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

本机与我的应用程序

在AEC(自动曝光)和AWB(白平衡)行是相同的,所以这是与我之前已经试过一致。唯一的区别是ZSL参数,这是我从来没有听说过的。

Native vs. My App

The AEC (auto exposure) and AWB (white balance) lines are the same, so that's consistent with what I've tried before. The one difference is the ZSL parameter, which I've never heard of before.

谷歌搜索ZSL认为这 SO回答

Googling for ZSL finds this SO answer:

要实现零快门时滞,摄像头驱动程序必须维护包含全分辨率帧一圆形小缓冲池。拍摄的图像感应器在速度和发送到preVIEW和循环缓冲池(无论是作为原始Bayer或处理/半加工YUV)。当使用presses快门,在圆形水池最新的缓冲器被提取,加工和COM pressed为JPEG。在旧的手机摄像头,传感器不能拍摄全分辨率帧画面,在足够高的帧速率,因此ZSL无法实施。

To achieve zero shutter lag, the camera driver must maintain a small circular buffer pool containing full resolution frames. Images are captured at sensor rate and are sent to preview and to the circular buffer pool (either as raw Bayer or as processed/semi-processed YUV). When the use presses the shutter, the newest buffer in the circular pool is extracted, processed and compressed as JPEG. On older mobile phone cameras, the sensor is not able to capture full resolution frames at a high enough frame rate, and therefore ZSL cannot be implemented.

因此​​,它似乎像快门时滞将导致当图像被捕获闪光灯闪光时之间的时序不匹配。打开ZSL似乎完全消除此问题。它可能应该是在默认情况下,因为闪光灯的行为是没有它坏了,但我不会认为我的呼吸在那一个。

So it seems like the shutter lag causes a timing mismatch between when the flash fires and when the picture is captured. Turning on ZSL seems to eliminate the issue entirely. It should probably be on by default given that flash behaviour is broken without it, but I'm not going to hold my breath on that one.

这篇关于三星Galaxy S5相机闪光灯的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆