Last active
June 29, 2021 12:54
-
-
Save iosdevie/a613c2d42468d7974559f0b67ab13e18 to your computer and use it in GitHub Desktop.
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
func runVisionRequest(){ | |
let request = VNGeneratePersonSegmentationRequest() | |
request.qualityLevel = .accurate | |
request.outputPixelFormat = kCVPixelFormatType_OneComponent8 | |
let handler = VNImageRequestHandler(cgImage: inputImage.cgImage!, options: [:]) | |
do { | |
try handler.perform([request]) | |
let mask = request.results!.first! | |
let maskBuffer = mask.pixelBuffer | |
maskInputImage(maskBuffer) | |
}catch { | |
print(error) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment