[Chargeable] RSTessOCR - Optical Character Recognition Offline

XverhelstX

Well-Known Member
Licensed User
Longtime User
RSTessOCR - Optical Character Recognition

xoZ3ujb.png

Information:
RSTessOCR is a port/wrapper for the tesseract-ocr library found here: https://code.google.com/p/tesseract-ocr/.

Tesseract is probably the most accurate open source OCR engine available. Combined with the Leptonica Image Processing Library it can read a wide variety of image formats and convert them to text in over 60 languages. It was one of the top 3 engines in the 1995 UNLV Accuracy test. Between 1995 and 2006 it had little work done on it, but since then it has been improved extensively by Google. It is released under the Apache License 2.0.
Requirements:
-
Basic4Android Full Version
- Android 2.2+
- RSTessOcr

What will you receive:
- Project
- Library files
- Documentation
- Readme file

Payment:
Payment can be made with Paypal at the following address:
[email protected]
The price of the library is 15 Euros.
After transaction has been made, i'll send the library files to the buyer within 24 hours.


Documentation:

RSTessOcr
Author:
XverhelstX
Version: 1
  • RSTessOcr
    Fields:
    • OEM_CUBE_ONLY As Int
      Run Cube only - better accuracy, but slower
    • OEM_DEFAULT As Int
      Default OCR engine mode.
    • OEM_TESSERACT_CUBE_COMBINED As Int
      Run both and combine results - best accuracy
    • OEM_TESSERACT_ONLY As Int
      Run Tesseract only - fastest
    • VAR_CHAR_BLACKLIST As String
      Blacklist of characters to not recognize.
    • VAR_CHAR_WHITELIST As String
      Whitelist of characters to recognize.
    Methods:
    • Clear
      Frees up recognition results and any stored image data, without actually
      freeing any recognition data that would be time-consuming to reload.
      Afterwards, you must call SetImage or SetRectangle before doing any
      Recognize or Get* operation.
    • Initialize (EventName As String, Datapath As String, Language As String)
      Initializes the Tesseract engine with a specified language model.

      Instances are now mostly thread-safe and totally independent, but some
      global parameters remain. Basically it is safe to use multiple
      TessBaseAPIs in different threads in parallel, UNLESS you use SetVariable
      on some of the Params in classify and textord. If you do, then the effect
      will be to change it for all your instances.
      EventName:
      Datapath: The path to you Tesseract folder. THE FOLDER SHOULD CONTAIN A SUBFOLDER NAMED "tessdata".
      Language: The language that should be used. usually "eng".

      Returns true on success.
    • Initialize2 (EventName As String, Datapath As String, Language As String, EngineMode As Int) As Boolean
      Initializes the Tesseract engine with a specified language model with the given engine constants..

      Instances are now mostly thread-safe and totally independent, but some
      global parameters remain. Basically it is safe to use multiple
      TessBaseAPIs in different threads in parallel, UNLESS you use SetVariable
      on some of the Params in classify and textord. If you do, then the effect
      will be to change it for all your instances.
      EventName:
      Datapath: The path to you Tesseract folder. THE FOLDER SHOULD CONTAIN A SUBFOLDER NAMED "tessdata".
      Language: The language that should be used. usually "eng".

      Returns true on success.
    • IsInitialized As Boolean
    • MeanConfidence As Int
      Returns the mean confidence of text recognition.
      Return type: @return:the mean confidence
    • Release
      Closes down tesseract and free up all memory. Release() is equivalent to
      destructing and reconstructing your TessBaseAPI.
      <p>
      Once Release() has been used, none of the other API functions may be used
      other than Init and anything declared above it in the class definition.
    • Scan
      Scans the image and raises _Scanned (Text as string)
    • WordConfidences As Int[]
      Returns all word confidences (between 0 and 100) in an array. The number
      of confidences should correspond to the number of space-delimited words
      in GetUTF8Text().
      Return type: @return:an array of word confidences (between 0 and 100) for each
      space-delimited word returned by GetUTF8Text()
    • setImage2 (imagedata() As Byte, width As Int, height As Int, bpp As Int, bpl As Int)
      Provides an image for Tesseract to recognize. Copies the image buffer.
      The source image may be destroyed immediately after SetImage is called.
      SetImage clears all recognition results, and sets the rectangle to the
      full image, so it may be followed immediately by a GetUTF8Text, and it
      will automatically perform recognition.
      imagedata: byte representation of the image
      width: image width
      height: image height
      bpp: bytes per pixel
      bpl: bytes per line
    • setRectangle (left As Int, top As Int, width As Int, height As Int)
      Restricts recognition to a sub-rectangle of the image. Call after
      SetImage. Each SetRectangle clears the recogntion results so multiple
      rectangles can be recognized with the same image.
      left: the left bound
      top: the right bound
      width: the width of the bounding box
      height: the height of the bounding box
    • setVariable (var As String, value As String) As Boolean
      Set the value of an internal "variable" (of either old or new types).
      Supply the name of the variable and the value as a string, just as you
      would in a config file.
      <p>
      Example: <code>setVariable(VAR_TESSEDIT_CHAR_BLACKLIST, "xyz"); to ignore x, y and z. * setVariable(VAR_BLN_NUMERICMODE, "1"); to set numeric-only mode. * </code>
      <p>
      setVariable() may be used before open(), but settings will revert to
      defaults on close().
      var: name of the variable
      value: value to set
      Return type: @return:false if the name lookup failed
    Properties:
    • Debug As Boolean [write only]
      Sets debug mode. This controls how much information is displayed in the
      log during recognition.
    • Image As Bitmap [write only]
      Provides an image for Tesseract to recognize. Does not copy the image
      buffer. The source image must persist until after Recognize or
      GetUTF8Chars is called.
    • InitLanguagesAsString As String [read only]
      Returns the languages string used in the last valid initialization.
      If the last initialization specified "deu+hin" then that will be
      returned. If hin loaded eng automatically as well, then that will
      not be included in this list. To find the languages actually
      loaded use GetLoadedLanguagesAsVector.
    • PageSegMode As Int [write only]
      Sets the page segmentation mode. This controls how much processing the
      OCR engine will perform before recognizing text.


Sample:
You can find an example apk file here:
https://www.dropbox.com/s/ab9c8xbn3ds79a1/RSTessOcr.apk
Note the size of the library is big because of the added language file in the Assets.
When deploying your app with this library, you should download the language file(s) from an external webservice to reduce the apk size (with 20 mb)

Regards,
Tomas
 

bluedude

Well-Known Member
Licensed User
Longtime User
Tried it but not sure if it works. I get a lot of weird characters in a document. Which language does the demo apk support?
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
Tried it but not sure if it works. I get a lot of weird characters in a document. Which language does the demo apk support?

Hi

The 'problem' is related in the Tesseract library itself being not able to recognize the text because the image might not be clear.
The language is in english.

The best thing to do is do some image preprocessing on the image:
http://stackoverflow.com/questions/9480013/image-processing-to-improve-tesseract-ocr-accuracy

- Binarize and de-noise the image
- Greyscale and sharpen the image
- Set whitelist and blacklist to remove unwanted charachters.
- Focus on the text before taking a picture.

You can also set the mode you wish to use:
(I got best result with OEM_CUBE_ONLY, but takes a lot longer)

  • OEM_CUBE_ONLY As Int
    Run Cube only - better accuracy, but slower
  • OEM_DEFAULT As Int
    Default OCR engine mode.
  • OEM_TESSERACT_CUBE_COMBINED As Int
    Run both and combine results - best accuracy
  • OEM_TESSERACT_ONLY As Int
    Run Tesseract only - fastest

I'll try to get an image enhancing solution

Regards,
Tomas
 

WebbyBoy

Member
Licensed User
Longtime User
Hi,

I get an error when using the demo. When trying to scan, I get an error advising the picture must be in ARGB_8888 format.
 

laviniut

Active Member
Licensed User
Longtime User
I tried a simple application with tesseract from here. It don't worked too well and i realized that it need a lot of time to get the result, so i prefer the online solution, i mean the result is get from a remote server based on tesseract which work faster.
 

laviniut

Active Member
Licensed User
Longtime User
Last edited:

TheMightySwe

Active Member
Licensed User
Longtime User
Do anyone know if there is a simpler library for OCR that only needs to read a line or a word of text?

Like on a licence plate or similar?
 

dibb3386

Member
Licensed User
Longtime User
Is this lib dead? If not does it come with support? Not tried the demo apk yet, phone just died, but questions still remain. I need an offline solution for image to text. Ive seen a few people having problems with it mainly lighting for the image taken, what about plain printed text nothing special? or is this the same issue everyone is having with lighting problems?
 

WebbyBoy

Member
Licensed User
Longtime User
My problem was converting the image to ARGB 8888, but I've not tried this lib in a while. Android phoyo dev has come along quite a bit.
 

dibb3386

Member
Licensed User
Longtime User
Cheers for your reply WebbyBoy. Ive not heard back from dev so project is on hold till i find another solution. Will check out phoyo. Thanks
 

jesuslizonsoluciones

Member
Licensed User
Longtime User
Good morning,
I’ve been trying to purchase the following but I get a message from Paypal that you can’t receive payments at this moment. Is there any other way to purchase the product?
 

llorenç Galofré

Member
Licensed User
Longtime User
Good morning:
I'm trying to adapt an OFFLINE OCR application and I'm interested in this RSTESSOCR, but I sent an email to the direcciñon on the first post, without any response. How do I do to get this library and example?, thank you.
 
Top