Skip to content

Instantly share code, notes, and snippets.

@onmyway133
Created June 15, 2018 16:05
Show Gist options
  • Save onmyway133/6faf7b625d4a4b5ff11773473d1fcaec to your computer and use it in GitHub Desktop.
Save onmyway133/6faf7b625d4a4b5ff11773473d1fcaec to your computer and use it in GitHub Desktop.
let handler = VNImageRequestHandler(
cgImage: cgImage,
orientation: inferOrientation(image: image),
options: [VNImageOption: Any]()
)
let request = VNDetectTextRectanglesRequest(completionHandler: { [weak self] request, error in
DispatchQueue.main.async {
self?.handle(image: image, request: request, error: error)
}
})
request.reportCharacterBoxes = true
do {
try handler.perform([request])
} catch {
print(error as Any)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment