VIVO 相机HDR拍照流程拆解

和你一起终身学 习,这里是程序员Android

经典好文推荐,通过阅读本文,您将收获以下知识点:

  1. HDR 场景下发 3 帧拍照请求
  2. HDR 3帧拍照请求帧(478,479 480)
  3. HDR 3帧 result callback帧
  4. HDR 算法处理
    5.算法编解码处理
  5. HDR 拍照log关键字

HDR : 高动态范围成像(英语:High Dynamic Range Imaging,简称HDRI或HDR),在计算机图形学与电影摄影术中,是用来实现比普通数位图像技术更大曝光动态范围(即更大的明暗差别)的一组技术。高动态范围成像的目的就是要正确地表示真实世界中从太阳光直射到最暗的阴影这样大的范围亮度.

HDR即指高动态光照渲染,HDR是一种提高影像亮度和对比度的处理技术,与普通图像相比,HDR可以提供更多的动态范围和图像细节,利用每个曝光时间相对应最佳细节的LDR图像来合成最终HDR图像,能够更好地反映出真实环境中的视觉效果。^[^

1. HDR 场景下发 3 帧拍照请求

HDR 场景下,点击拍照按钮,提交拍照请求,拍照请求帧为3,5帧(trace 中submitRequestList

下可以看到 3 个 createCaptureRequest

)。

点击拍照按钮提交拍照请求

2. HDR 3帧拍照请求帧(478,479 480)


3帧拍照请求帧

3. HDR 3帧 result callback帧


HDR 3帧 result callback帧

4. HDR 算法处理


HDR 算法处理

5.算法编解码处理


算法编解码处理

6. HDR 拍照log关键字

部分log关键字如下:

onShutterButtonFocus|connect call|Creating new stream|AlgoNativeInterface: HDR|AlgoNativeInterface: pAlgoParams|AlgoNativeInterface: algo process|IMG_20240829_195647.jpg|ACTION_UP|CAMAP_MAIN

部分log分析如下:

go 复制代码
onShutterButtonFocus|connect call|Creating new stream|AlgoNativeInterface: HDR|AlgoNativeInterface: pAlgoParams|AlgoNativeInterface: algo process|IMG_20240829_195647.jpg|ACTION_UP|CAMAP_MAIN
    
    // 启动 cameraactivity
    行  205615: 08-29 19:56:29.548 10140 30284 30284 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:main] CameraActivity---onStart, ActivityCode: 81415032
    行  205620: 08-29 19:56:29.551 10140 30284 30284 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:main] CameraActivity---onNewIntent, ActivityCode: 81415032
    行  205755: 08-29 19:56:29.589 10140 30284 30284 V CAMAP_MAIN:: IS_LOG_CTRL_OPEN = true
    行  205756: 08-29 19:56:29.589 10140 30284 30284 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:main] CameraActivity---onResumeTask, ActivityCode: 81415032 version: 12.1.78.8
    //  下发open camera
    行  205856: 08-29 19:56:29.632 10140 30284 19959 D _V_CAM_CameraModeProxyIml: CAMAP_MAIN: [Thread:camera_task] task thread---open camera E, CameraParam [ facing : FACING_BACK, modeName : Normal, cameraType : Master, mVModeInfo : 
    行  205863: 08-29 19:56:29.634 10140 30284 19959 D _V_CAM_CameraModeProxyIml: CAMAP_MAIN: [Thread:camera_task] task thread---open camera X
    //  连接cameraservice connect call
    行  205884: 08-29 19:56:29.646  1047  1557  3193 I CameraService: CameraService::connect call (PID 30284 "com.android.camera", camera ID 0) and Camera API version 2
    行  205956: 08-29 19:56:29.660 10140 30284 30284 D _V_CAM_StateMachine: CAMAP_MAIN: [Thread:main] change state --- photo : [ StateDestroy -> StateInit ]
    //  配3路流 Creating new stream
    行  206304: 08-29 19:56:29.769  1047  1557  3193 I Camera3-Device: Camera 0: Creating new stream 0: 1080 x 1080, format 34, dataspace 0 rotation 0 consumer usage 0, isShared 0, physicalCameraId , isMultiResolution 0 dynamicRangeProfile 0x1, streamUseCase 0, timestampBase 0, mirrorMode 0, colorSpace -1, useReadoutTimestamp 0
    行  206330: 08-29 19:56:29.775  1047  1557  3193 I Camera3-Device: Camera 0: Creating new stream 1: 1080 x 1080, format 35, dataspace 146931712 rotation 0 consumer usage 0, isShared 0, physicalCameraId , isMultiResolution 0 dynamicRangeProfile 0x1, streamUseCase 0, timestampBase 0, mirrorMode 0, colorSpace -1, useReadoutTimestamp 0
    行  206349: 08-29 19:56:29.787  1047  1557  3193 I Camera3-Device: Camera 0: Creating new stream 2: 3060 x 3060, format 35, dataspace 146931712 rotation 0 consumer usage 0, isShared 0, physicalCameraId , isMultiResolution 0 dynamicRangeProfile 0x1, streamUseCase 0, timestampBase 0, mirrorMode 0, colorSpace -1, useReadoutTimestamp 0
    行  207156: 08-29 19:56:30.141 10140 30284 19992 D _V_CAM_CameraModeProxyIml: CAMAP_MAIN: [Thread:camera_callback] onConfigured mode = BackNormalMainMode
    行  207163: 08-29 19:56:30.141 10140 30284 30284 D _V_CAM_StateMachine: CAMAP_MAIN: [Thread:main] change state --- photo : [ StateCameraOpened -> StateSessionCreated ]
    //  开始起预览请求 startPreview
    行  207247: 08-29 19:56:30.168 10140 30284 19959 D _V_CAM_CameraModeProxyIml: CAMAP_MAIN: [Thread:camera_task] ---startPreview PreviewParam {    [previewdetect = 140821240225795],    [eyeDetect = -1],    [previewAiDetect = [-1, -1]],    [vivo.control.ois = true],    [relight = 0],    [vivo.control.face.detect = true],    [vcamsdk.repeating.VideoStabilization = true],    [vivo.control.singleBlur_level = 0],    [vivo.control.portrait.effect = 0],    [vivo.record.eis.mode.enable = false],    [vivo.control.motionVersion=17],    [android.control.videoStabilizationMode=1],    [vivo.control.sod.state=0],    [vivo.parameter.temperature=43],    [vivo.control.captureStateForDetect=0],    [android.jpeg.orientation=90],    [vivo.parameter.cameraColdStart=false],    [custom.zoom=1.0],    [custom.flash_mode=0],    [custom.exposure_value=0],    }
    行  207407: 08-29 19:56:30.259 10140 30284 30284 D _V_CAM_ThumbnailAddition: CAMAP_MAIN: [Thread:main] updateThumbnailView
    //  首帧可用callback onFirstFrameAvailableCallback onFirstFrameAvailable
    行  207867: 08-29 19:56:30.431 10140 30284 19501 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:VIEngine-Main]  onFirstFrameAvailableCallback
    行  207887: 08-29 19:56:30.437 10140 30284 30284 D _V_CAM_CameraActivity: CAMAP_MAIN: [Thread:main]  onFirstFrameAvailable
    //  HDR 场景下点击拍照 ACTION_UP  onShutterButtonFocus
    行  211606: 08-29 19:56:32.015 10069  3054  3054 D _V_InputEventReceiver: dispatchInputEvent ,vLog[a2c672 StatusBar (client)] ,event=MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=524.0, y[0]=420.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=76500757, downTime=76500650, deviceId=5, source=0x1002, displayId=0, eventId=17122441 }
    行  215088: 08-29 19:56:33.250 10069  3054  3054 D _V_InputEventReceiver: dispatchInputEvent ,vLog[375f109 NotificationShade (client)] ,event=MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=313.0, y[0]=651.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=76502116, downTime=76502045, deviceId=5, source=0x1002, displayId=0, eventId=980268846 }
    行  222254: 08-29 19:56:37.928 10069  3054  3054 D _V_InputEventReceiver: dispatchInputEvent ,vLog[375f109 NotificationShade (client)] ,event=MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=686.0, y[0]=2186.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=76506799, downTime=76505392, deviceId=5, source=0x1002, displayId=0, eventId=840324513 }
    行  235965: 08-29 19:56:47.169 10140 30284 30284 D _V_CAM_BaseBottomBar: CAMAP_MAIN: [Thread:main] onShutterButtonFocus  pressed = true
    行  237770: 08-29 19:56:48.077 10122 10844  4581 D AlgoNativeInterface: algo process E
    //  HDR 算法处理
    行  237774: 08-29 19:56:48.077 10122 10844  4581 D AlgoNativeInterface: algo process img[0] fd 109 width 3060 height 3060 stride 3072 scanline 3072 size 14155776 numFds 2 numInts 23 version 12
    行  237775: 08-29 19:56:48.077 10122 10844  4581 D AlgoNativeInterface: algo process img[1] fd 111 width 3060 height 3060 stride 3072 scanline 3072 size 14155776 numFds 2 numInts 23 version 12
    行  237776: 08-29 19:56:48.078 10122 10844  4581 D AlgoNativeInterface: algo process img[2] fd 113 width 3060 height 3060 stride 3072 scanline 3072 size 14155776 numFds 2 numInts 23 version 12
    行  237779: 08-29 19:56:48.078 10122 10844  4581 D AlgoNativeInterface: algo process imageFormat: 0x23 requestId: 8
    行  237814: 08-29 19:56:48.080 10122 10844  4581 D AlgoNativeInterface: HDR 3-frames version
    行  237872: 08-29 19:56:48.090 10122 10844  4581 D AlgoNativeInterface: pAlgoParams->frameFlag: 1724932607175 localtime:20240829195647
    //  HDR 算法选帧 478 479 480 3帧
    行  237889: 08-29 19:56:48.090 10122 10844  4581 D AlgoNativeInterface: pAlgoParams->frameId[0]: 478
    行  237890: 08-29 19:56:48.090 10122 10844  4581 D AlgoNativeInterface: pAlgoParams->frameId[1]: 479
    行  237891: 08-29 19:56:48.090 10122 10844  4581 D AlgoNativeInterface: pAlgoParams->frameId[2]: 480
    行  237985: 08-29 19:56:48.095 10122 10844  4581 D AlgoNativeInterface: hdrGains[0]: 6.733059, hdrShutters[0]: 30.000000, hdrFrameIndex:0
    行  237986: 08-29 19:56:48.095 10122 10844  4581 D AlgoNativeInterface: hdrGains[1]: 10.965449, hdrShutters[1]: 30.000000, hdrFrameIndex:1
    行  237987: 08-29 19:56:48.095 10122 10844  4581 D AlgoNativeInterface: hdrGains[2]: 1.454850, hdrShutters[2]: 10.000000, hdrFrameIndex:2
    行  238000: 08-29 19:56:48.096 10122 10844  4581 D AlgoNativeInterface: pAlgoParams->shotAeRegions left:0 top:0 right:0 bottom:0
    行  238009: 08-29 19:56:48.098 10122 10844  4581 D AlgoNativeInterface: algo process: pAlgoParams->satCropRegions ltwh 0 0 0

