How to call ProcessPageAsync() during GetNextProcessedPage() blocking?

  • 37 Views
  • Last Post 19 March 2019
Sean posted this 18 March 2019

Hi all, 
I have some questions about how to use the FineReader Engine 12's batch processor in our case. Please help if anyone has done this before. I would really appreciate if you could help me with it.

We're designing a server product which utilizes the batch processor and run in a multi-core environment. And here are our needs:
1. Our product will be always running. Repeat waiting for images and then doing the OCR process.
2. We cannot expect when the next images will come.
3. It's possible that a big amount of images come in a short period.
So, the better way to us is inputting the new images into batch processor no sooner than they have arrived.

But GetNextProcessedPage() will be waiting until the next recognized image is available. During GetNextProcessedPage() waiting for the next recognized image, we cannot call ProcessPageAsync() to input next images into batch processor in FineReader Engine.

So, the question is how can we input a image during GetNextProcessedPage() waiting for the next recognized image?

 

I hope someone can advise us what kind of architecture would correspond to our needs.

Best regards, 

Order By: Standard | Newest | Votes
Denis Gusak posted this 18 March 2019

Hi Sean!

Endeed, ProcessPageAsync() can be used only at the beginning or at the end of processing queue. However, since methods of ImageSource are implemented by the user, you can manage the input of documents in BatchProcessor by yourself. Also, if you need to speed up your work, you can load several batchProcessors into several threads.

Hope it helps.

Sean posted this 19 March 2019

Hi Sean!

Endeed, ProcessPageAsync() can be used only at the beginning or at the end of processing queue. However, since methods of ImageSource are implemented by the user, you can manage the input of documents in BatchProcessor by yourself. Also, if you need to speed up your work, you can load several batchProcessors into several threads.

Hope it helps.

Thank you for reply, Denis!

I've tried to edit the ImageSourceImpl in the sample code which supplied by ABBYY. Even though I edited list of paths of images or its iterator. The former didn't affect the image source inside batch processor; the latter caused "Argument check failed. Expected: !path.IsEmpty()" and seemed like if iterator had reached the end once, it cannot be used anymore. So the only way successfully inputed image into batch processor after Start() we'd tried was using ProcessPageAsync().

We're expecting to maximize the efficiency of batch processor. For example, if the batch processor is processing only 2 page now, and suppose it can process 4 page as the same time, there also came 2 new images, although the batch processor is waiting for next recognized page, we still want to input that 2 new image into batch processor to make it has maximum efficiency. That's why we want to know how to call ProcessPageAsync() during GetNextProcessedPage() waiting for the next recognized image.

 

 

Close