halkar / Tesseract.Xamarin

Tesseract OCR wrapper for Xamarin
MIT License
122 stars 40 forks source link

SetRectangle clearing all results and not returning any #19

Closed ThaRaven403 closed 9 years ago

ThaRaven403 commented 9 years ago

Hi,

I'm currently using the lastest version of Tesseract.Xamarin in a Xamarin Forms project, only targeting the Android platform at the moment.

When I call the SetRectangle method, after successfully calling the SetImage method (checked with a boolean value after calling the method with await), the Text property keeps the original text it had after setting the image, and the Results property returns an empty collection no matter the page iterator level I pass to it.

Thanks in advance for checking this out!

ThaRaven403 commented 9 years ago

Hi,

Yes, I tried to call SetRectangle before the SetImage call, the end result is the same as if I wouldn't have called the method (same behavior as when you don't call SetRectangle).

Then I found this page, which gave an example and stated that it should be called after: https://code.google.com/p/tesseract-ocr/wiki/APIExample (it's in the last part of the first section).

Thanks for the quick feedback!

halkar commented 9 years ago

Hi,

I found an issue and now it is fixed. You can download new version of the nuget package.

But still you should first call SetRectangle and then SetImage. This is a difference between the native implementation and this one. You can find test here https://github.com/halkar/Tesseract.Xamarin/blob/master/UnitTest/Tesseract.Droid.Test/TesseractApiRecogniseTest.cs in the Sample1JpgRectangle method.

Cheers, Artur.

ThaRaven403 commented 9 years ago

Thanks a lot for the super fast correction!

If I have to call the method before SetImage, do I have to call SetImage every time I set a rectangle (for example if I want to check for three specific regions in the image) ?

Also, I haven't found exactly what the unit of measure is for the rectangle, can you confirm it is pixels ?

Thanks again!

halkar commented 9 years ago
  1. Yes, you should call SetRectangle/SetImage every time when you change the region.
  2. Yes, it's measured in pixels.
jonathanzuniga commented 8 years ago

Hi, is it possible to set visible the rectangle? how? Thanks in advance.

halkar commented 8 years ago

@jonathanzuniga sorry, didn't get your question. What do you mean?

jonathanzuniga commented 8 years ago

I would like to know how I can make the rectangle visible when i will take the photo.

halkar commented 8 years ago

@jonathanzuniga Tesseract.Xamarin is only responsible for text recognition. Taking photo and UI is on you.

jonathanzuniga commented 8 years ago

@halkar Oh ok thank you.

callyaser commented 7 years ago

@halkar So The rectangle won't be visible on the camera or the image? I called the SetRectangle method but still I don't see any rectangle overlay on the image. So how do I restrict the focus of the camera to the region within the rectangle. Please assist

halkar commented 7 years ago

@callyaser SetRectangle is used to define the rectangle in which text will be recognized and not for visualization. This library doesn't work with camera, it only works with images.

callyaser commented 7 years ago

Oh. Got it. Thanks for the response.