参考文献:

【腾讯文档】Camera学习知识库

https://docs.qq.com/doc/DSWZ6dUlNemtUWndv

至此,本篇已结束。转载网络的文章,小编觉得很优秀,欢迎点击阅读原文,支持原创作者,如有侵权,恳请联系小编删除,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!

点个在看,为大佬点赞!

相关推荐
lqj_本人9 小时前
鸿蒙next版开发:相机开发-预览(ArkTS)
数码相机·华为·harmonyos
光场视觉9 小时前
四焦距聚焦型光场计算成像系统的设计
数码相机·视觉检测·光场
OCR_wintone42113 小时前
易泊车牌识别相机:4S 店的智能之选
人工智能·数码相机·ocr
Deepcong17 小时前
世界坐标系、相机坐标系、图像物理坐标系、像素平面坐标系
数码相机·平面
lqj_本人1 天前
鸿蒙next版开发:相机开发-元数据(ArkTS)
数码相机·华为·harmonyos
DOT小文哥1 天前
成本400元,DIY一个高刷新率热成像相机
数码相机·全志·diy·热成像
机器视觉知识推荐、就业指导1 天前
使用 Qt 实现基于海康相机的图像采集和显示系统(不使用外部视觉库,如Halcon\OpenCv)[工程源码联系博主索要]
数码相机·qt
lqj_本人2 天前
鸿蒙next版开发:相机开发-录像(ArkTS)
数码相机·华为·harmonyos
lqj_本人2 天前
鸿蒙next版开发:相机开发-拍照(ArkTS)
数码相机·华为·harmonyos
lqj_本人2 天前
鸿蒙next版开发:相机开发-适配不同折叠状态的摄像头变更(ArkTS)
数码相机·华为·harmonyos