GoogleVision
将 Google Vision 功能集成到应用中,包括图像标签、人脸、标志和地标的检测、光学字符识别(OCR)以及显式内容的检测。
一个 Swift 框架,用于通过谷歌的 Cloud Vision API。
安装
CocoaPods
pod 'GoogleVision'
手动
Copy GoogleVision.swift to your project.
初始化
首先,您需要在 控制台 中生成 API 密钥来使用谷歌云服务。然后使用以下代码
GoogleVision.init(apiKey: "")
使用
let gv = GoogleVision.init(apiKey: "")
let img = UIImage(named: "Image")
gv.run(image:img) { (text, err) in
guard let text = text, err == nil else {
print(err?.localizedDescription)
return
}
print(text)
}
许可协议
GoogleVision 采用MIT许可。详见LICENSE文件以获取更多信息。