Hello everyone,
for my first post on this forum I come to you with the following issue: When I get a Grain Texture from an ARKit currentFrame and try to convert it to a CIImage, the app crashes. This is my code:
let grainTexture = arView.session.currentFrame!.cameraGrainTexture!
let grainIntensity = arView.session.currentFrame!.cameraGrainIntensity
let metalTexture = grainTexture as MTLTexture
let ciImage = CIImage(mtlTexture: metalTexture, options: [CIImageOption.colorSpace: CGColorSpaceCreateDeviceGray()])!
I have force-unwrapped the grain texture and grain intensity just to make sure I am getting them, the error occurs when I try to convert the MTLTexture to a CIImage. There is no difference if I use metalTexture as intermediary or not, the app always freezes there, saying it found nil when force unwrapping. What could be causing this?
Any and all help would be greatly appreciated.
Cheers!