首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从增强现实应用程序的摄像机图像中估计环境光强度和颜色?

如何从增强现实应用程序的摄像机图像中估计环境光强度和颜色?
EN

Stack Overflow用户
提问于 2020-02-06 04:45:19
回答 2查看 479关注 0票数 0

ARKit和ARCore具有估计环境光强度和颜色以进行逼真渲染的功能。

ARKit:https://developer.apple.com/documentation/arkit/arlightestimate?language=objc

ARCore:[https://developers.google.com/ar/reference/java/arcore/reference/com/google/ar/core/LightEstimate#getColorCorrection(float[],%20int)](https://developers.google.com/ar/reference/java/arcore/reference/com/google/ar/core/LightEstimate#getColorCorrection(float[],%20int%29)

它们都暴露了环境强度和环境颜色。在ARKit中,颜色以开尔文为单位,而在ARCore中,颜色是RGB颜色校正。

问题1:开尔文和色彩校正有什么不同,它们如何应用于渲染?

问题2:从相机帧估计光线强度和颜色的算法是什么?如果我们想自己实现它,有没有现有的代码或研究论文可以参考?

EN

回答 2

Stack Overflow用户

发布于 2020-02-06 20:24:59

ARCore的问题2:这是一篇关于How Environmental HDR works的研究论文

以下是关于environmental HDR in ARCore + Sceneform的简短摘要

希望它对您的搜索有所帮助:)

票数 1
EN

Stack Overflow用户

发布于 2020-02-08 19:15:35

假设您已经在"ship.scn“SCNScene中添加了一个名为' light‘的灯光节点,并将SCNLight附加到该节点,并且您的ViewController符合ARSessionDelegate,因此您可以获得每帧的灯光估计值:

代码语言:javascript
复制
class ViewController: UIViewController, ARSCNViewDelegate, ARSessionDelegate {

@IBOutlet var sceneView: ARSCNView!

override func viewDidLoad() {
    super.viewDidLoad()
    sceneView.delegate = self
    let scene = SCNScene(named: "art.scnassets/ship.scn")!
    sceneView.scene = scene
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    let configuration = ARWorldTrackingConfiguration()
    configuration.isLightEstimationEnabled = true
    sceneView.session.run(configuration)
    sceneView.session.delegate = self
}

func session(_ session: ARSession, didUpdate frame: ARFrame) {
    guard let lightEstimate = frame.lightEstimate,
    let light = sceneView.scene.rootNode.childNode(withName: "light", recursively: false)?.light else {return}
    light.temperature = lightEstimate.ambientColorTemperature
    light.intensity = lightEstimate.ambientIntensity
}

}

因此,如果你调暗房间里的灯光,SceneKit也会调暗虚拟灯光。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60083858

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档