Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created May 26, 2021 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/e348b48f741c6968b58d7c14b0ff8426 to your computer and use it in GitHub Desktop.
Save anupamchugh/e348b48f741c6968b58d7c14b0ff8426 to your computer and use it in GitHub Desktop.
func createVisionRequest(image: UIImage){
currentImage = image
guard let cgImage = image.cgImage else {
return
}
let requestHandler = VNImageRequestHandler(cgImage: cgImage, orientation: image.cgImageOrientation, options: [:])
let vnRequests = [vnTextDetectionRequest]
DispatchQueue.global(qos: .background).async {
do{
try requestHandler.perform(vnRequests)
}catch let error as NSError {
print("Error in performing Image request: \(error)")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment