robotframework-doctestlibrary icon indicating copy to clipboard operation
robotframework-doctestlibrary copied to clipboard

Using a mask when executing Get Text From Document

Open funtimesspray opened this issue 3 years ago • 2 comments

Hello, thank you for this library it's been really fun thinking of ways to leverage it. My question is would it be possible (and useful to others) to allow the use of a mask when getting text from a document?

My use case for this is say I want to get some caption text from a video stream. I've done this already and it does "work" but if there is any other text on the screen (sports scores, text from a news story, etc...) they will of course be included. Allowing the use of a mask when getting that text would help clean up the data returned from this keyword for cases like this.

If not no worries, thanks again for the work you've done, it's appreciated.

funtimesspray avatar Mar 03 '22 19:03 funtimesspray

Hey @funtimesspray , thanks a lot for your suggestion. Interesting idea.

Let's discuss the type of mask you are looking for. I have several possibilities in mind:

  • an image mask (a black/white image) where the areas that shall be retrievable are white - the ones that shall be ignored are black
  • a coordinate/area/textPattern mask for ignoring areas, which is similar to the masks used for visual comparison
  • an additional area argument (a rectangle with x, y, width, height) and text is only retrieved from that area

By the way: Just in case your goal is to do some image based steering/automation (like clicking on Texts or waiting for things to appear) also have a look at this library https://github.com/Eficode/robotframework-imagehorizonlibrary

manykarim avatar Mar 04 '22 08:03 manykarim

Hi @manykarim,

Thank you very much for the fast reply, to answer your question this is the type of mask I had in mind when writing this:

a coordinate/area/textPattern mask for ignoring areas, which is similar to the masks used for visual comparison

When reading about masks for visual comparisons I figured this would be perfect for this kind of request. This type of mask should be more than sufficient since it would allow the user to designate an area to ignore when looking for text to return in expected areas.

By the way: Just in case your goal is to do some image based steering/automation (like clicking on Texts or waiting for things to appear) also have a look at this library https://github.com/Eficode/robotframework-imagehorizonlibrary

This is interesting, my goal wasn't to do this kind of automation but thanks for the link 👍

funtimesspray avatar Mar 04 '22 16:03 funtimesspray