Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example snippet of how to run a CoreML ImageRequest on an ARKit scene's current frame
func runCoreML() {
// Get Camera Image as RGB
guard let sceneView = self.sceneView else { return }
guard let currentFrame = sceneView.session.currentFrame else { return }
let pixbuff : CVPixelBuffer = currentFrame.capturedImage
let ciImage = CIImage(cvPixelBuffer: pixbuff)
// Prepare CoreML/Vision Request
let imageRequestHandler = VNImageRequestHandler(ciImage: ciImage, options: [:])
// Run Image Request
do {
try imageRequestHandler.perform(self.visionRequests)
} catch {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.