android flash_image,Android L - Take flash image with autofocus using Camera2 api

问题

Following camera2basic guide on Android L preview page, I am able to capture normal images, i.e. without flash or using auto-focus mechanism (I rely on passive focus)

However, I would like to take a flash image. The documentation states before taking flash image, I should call android.control.aePrecaptureTrigger to determine correct exposure.

My question:

How can I call AE Precapture trigger, wait for it to complete and then take the image using capture(CaptureRequest, CameraCaptureSession.CaptureListener, Handler)?

Method I've already tried:

After user clicks capture image button, I start a preview

Set CONTROL_AE_PRECAPTURE_TRIGGER to CONTROL_AE_PRECAPTURE_TRIGGER_START

Monitor AE_STATE result in CaptureListener's onCaptureCompleted method

When AE_STATE converges, I set AE lock and take image using capture() method

However, the flash image is still over-exposed and sometimes, I get complete garbage image.

Has anyone able to get this working?

Once this is working, auto-focus mechanism can be used in similar fashion.

Thanks

回答1:

Thanks for trying out the new camera2 API!

You shouldn't need to lock AE; once you see AE_STATE as CONVERGED (or FLASH_REQUIRED), submit the still capture request.

Things to verify:

Is your AE_MODE either ON_AUTO_FLASH or ON_ALWAYS_FLASH for both the preview and the still capture requests? If not, the metering routines won't be controlling flash power or firing correctly. The still capture and preview templates may just have AE mode set to ON, which means the flash won't be fired under AE control.

Are you using CAPTURE_INTENT_STILL_PICTURE for the still capture? If not, the flash won't be fired by the automatics. This is automatically set for TEMPLATE_STILL_CAPTURE.

If you're seeing garbage images, please feel free to file a bug on our Android AOSP tracker:

http://b.android.com

Detailing the set of outputs you have for your session would be especially helpful, since we know there are some current bugs for certain output Surface sets.

回答2:

I am not sure you got answer or not. I just figure it out as follows:

First I did for capturebuilder

captureBuilder.set(CaptureRequest.CONTROL_MODE,

CameraMetadata.CONTROL_MODE_AUTO);

captureBuilder.set(CaptureRequest.FLASH_MODE,

CameraMetadata.FLASH_MODE_TORCH);

I set both because I think that flash can be able to take while auto mode.

But the result is can't get flash image when capture.

Now I get flash image after I set boolean value for flash on/off.

if (isFlashOn)

captureBuilder.set(CaptureRequest.FLASH_MODE,

CameraMetadata.FLASH_MODE_SINGLE);

else

captureBuilder.set(CaptureRequest.CONTROL_MODE,

CameraMetadata.CONTROL_MODE_AUTO);

来源:https://stackoverflow.com/questions/24626473/android-l-take-flash-image-with-autofocus-using-camera2-api

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值