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!
Post
Replies
Boosts
Views
Activity
Hello all, this has been puzzling me for a good few hours now.
My config is a SwiftUI view from where I am calling a UIViewRepresentable that makes up my ARView. The representable is passed a delegate and an ARView instance
RealityKitView(arView: $arView, sceneDelegate: $delegate)
I have set up a delegate for my ARView like so:
class MySessionDelegate: NSObject, ARSessionDelegate, ARSessionObserver {
var bufferArray: [CMSampleBuffer] = []
func session(
_ session: ARSession,
didOutputAudioSampleBuffer audioSampleBuffer: CMSampleBuffer
){
bufferArray.append(audioSampleBuffer)
}
}
and of course I set audio samples to be provided with
config.providesAudioData = true in the makeUIView function.
But for some reason I don't get more than 125 samples. I set up a counter in the session function to see how many samples I get and it always just stops at 124..I have no idea why this is happening. I also tested on different devices (iPad Pro from 2021 and iPhone 11) and it always stops at 124 samples and then just doesn't do anything anymore...what the hell? :D
Do I need to do anything special when linking the delegate to my arview? I am just doing session.delegate = delegate in the makeUIView function
Any and all help would be greatly appreciated!
When I install and run the sample app Apple released just recently, everything works fine up until I try to start the capture. Bounding box sets up without a problem, but then every time, this error occurs:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] You are not authorized to use custom shutter sounds'
*** First throw call stack:
(0x19d6e8300 0x195cd4f30 0x1b9bfdcb4 0x1cc4fbf98 0x1cc432964 0x19d6e8920 0x19d70552c 0x1cc4328f8 0x1cc4a8fac 0x19d6e8920 0x19d70552c 0x1cc4a8e44 0x23634923c 0x23637abfc 0x2362d21a4 0x2362d139c 0x236339874 0x23636dc04 0x1a67f9b74 0x1a68023ac 0x1a67fa964 0x1a67faa78 0x1a67fa5d0 0x1039c6b34 0x1039d80b4 0x1a6800188 0x1a67f94bc 0x1a67f9fd0 0x1a6800098 0x1a67f9504 0x23633777c 0x23637201c 0x2354d081c 0x2354c8658 0x1039c6b34 0x1039c9c20 0x1039e1078 0x1039dfacc 0x1039d6ebc 0x1039d6ba0 0x19d774e94 0x19d758594 0x19d75cda0 0x1df4c0224 0x19fbcd154 0x19fbccdb8 0x1a142f1a8 0x1a139df2c 0x1a1387c1c 0x102a5d944 0x102a5d9f4 0x1c030e4f8)
libc++abi: terminating due to uncaught exception of type NSException
I have no idea why this is happening, so any help would be appreciated. My iPad is running the latest iPadOS 17 Beta and the crash also occurs when I don't have it isn't connected to Xcode...
Hello everyone, with the release of Apple's new Final Cut Camera App, we see the possibility to overlay a Focus Peaking indicator over the camera feed, showing focussed areas.
We have already had a contrast based autofocus system for some time via the AVCaptureDevice.Format.AutoFocusSystem.contrastDetection, but I haven't found a way to actually present contrast areas to the user.
Given that Apple now natively has such an algorithm for the Final Cut Camera App, I wonder if we devs now also get access to this. If not, does anybody know of implementations of focus peaking out there?
Thanks and with best regards