0

I would like to use ARKit to obtain a light estimate from an image. I was able to retrieve a light estimate from a frames in a video.

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;

However is it possible to instantiate an ARFrame using a CGImage?

Like

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

Solutions using swift or Xamarin are welcome

Fortega
  • 19,463
  • 14
  • 75
  • 113
RyeGuy
  • 4,213
  • 10
  • 33
  • 57

1 Answers1

1

Sorry, but ARFrame wraps CVPixelBuffer, which represents a video frame and depending on the device is likely in a different format than CGImage. Also ARFrame has no public initializer and the var capturedImage: CVPixelBuffer property is read only. However if you are getting the CGImage from the camera then why no get the light estimate at the time of capture and save it along with the image?

Josh Homann
  • 15,933
  • 3
  • 30
  • 33
  • Thanks for the response. Is their a way to access the iPhone's camera light sensor? I am able to get the brightness metadata from the image but it would be great to get the light readings from the iPhone's hardware – RyeGuy Nov 22 '17 at 00:32
  • Unfortunately its not a public API, so you cannot use it if you are submitting to the App store: https://stackoverflow.com/questions/18271145/accessing-the-ambient-light-sensor-in-ios – Josh Homann Nov 22 '17 at 00:39