Apple ARKit - 从CGImage创建ARFrame

问题描述 投票:0回答:1

我想使用ARKit从图像中获得光估计。我能够从视频中的帧中检索光估计。

var SceneView = new ARSCNView();
var arConfig = new ARKit.ARWorldTrackingConfiguration { PlaneDetection = ARPlaneDetection.Horizontal };
SceneView.Session.Run(arConfig, ARSessionRunOptions.ResetTracking);
var frame = SceneView.Session.CurrentFrame;
float light = frame.LightEstimate.AmbientIntensity;

但是可以使用CGImage实例化an ARFrame吗?

喜欢

CGImage img = new CGImage("my file.jpg");
ARFrame frame = new ARFrame(img);
float light = frame.LightEstimate.AmbientIntensity;

欢迎使用swift或Xamarin的解决方案

ios xamarin.ios arkit
1个回答
1
投票

抱歉,但ARFrame包装CVPixelBuffer,它代表一个视频帧,并且取决于设备可能采用与CGImage不同的格式。此外,ARFrame没有公共初始化程序,var capturedImage: CVPixelBuffer属性是只读的。但是,如果您从相机获取CGImage,那么为什么在捕获时没有得到光估计并将其与图像一起保存?

© www.soinside.com 2019 - 2024. All rights reserved.