I have a VNDetectTrajectoriesRequest
and the request handler inside the captureoutput for the camera like so.
When I run the app I see the completion handler get called 5 times with empty observations and then nothing . Even if a ball is rolled through the video being captured the completion handler never shows an observation.
Any thoughts on what might be going on?
Code Block private lazy var pathRequest: VNDetectTrajectoriesRequest = { return VNDetectTrajectoriesRequest(frameAnalysisSpacing: .zero, trajectoryLength: 5, completionHandler: trajectoryHandler)}()
and the request handler inside the captureoutput for the camera like so.
Code Block let pathHandler = VNImageRequestHandler(cmSampleBuffer: sampleBuffer, options: [:]) do { try requestHandler.perform([pathRequest]) } catch { print("Unable to perform the request: \(error).") }
When I run the app I see the completion handler get called 5 times with empty observations and then nothing . Even if a ball is rolled through the video being captured the completion handler never shows an observation.
Code Block func trajectoryHandler(request: VNRequest, error: Error?) { print("have trajectory observation") guard let observations = request.results as? [VNTrajectoryObservation] else { return } print(observations) }
Any thoughts on what might be going on?