Hey all! I am trying to get eggplant to recognize some blue-ish text on the screen and read it. I am having no luck using OCR.
This is the code I am using to try to find the text:
Click (Text:"firstname.lastname@example.org", ContrastColor:(0,0,0), ContrastTolerance:"20", WaitFor:8, Contrast:"On")
Any ideas what I can do with OCR to get it to find the text correctly?
Sorry this never got a response before now. The problem is not one of contrast. The problem is that the dot in the text is just too small to be considered by the OCR. It appears to be a single pixel. If you do a readText on the field, the value returned is “derp@email org” with a space instead of a dot. Plugging that into a text search, the text can be found with
moveTo(text:"derp@email org", searchRectangle:(1070,789,1260,844))
There’s no way to tell the OCR that it shouldn’t ignore that single pixel. It’s probably being treated as noise. There are heuristics used to determine what is and isn’t text, and my guess would be that a single pixel doesn’t match with the stroke or other characteristics of the font. My guess would be that if it were 2 pixels, it would get read. It actually seems too small to me as a user; I was reading it with a dot because I expected one to be there, but when I really looked at it, I could barely make it out.
That is what I had figured out as well, there was a space instead of a “.”.
I got around this by doing some quick manipulation of the email address, first stripping off the last three letters, then adding them again with a “.”
But Thank you for the response.