Tuesday, 25 September 2018

Firebase MLKit text recognition fail with the front camera iOS

I have integrated the Firebase MLKit SDK as per the document, texts are detected correctly with the back camera photo. When I am using a captured photo from the front camera, texts are detecting wrongly and bad results are coming out.

 @IBAction func findTextDidTouch(_ sender: UIButton) {
    runTextRecognition(with:imageView.image!)
  }

func runCloudTextRecognition(with image: UIImage) {
    let visionImage = VisionImage(image: image)
    cloudTextDetector.detect(in: visionImage) { features, error in
      if let error = error {
        print("Received error: \(error)")
        return
      }
      self.processCloudResult(from: features, error: error)
    }
  }


  for text in features {
      if let block = text as? VisionTextBlock {
        print(block.text)
      }
    }

I am not able to figure out. Do I need change with the camera or firebase ml kit?



from Firebase MLKit text recognition fail with the front camera iOS

No comments:

Post a Comment