Example usage for android.hardware.camera2 CaptureResult LENS_FOCAL_LENGTH

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

Introduction

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

Prototype

Key LENS_FOCAL_LENGTH

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

Click Source Link

Document

The desired lens focal length; used for optical zoom.

This setting controls the physical focal length of the camera device's lens.

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 va 2s. co m

    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   w  ww .  j a v a2 s .  c  o  m
}