Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pet Segmentation iOS View Controller with Fritz (www.fritz.ai)
extension ViewController: AVCaptureVideoDataOutputSampleBufferDelegate {
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
let image = FritzVisionImage(buffer: sampleBuffer)
image.metadata = FritzVisionImageMetadata()
image.metadata?.orientation = FritzImageOrientation(from: connection)
guard let result = try? visionModel.predict(image) else { return }
let mask = result.buildSingleClassMask(
forClass: FritzVisionPetSegmentationClass.pet,
resize: false,
color: UIColor.red)
}
}
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.