【发布时间】:2019-01-22 09:07:37
【问题描述】:
我已将textlinedetector 初始化如下
self.textDetector = [GMVDetector detectorOfType:GMVDetectorTypeText options:nil];
由于我只想要一行而不是整个块,我直接访问GMVTextLineFeature,并且输入图像的类型是直接从相机预览中获得的UIImage。
NSArray<GMVTextLineFeature *> *features = [self.textDetector featuresInImage:[_Result originalImage] options:nil];
但是上面的数组是零。
[myOperation setCompletionBlock:^{
for (GMVTextLineFeature *textLine in features) {
NSLog(@"value of each element: %@", textLine.value);
_Result.text = textLine.value;
}
[self finishDetection];
}];
[_operationQueue addOperation:myOperation];
我担心我的项目是在 gradle 中,而 GoogleVision 是在 cocoapods 中构建的。所以我手动将框架文件复制到我的项目中,并将其链接到frameworks and libraries。我还链接了框架的资源文件,其中包含copy resource bundles 下的所有转换配置文件。
然而feature 对象是nil。我还多次清理构建了该项目。由于我是 iOS 新手,我无法弄清楚它是 cocoapods 的问题还是它的实现方式。但这就是它在演示应用程序TextDetectorDemo 中的实现方式。我正在使用 xcode 9.4。
任何见解或任何解决方法将不胜感激。
提前致谢。
【问题讨论】:
标签: ios gradle cocoapods google-vision google-ios-vision