Search Unity

Unity wrapper - Google Tesseract OCR

Discussion in 'AR/VR (XR) Discussion' started by DScJ0, Nov 18, 2017.

  1. DScJ0

    DScJ0

    Joined:
    Nov 18, 2017
    Posts:
    1
    Hi all,

    I've come across quite a number of users here unable to find a quality OCR plug-in for Unity projects.
    At DesignSpark (part of engineering distributor - RS Components), an Augmented Reality app (iOS & Android) to discover RS product 3D models was released as a 'closed beta' for testing between September 2017 and September 2018: https://www.rs-online.com/designspark/test-drive-the-designspark-ar-app-iosandroid
    This app required the user to point their device's rear camera at a manufacturer part number, which then ran an OCR scan to find the product from the RS catalog and deliver a 3D model along with purchase information.
    A key outcome of the app development was a 'first of its kind' wrapper for Google's Tesseract OCR engine for use in Unity C# projects. The wrapper will enable powerful character recognition in apps built for any mobile platform.

    The Unity package for this wrapper is downloadable by DesignSpark members here: https://www.rs-online.com/designspark/designspark-ar-app-ocr-module-for-unity

    You can seek technical help from the developer of this wrapper: Sam at https://forum.unity.com/members/agentmilkshake1.599188/ or sam@relative-dimensions.com

    Cheers!
    DJ
     
    Last edited: Nov 6, 2020
    charmseer likes this.
  2. ZHUyyyyyyyy

    ZHUyyyyyyyy

    Joined:
    Dec 28, 2015
    Posts:
    4
    I downloaded it but there is no demo,Could you give me some help ~?
     
  3. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    Here is a package to demo the plugin on Android.

    1. Set Android as your build target
    2. Import the package linked in the first post
    3. Import the package attached to this post
    4. Build and run the Demo scene to your Android device (it does not work in the Unity editor)

    The "TestImage.jpg" is passed into Tesseract and should have it's text printed on the screen. Sorry, I don't have this working for iOS yet (not sure if my project will get far enough for me to care) but the demo should at least get you started.
     

    Attached Files:

    DirkDenzer, VIRNECT_unity and ChiuGa like this.
  4. ChiuGa

    ChiuGa

    Joined:
    Aug 24, 2017
    Posts:
    6
    Thanks for your sharing.
    But some errors occurred.
     

    Attached Files:

  5. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    Sounds like you need to do step 2 in my post above. Did you import the package that the original poster linked to?
     
  6. SubZtep

    SubZtep

    Joined:
    May 12, 2013
    Posts:
    3
    Hi, I made it work, it's great, thanks for sharing!

    Go to File > Build Settings..., switch to Android. There is a preprocessor that limits it to Android and iOS.

    Also, you need to build it and run it on an actual mobile device, it's not working on a desktop. So it's not working with Unity Remote, you really need to copy the apk and install, or setup Unity to deploy on mobile.
     
  7. Nadzntt

    Nadzntt

    Joined:
    Mar 16, 2018
    Posts:
    1
    Thank you for the example
    If I were to add my own list of words, where would I add them? I need to add error codes that should be read from an image

    Thank you
     
  8. cconsidi

    cconsidi

    Joined:
    Dec 7, 2017
    Posts:
    2
    Hi there, I am unable to build your demo scene to an iOS device due to a number of linker issues related to the TesseractOCR library. Do you have any idea how I might resolve these?
     
    MentalFish likes this.
  9. MentalFish

    MentalFish

    Joined:
    Nov 2, 2005
    Posts:
    282
    Same for me on iOS, still digging around but no luck.

    Edit: Just add libz.tbd under "Linked Frameworks and Libraries" in xcode and it should work.
     
    Last edited: May 18, 2018
  10. usernametaken2

    usernametaken2

    Joined:
    Aug 17, 2014
    Posts:
    2
    Changes to the config file "StreamingAssets\tessdata/tessconfigs/recognitionConfigs.txt" does not seem to work. im trying to whitelist and black list certain characters and add a few patterns.
    Has anyone had luck trying to do this?
     
  11. usernametaken2

    usernametaken2

    Joined:
    Aug 17, 2014
    Posts:
    2
    I need to configure Tesseract to work with the pattern B102 so Character/Number/Number/Number/Number.
    My problem now is that tesseract expects the B to be an 8 because its nexto to a series of numbers.
    As I see it I have several parameters to tweak.
    • Whitelist and or Blacklisting characters: this would help produce more reliable results, although probably slow things down. I think i will set a whitelist and not blacklist anything. its easier to clean up the OCR result afterwards.
    • Patterns: ive tried defining patterns but the seem to have no effect. ( does anyone now how to debug teseract to see if its actually using the patterns.
    • The distance between the letters ( no idea where to change it). If i change this setting then i could get tesseract to detect individual letters and not try to make sense of it as a word.
    • turning off dictionary: tried this in the config file but seemed to have no effect.
    • retraining tesseract for my purpose.... i have no idea how and its likely not to work since changing the config file has no effect.
    So in order for me to move on I need help figuring out how to debug tesseract so that i can see if my settings indeed are loaded from the configfile.
     
  12. BShoyer

    BShoyer

    Joined:
    Sep 19, 2017
    Posts:
    3
    I am trying to get a demo built on an IOS device (My project would require both platforms to work). I have successfully built it to the iPhone and am given the error code (on screen) "Error: Unable to load DLL "libtess.so", the specific module could not be found" has anyone experienced a similar situation and know how I could resolve this?
    Thank You for any help
     
  13. unity_mQ_fTO4ZV4shtQ

    unity_mQ_fTO4ZV4shtQ

    Joined:
    Jan 27, 2019
    Posts:
    1
    What should I have to do if I want to take the input image from the camera in my app?
     
    safin5216 likes this.
  14. safin5216

    safin5216

    Joined:
    Nov 3, 2018
    Posts:
    1
    I am very new to unity. Can you give me any hint or idea about how can i make an ocr like the one design park team built for their android app(where user uses the camera to scan the word and then get processed by the ocr) using the TesseractWrapper.unitypackage?
     
    Last edited: Feb 5, 2019
  15. prashantagent47

    prashantagent47

    Joined:
    Jan 2, 2016
    Posts:
    5
    how can i add OCR for Hindi language in plugin given by design spark ??
     
  16. Doctortight

    Doctortight

    Joined:
    Sep 10, 2019
    Posts:
    1
    Hello,
    I could install and try the plugin on Android.
    However I'm experiencing issues with OCR. I'm trying to scan business cards with my device camera and I have a lot of errors in recognition : bad characters, false positives, bad whitespaces and I'm sure it's not beacause of the photo.

    Has anyone faced this issue and could config, somehow, the algorithm to make it work better ? Since there is no documentation, I don't which files to edit.
     
  17. RaVen011

    RaVen011

    Joined:
    Oct 31, 2017
    Posts:
    3
    How to add another language ??
     
  18. Neelarghya

    Neelarghya

    Joined:
    Feb 25, 2019
    Posts:
    1
    shalu_mhmd and mgear like this.
  19. Janne-L

    Janne-L

    Joined:
    Mar 18, 2018
    Posts:
    12
    There is nothing to download on the page, has the download link been removed?
     
  20. shalu_mhmd

    shalu_mhmd

    Joined:
    Jun 11, 2019
    Posts:
    5
  21. aRCHmage333

    aRCHmage333

    Joined:
    Nov 27, 2016
    Posts:
    12
    I think these packages need a 2021 update.
    They're chock-full of errors and having separate packages strewn about forums isn't very practical?