Created
May 15, 2019 04:20
-
-
Save jamesonthecrow/eccb7f45cf8fbe9155f70e7ad4cbb153 to your computer and use it in GitHub Desktop.
Pet Segmentation iOS View Controller with Fritz (www.fritz.ai)
This file contains 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