I'm using com.google.android.gms
lay-services-vision for extract texts from camera preview. I can get value (text) of block but i can't value(text) of each line in the block.
I found bellow java code but i don't know how to use
Any help ?
B4X:
for (Text line : tBlock.getComponents()) {
I found bellow java code but i don't know how to use
Any help ?
Java:
for (int index = 0; index < textBlocks.size(); index++) {
//extract scanned text blocks here
TextBlock tBlock = textBlocks.valueAt(index);
blocks = blocks + tBlock.getValue() + "\n" + "\n";
for (Text line : tBlock.getComponents()) {
//extract scanned text lines here
lines = lines + line.getValue() + "\n";
for (Text element : line.getComponents()) {
//extract scanned text words here
words = words + element.getValue() + ", ";
}
}
}
My code:
Dim frametext As JavaObject = frameBuildertext.RunMethod("build", Null)
Dim SparseArrayText As JavaObject = textdetector.RunMethod("detect", Array(frametext))
LastPreview = DateTime.Now
Dim MatchesText As Int = SparseArrayText.RunMethod("size", Null)
For i = 0 To MatchesText - 1
Dim TextBlock As JavaObject = SparseArrayText.RunMethod("valueAt", Array(i))
Dim Lines As JavaObject = TextBlock.RunMethod("getComponents", Null)
Dim MatchesLine As Int = Lines.RunMethod("size", Null)
For z = 0 To MatchesLine - 1
Log ("line " & z)
Dim line As JavaObject = Lines.RunMethod("valueAt", Array(z)) ' doesn't work
Next