第19讲 app如何实现zsl功能 -凯发k8旗舰厅

本讲是android camera专题系列的第19讲,我们介绍android camera2 api专题的实战_app如何实现zsl功能。

更多资源:

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

reprocessable architecture

reprocessable architecture

reprocessable flow

reprocessable flow

geekcamera2 zsl

判断是否支持reprocess

mstaticmetadata = new staticmetadata(manager.getcameracharacteristics(cameraids));
misreprocesablesupport =
        mstaticmetadata.iscapabilitysupported(
                cameracharacteristics.request_available_capabilities_yuv_reprocessing) ||
                mstaticmetadata.iscapabilitysupported(
                        cameracharacteristics.request_available_capabilities_private_reprocessing);

获取input size和format

private void setupinputsizeandformat() {
    if (misreprocesablesupport) {
        mmaxinputstreams =
                mstaticmetadata.getvaluefromkeynonnull(cameracharacteristics.request_max_num_input_streams);
    }
    if (mydebug.log) {
        log.i(tag, "[zsl] max supported input streams:"   mmaxinputstreams  
                        ",misreprocesablesupport:"   misreprocesablesupport  
                        ",menablereprocessable:"   menablereprocessable);
    }
    try {
        if (menablereprocessable && misreprocesablesupport) {
            if (isopaquereprocesssupported(cameraids)) {
                minputformat = imageformat.private;
                minputsize = getmaxsize(minputformat, staticmetadata.streamdirection.input);
                log.i(tag, "[zsl] choose private reprocess.");
                return;
            }
            if (isyuvreprocesssupported(cameraids)) {
                minputformat = imageformat.yuv_420_888;
                minputsize = getmaxsize(minputformat, staticmetadata.streamdirection.input);
                log.i(tag, "[zsl] choose yuv reprocess.");
                return;
            }
        }
    } catch (exception e) {
    }
    if (mydebug.log) {
        log.i(tag, "reprocess not enabled.");
    }
}

创建inputconfiguration

if (menablereprocessable && mmaxinputstreams > 0 && misreprocesablesupport) {
    log.i(tag, "[zsl] new inputconfiguration.");
    inputconfiguration = new inputconfiguration(minputsize.getwidth(),
            minputsize.getheight(),
            minputformat);
}

获取reprocess capturerequest

if (menablereprocessable && mmaxinputstreams > 0 && misreprocesablesupport) {
    try {
        log.i(tag, "[zsl] createreprocesscapturerequest begin");
        image inputimage = minputimagereaderlistener.getimage(3000);
        log.i(tag, "[zsl] createreprocesscapturerequest");
        stillbuilder = mcameradevice.createreprocesscapturerequest(
                mzslresultlistener.getcaptureresult(3000, inputimage.gettimestamp()));
        log.i(tag, "[zsl] image writer queueinputimage, timestamp:"   inputimage.gettimestamp());
        minputimagewriter.queueinputimage(inputimage);
        inputimage.close();
        log.i(tag, "[zsl] createreprocesscapturerequest end");
    } catch (exception e) {
        log.e(tag, "createreprocesscapturerequest failed:"   e.tostring());
    }
}

camera课程

python教程

java教程

web教程

数据库教程

图形图像教程

办公软件教程

linux教程

计算机教程

大数据教程

开发工具教程

android camera2 api

网站地图