This is a sample project that shows OCR result from screenshot using Tesseract engine on Unity Android platform.
- Unity 2020.3.23f1
- Tesseract 4.1.0
- macOS Big Sur/Monterey
- Unity
- Click "On" button to turn on device camera.
- Click "Capture" button to capture image from camera. Tesseract recognizes text from image and shows output(OCR result) on the screen.
- Click "Off" button to turn off device camera.
-
Recognize from a Texture
Recoginze(texture);
-
Save the screenshot to Gallery
NativeGallery.Permission permission = NativeGallery.SaveImageToGallery(texture, "CameraTest", "CaptureImage.png", (success, path) => Debug.Log("Media save result: " + success + " " + path));
If you want to save screenshot to gallery, you have to build project. (Unity-Remote-5 doesn't work.)
You only need to refer to ./Assets/Scripts/TesseractDemoScript.cs.
This project is a modified version of tesseract-unity. I hope this sample project will help you with your project.