我已经初始化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 的问题是 gradle 还是它的实现方式。但这就是它在演示应用程序TextDetectorDemo中的实现方式。我正在使用 xcode 9.4。
任何见解或任何解决方法将不胜感激。
提前致谢。