khjde1207 / tesseract_ocr

Tesseract OCR for flutter
BSD 3-Clause "New" or "Revised" License
62 stars 31 forks source link

Live OCR Added #8

Closed sikandernoori closed 2 years ago

sikandernoori commented 2 years ago

Hello @khjde1207,

I have Added Option of Live OCR, Please check and Merge.

sikandernoori commented 2 years ago

For Now Live OCR is only Available on IOS, I was hoping if you could add Live OCR for Android.

khjde1207 commented 2 years ago

thank you.

khjde1207 commented 2 years ago

https://gist.github.com/Alby-o/fe87e35bc21d534c8220aed7df028e03

imglib.Image? _convertJpeg(CameraImage image) {
   return imglib.Image.fromBytes(
       image.width, image.height, image.planes[0].bytes,
       format: imglib.Format.rgb, channels: imglib.Channels.rgb);
}

Is there any reason not to use this? The logic is difficult, so I don't have the confidence to maintain it...

sikandernoori commented 2 years ago

I agree with you !

Right now I am working on converting image from Bytes at Dart end Just like you showed above. Once Image is generated then I will send the Image to Android / IOS to get OCR result.

Worried about the performance though. I'll share the updated Code in few hours.

Also any suggestions on how to maintain the session and avoid reinitializing tesseract Instance again and again for each frame / image ?

khjde1207 commented 2 years ago

https://github.com/khjde1207/tesseract_ocr/blob/db4c3d381bd226ce93977700a8e04c1a02e6b004/android/src/main/java/io/paratoner/flutter_tesseract_ocr/FlutterTesseractOcrPlugin.java#L45-L49

https://github.com/khjde1207/tesseract_ocr/issues/4