Hi there,
I am using jshell to run tesseract to ocr images.
I use many wait for resumable subs like this:
Now I want to run multiple tesseract instances at the same time. How can I do this?
I changed OCRAllBoxes to this, but it cannot wait for the tesseract to give the result.
I am using jshell to run tesseract to ocr images.
I use many wait for resumable subs like this:
B4X:
Sub OCRAllBoxes
For Each box in boxes
wait for (OCROne) Complete (result as string)
Next
End Sub
Sub OCROne as ResumableSub
wait for (tesseract) Complete (result as string)
return result
End Sub
Sub tesseract as ResumableSub
wait for sh_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
return result
End Sub
Now I want to run multiple tesseract instances at the same time. How can I do this?
I changed OCRAllBoxes to this, but it cannot wait for the tesseract to give the result.
B4X:
Sub OCRAllBoxesConcurrent(img As B4XBitmap,boxesList As List) As ResumableSub
Dim count As Map
count.Initialize
count.Put("completed",0)
For Each box As Map In boxesList
OCROne(img,box,count)
Next
Do While count.Get("completed")<>boxesList.Size
Log(count.Get("completed"))
Sleep(1000)
Loop
Return ""
End Sub