相关疑难解决方法(0)

Firebase MLKit文本识别错误

我正在尝试使用Firebase MLKit OCR我的图像,但它失败并返回错误

文本检测失败并显示错误:无法运行文本检测器,因为self为零.

/// Detects texts on the specified image and draws a frame for them.
func detectTexts() {
    let image = #imageLiteral(resourceName: "testocr")
    // Create a text detector.
    let textDetector = vision.textDetector()  // Check console for errors.

    // Initialize a VisionImage with a UIImage.
    let visionImage = VisionImage(image: image)
    textDetector.detect(in: visionImage) { (features, error) in
        guard error == nil, let features = features, !features.isEmpty else {
            let errorString = error?.localizedDescription ?? "No results returned."
            print("Text detection failed with …
Run Code Online (Sandbox Code Playgroud)

ios firebase swift firebase-mlkit

4
推荐指数
1
解决办法
2310
查看次数

标签 统计

firebase ×1

firebase-mlkit ×1

ios ×1

swift ×1