Last active
February 1, 2019 12:46
-
-
Save kravik/f4b77481db1c91d732f1da03b30f6d41 to your computer and use it in GitHub Desktop.
iOS 11 Vision. Text detection
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
let image = UIImage(named: "text.png")! | |
let vnImage = VNImageRequestHandler(cgImage: image.cgImage!, options: [:]) | |
let textRectsRequest = VNDetectTextRectanglesRequest { (request, error) in | |
if let results = request.results as? [VNTextObservation] { | |
for result in results { | |
print("boundingBox \(result.boundingBox)") | |
print("characterBoxes \(result.characterBoxes)") | |
} | |
} | |
} | |
textRectsRequest.reportCharacterBoxes = true | |
try vnImage.perform([textRectsRequest]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment