Sep 10, 2017 Replies: 2 [Copied from "Google Play Vision Services or Android Vision API wrapper" in "Bugs and wishlist" forum] Hi again, I found a solution by writing a wrapper library for my modified code written in Android Studio; thanks to tutorials and example code in this forum. This wrapper only performs text recognizing/scanning on an existing image file. It does not display anything. BSTextOCRMin 1.0 Methods Initialize(prmEventName As String) Run(prmFileName As String) prmFileName should contains full file name, example value: Code: Copy fname = File.Combine(File.Combine(File.DirRootExternal, "Pictures"), "tmpscan.jpg") Events onSuccess(prmBlocks As String, prmLines As String, prmWords As String) They are the results in comma separated. Note: They may contain empty values. onError(prmErrMsg As String) onDone Dependencies Code: Copy constraint-layout-1.0.1.aar com.android.support:support-v4 com.android.support:appcompat-v7 com.android.support:design com.google.android.gms:play-services-vision Permisions android.permission.READ_EXTERNAL_STORAGE Installation Extract "BSTextOCRMin.jar" and "BSTextOCRMin.xml" to B4A Additional Libraries folder. Extract "add-res" onto project's folder. Additional code Code: Copy #AdditionalRes: ..\add-res #Extends: android.support.v7.app.AppCompatActivity Put it below "#Region Activity Attributes". "add-res" is a folder containing a few files required and the name might be changed to whatever you'd like. This folder should be placed in the same folder with "Files" and "Objects". Recommended implementation Call camera intent to get a picture file. Enhance the picture (resize, sharpen, contrast, greyscale, or other) to expect better scan accuracy. Scan the picture with this library and get result. Optionally, delete the picture file after done. I share this for B4A community to be used freely. Comments are welcomed. Thank you. Cheers, Attachments BSTextOCRMin.zip BSTextOCRMin.zip 50.2 KB · Views: 704 Click to expand...
[Copied from "Google Play Vision Services or Android Vision API wrapper" in "Bugs and wishlist" forum] Hi again, I found a solution by writing a wrapper library for my modified code written in Android Studio; thanks to tutorials and example code in this forum. This wrapper only performs text recognizing/scanning on an existing image file. It does not display anything. BSTextOCRMin 1.0 Methods Initialize(prmEventName As String) Run(prmFileName As String) prmFileName should contains full file name, example value: Code: Copy fname = File.Combine(File.Combine(File.DirRootExternal, "Pictures"), "tmpscan.jpg") Events onSuccess(prmBlocks As String, prmLines As String, prmWords As String) They are the results in comma separated. Note: They may contain empty values. onError(prmErrMsg As String) onDone Dependencies Code: Copy constraint-layout-1.0.1.aar com.android.support:support-v4 com.android.support:appcompat-v7 com.android.support:design com.google.android.gms:play-services-vision Permisions android.permission.READ_EXTERNAL_STORAGE Installation Extract "BSTextOCRMin.jar" and "BSTextOCRMin.xml" to B4A Additional Libraries folder. Extract "add-res" onto project's folder. Additional code Code: Copy #AdditionalRes: ..\add-res #Extends: android.support.v7.app.AppCompatActivity Put it below "#Region Activity Attributes". "add-res" is a folder containing a few files required and the name might be changed to whatever you'd like. This folder should be placed in the same folder with "Files" and "Objects". Recommended implementation Call camera intent to get a picture file. Enhance the picture (resize, sharpen, contrast, greyscale, or other) to expect better scan accuracy. Scan the picture with this library and get result. Optionally, delete the picture file after done. I share this for B4A community to be used freely. Comments are welcomed. Thank you. Cheers,
roberto64 Active Member Licensed User Longtime User Sep 18, 2017 #2 hi Xenno, can you have an example already done? regards
ruut New Member Licensed User Longtime User Oct 18, 2017 #3 Hi Xenno, It would be great if you could extend your code examples a bit. You wrote: Xenno said: Methods Initialize(prmEventName As String) Run(prmFileName As String) prmFileName should contains full file name, example value: Code: Copy fname = File.Combine(File.Combine(File.DirRootExternal, "Pictures"), "tmpscan.jpg") Click to expand... I am wondering how to feed the fname string into the BSTextOCRMin 1.0 object? What to use for prmEventName during the initialization phase.
Hi Xenno, It would be great if you could extend your code examples a bit. You wrote: Xenno said: Methods Initialize(prmEventName As String) Run(prmFileName As String) prmFileName should contains full file name, example value: Code: Copy fname = File.Combine(File.Combine(File.DirRootExternal, "Pictures"), "tmpscan.jpg") Click to expand... I am wondering how to feed the fname string into the BSTextOCRMin 1.0 object? What to use for prmEventName during the initialization phase.