Created
May 15, 2019 04:20
Pet Segmentation iOS View Controller with Fritz (www.fritz.ai)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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