camera2连拍手动模式

时间:2017-11-23 09:51:25

标签: android capture android-camera2

我使用基于camera2的突发捕获,设置Iso和曝光时间值。设置ISO 50,曝光时间1/30秒,但有些图片将变为ISO 100,曝光时间为1/60。 为什么呢?

1 个答案:

答案 0 :(得分:1)

我用我的设定值得到了照片,参考: https://android.googlesource.com/platform/cts/+/a0077cc/tests/tests/hardware/src/android/hardware/camera2/cts/BurstCaptureRawTest.java

  • 构建具有手动曝光和灵敏度的突发请求数组。
    • 对于每个捕获请求,3A和后处理(降噪,锐化等)将是
    • 关掉了。然后将配置曝光和灵敏度值,由
    • 确定
    • EXPOSURE_MULIPLIERS和SENSITIVITY_MULTIPLIERS。
    • *
    • @param rawBurstBuilder构建器需要设置目标。
    • @return用于突发的数组列表捕获请求。 * / private ArrayList createBurstRequest(CaptureRequest.Builder rawBurstBuilder) { 返回createBurstRequest(rawBurstBuilder,EXPOSURE_MULTIPLIERS,SENSITIVITY_MLTIPLIERS); } private ArrayList createBurstRequest(CaptureRequest.Builder rawBurstBuilder,     long [] exposureMultipliers,int [] sensitivityMultipliers){ //设置手动模式 rawBurstBuilder.set(CaptureRequest.CONTROL_AE_MODE,CaptureRequest.CONTROL_AE_MODE_OFF); rawBurstBuilder.set(CaptureRequest.CONTROL_AWB_MODE,CaptureRequest.CONTROL_AWB_MODE_OFF); rawBurstBuilder.set(CaptureRequest.NOISE_REDUCTION_MODE,         CaptureRequest.NOISE_REDUCTION_MODE_OFF); rawBurstBuilder.set(CaptureRequest.EDGE_MODE,CaptureRequest.EDGE_MODE_OFF); //曝光优先于帧持续时间;因此帧读出时间: //曝光时间+开销 rawBurstBuilder.set(CaptureRequest.SENSOR_FRAME_DURATION,0L); //获得曝光和灵敏度范围 范围exposureRangeNs = new Range(mStaticInfo.getExposureMinimumOrDefault(),         mStaticInfo.getExposureMaximumOrDefault()); 范围isoRange = new Range(mStaticInfo.getSensitivityMinimumOrDefault(),         mStaticInfo.getSensitivityMaximumOrDefault()); Log.i(TAG,String.format("曝光时间 - 最大:%d,min:%d。",exposureRangeNs.getUpper(),         exposureRangeNs.getLower())); Log.i(TAG,String.format("敏感度 - 最大值:%d,min:%d。",isoRange.getUpper(),         isoRange.getLower())); //构建突发请求 int maxFramesBurst = exposureMultipliers.length * sensitivityMultipliers.length; Log.i(TAG,String.format("设置突发=%d帧。",maxFramesBurst)); ArrayList rawRequestList = new ArrayList(maxFramesBurst); for(int i = 0; i< exposureMultipliers.length; i ++){     for(int j = 0; j< sensitivityMultipliers.length; j ++){         long desiredExposure = Math.min(                 exposureRangeNs.getLower()* exposureMultipliers [i],                 exposureRangeNs.getUpper());         int desiredSensitivity =                 Math.min(isoRange.getLower()* sensitivityMultipliers [j],                         isoRange.getUpper());         rawBurstBuilder.set(CaptureRequest.SENSOR_EXPOSURE_TIME,desiredExposure);         rawBurstBuilder.set(CaptureRequest.SENSOR_SENSITIVITY,desiredSensitivity);         rawRequestList.add(rawBurstBuilder.build());     } } return rawRequestList; }