Example usage for android.hardware.camera2 CaptureResult LENS_APERTURE

List of usage examples for android.hardware.camera2 CaptureResult LENS_APERTURE

Introduction

In this page you can find the example usage for android.hardware.camera2 CaptureResult LENS_APERTURE.

Prototype

Key LENS_APERTURE

To view the source code for android.hardware.camera2 CaptureResult LENS_APERTURE.

Click Source Link

Document

The desired lens aperture size, as a ratio of lens focal length to the effective aperture diameter.

Setting this value is only supported on the camera devices that have a variable aperture lens.

When this is supported and CaptureRequest#CONTROL_AE_MODE android.control.aeMode is OFF, this can be set along with CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime , CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity , and CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration to achieve manual exposure control.

The requested aperture value may take several frames to reach the requested value; the camera device will report the current (intermediate) aperture size in capture result metadata while the aperture is changing.

Usage

From source file:freed.cam.apis.camera2.modules.PictureModuleApi2.java

@NonNull
private void process_rawWithDngConverter(ImageHolder image, int rawFormat, File file) {
    Log.d(TAG, "Create DNG VIA RAw2DNG");
    ByteBuffer buffer = image.getImage().getPlanes()[0].getBuffer();
    byte[] bytes = new byte[buffer.remaining()];
    buffer.get(bytes);// w w w .j a v  a2 s.  c  om

    float fnum, focal = 0;
    fnum = image.getCaptureResult().get(CaptureResult.LENS_APERTURE);
    focal = image.getCaptureResult().get(CaptureResult.LENS_FOCAL_LENGTH);
    Log.d("Freedcam RawCM2", String.valueOf(bytes.length));

    int mISO = image.getCaptureResult().get(CaptureResult.SENSOR_SENSITIVITY).intValue();
    double mExposuretime = image.getCaptureResult().get(CaptureResult.SENSOR_EXPOSURE_TIME).doubleValue();
    //        int mFlash = image.getCaptureResult().get(CaptureResult.FLASH_STATE).intValue();
    //        double exposurecompensation= image.getCaptureResult().get(CaptureResult.CONTROL_AE_EXPOSURE_COMPENSATION).doubleValue();
    final DngProfile prof = getDngProfile(rawFormat, image);
    saveRawToDng(file, bytes, fnum, focal, (float) mExposuretime, mISO,
            image.captureResult.get(CaptureResult.JPEG_ORIENTATION), null, prof);
    image.getImage().close();
    bytes = null;
    buffer = null;
    image = null;
}

From source file:com.almalence.opencam.PluginManagerBase.java

@TargetApi(21)
public boolean addToSharedMemExifTagsFromCaptureResult(final CaptureResult result, final long SessionID,
        final int num) {
    String exposure_time = String.valueOf(result.get(CaptureResult.SENSOR_EXPOSURE_TIME));
    String sensitivity = String.valueOf(result.get(CaptureResult.SENSOR_SENSITIVITY));
    String aperture = String.valueOf(result.get(CaptureResult.LENS_APERTURE));
    String focal_lenght = String.valueOf(result.get(CaptureResult.LENS_FOCAL_LENGTH));
    String flash_mode = String.valueOf(result.get(CaptureResult.FLASH_MODE));
    String awb_mode = String.valueOf(result.get(CaptureResult.CONTROL_AWB_MODE));

    if (num != -1 && exposure_time != null && !exposure_time.equals("null"))
        addToSharedMem("exiftag_exposure_time" + num + SessionID, exposure_time);
    else if (exposure_time != null && !exposure_time.equals("null"))
        addToSharedMem("exiftag_exposure_time" + SessionID, exposure_time);
    if (sensitivity != null && !sensitivity.equals("null"))
        addToSharedMem("exiftag_iso" + SessionID, sensitivity);
    if (aperture != null && !aperture.equals("null"))
        addToSharedMem("exiftag_aperture" + SessionID, aperture);
    if (focal_lenght != null && !focal_lenght.equals("null"))
        addToSharedMem("exiftag_focal_lenght" + SessionID, focal_lenght);
    if (flash_mode != null && !flash_mode.equals("null"))
        addToSharedMem("exiftag_flash" + SessionID, flash_mode);
    if (awb_mode != null && !awb_mode.equals("null"))
        addToSharedMem("exiftag_white_balance" + SessionID, awb_mode);

    return true;/*from ww  w.  ja va2  s .  c om*/
}