I am writing an android application to capture flash/no-flash image pair quickly when a user presses capture button. For writing my application I referred to Camera2Basic app here.
From Android documentation, I found that for flash to fire, the preview request builder should have AE_MODE set to AE_MODE_ON_ALWAYS_FLASH.
I am using three request builders: preview, noflash and flash The difference between three is:
preview: AE_MODE set to AE_MODE_ON_ALWAYS_FLASH and AF_MODE set to CONTROL_AF_MODE_CONTINUOUS_PICTURE
noflash: AE_MODE set to AE_MODE_ON
flash: AE_MODE set to AE_MODE_ONALWAYS_FLASH
I am using Nexus 5 device and I found that for capturing just a flash image, one must have preview builder and flash builder as described above, and submit a still capture request using above flash builder. Using this sequence, I always get a proper flash image in Nexus 5. The pre-flash is always automatically handled.
Coming to original question, capturing a pair of flash/no-flash images, my sequence of steps is as follows:
In take picture, I start auto-focus trigger using preview builder.
When auto-focus is complete, I submit two still capture requests back to back using noflash and flash builders (first noflash, then flash)
However, the first image I get is a flash image and second is a no-flash image. I don't understand this reversal in output.
- JPEG case: First image is always a proper flash image, second image is always a proper no-flash image as shown below:
Flash image corresponding to request submitted using noflash builder:
No-flash image corresponding to request submitted using flash builder:
- YUV_420_888 case: Sames as in JPEG, however, noflash image is never proper. One can notice a white strip on right side as well as improper colors, also it is very noisy!
Flash image corresponding to request submitted using noflash builder:
Improper no-flash image corresponding to request submitted using flash builder:
Off-course, since in YUV_420_888 format two images are captured back to back, I add a preview request in between to prevent spill over.
My questions are:
Why the order of output images is reversed?
Why no-flash image in YUV_420_888 format is not proper?
Please help.