第37讲 拍照打闪实战 -凯发k8旗舰厅

本讲是android camera专题系列的第37讲,我们介绍android camera2 api专题的拍照打闪实战。

更多资源:

资源 描述
在线课程
知识星球 星球名称:深入浅出android camera
星球id: 17296815
wechat 极客笔记圈

geekcamera2 设置不同的flash模式

cameracontroller2#camerasettings#setaemode

switch(flash_value) {
    case "flash_off":
        builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on);
        builder.set(capturerequest.flash_mode, camerametadata.flash_mode_off);
        break;
    case "flash_auto":
        // note we set this even in fake flash mode (where we manually turn torch on and off to simulate flash) so we
        // can read the flash_required state to determine if flash is required
    /*if( use_fake_precapture || cameracontroller2.this.want_expo_bracketing )
        builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on);
    else*/
        builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on_auto_flash);
        builder.set(capturerequest.flash_mode, camerametadata.flash_mode_off);
        break;
    case "flash_on":
        // see note above for "flash_auto" for why we set this even fake flash mode - arguably we don't need to know
        // about flash_required in flash_on mode, but we set it for consistency...
    /*if( use_fake_precapture || cameracontroller2.this.want_expo_bracketing )
        builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on);
    else*/
        builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on_always_flash);
        builder.set(capturerequest.flash_mode, camerametadata.flash_mode_off);
        break;
    case "flash_torch":
        builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on);
        builder.set(capturerequest.flash_mode, camerametadata.flash_mode_torch);
        break;
    case "flash_red_eye":
        // not supported for expo bracketing or burst
        if( cameracontroller2.this.burst_type != bursttype.bursttype_none )
            builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on);
        else
            builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on_auto_flash_redeye);
        builder.set(capturerequest.flash_mode, camerametadata.flash_mode_off);
        break;
    case "flash_frontscreen_auto":
    case "flash_frontscreen_on":
    case "flash_frontscreen_torch":
        builder.set(capturerequest.control_ae_mode, camerametadata.control_ae_mode_on);
        builder.set(capturerequest.flash_mode, camerametadata.flash_mode_off);
        break;
}

geekcamera2 拍照打闪流程

  1. 触发precapture

    cameracontroller2#runprecapture

  2. 等待precapture完成

    cameracontroller2#handlestatechange

  3. 拍照

    cameracontroller2#takepictureafterprecapture

camera课程

python教程

java教程

web教程

数据库教程

图形图像教程

办公软件教程

linux教程

计算机教程

大数据教程

开发工具教程

android camera2 api

网站地图