Closed Prince-01 closed 7 years ago
This is my code I wrote while ago and attached it into code downloaded from repository on github. It goes smoothly until tsk.Wait():. `TesseractApi tapi; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
tapi = new TesseractApi(this, AssetsDeployment.OncePerInitialization);
tapi.Init("eng");
var btn = FindViewById<Button>(Resource.Id.button1);
btn.Click += Btn_Click;
}
private void Btn_Click(object sender, System.EventArgs e)
{
if (!tapi.Initialized)
return;
var bmp = BitmapFactory.DecodeResource(Resources,
Resource.Drawable.Icon);
var tsk = tapi.Recognise(bmp);
tsk.Wait();
}`
I am using newest version of xamarin, android 6(tried both on real device and emulator) and visual studio(tried both on 2013 and 2017).
I replaced Wait method with ContinueWith - and it seems to fix the problem. Sorry to bother you :)
Hello, I am writing an app for android, in which I want to make simple character recognition. Xamarin.Tesseract nuget gets initialized, and then when _api.SetImage(...).Wait(); invoked, my app gets stuck and can't go farther. I tried to invoke that function with different parameters, Firstly copied bitmap content to a stream on some ways and then pass it(both as a stream and byte array). I tried also a version of this function where path is required(provided also good path, and bad path) - both resulted with endless wait. Could you help me? Thanks.