wolfmanstout / screen-ocr

Easily perform OCR on portions of the screen, choosing from a selection of backends.
Apache License 2.0
37 stars 7 forks source link

just select a rect rather than use radius #9

Closed willwade closed 1 year ago

willwade commented 1 year ago

Nice code!

I get why you are using radius as a selection technique (as demo'd in your tobii video) - but is there a simple way to just select say a specific rect on the page/. If I use radius I'm going to get stuff I don't need

(I basically am trying to capture the message bar area seen here: https://youtu.be/VPfV0_kevLk?t=69 - rather than all the other squares of words)

wolfmanstout commented 1 year ago

Reader.read_image() will accept any arbitrary image, and you can set screen_coordinates and search_radius to None to search the entire image. You'll just need to take the screenshot yourself using ImageGrab.grab() and crop it, similar to Reader._screenshot_nearby().

willwade commented 1 year ago

amazing. Thanks

wolfmanstout commented 1 year ago

FYI the API for this is now cleaner, see example: https://github.com/wolfmanstout/screen-ocr/blob/master/screen_ocr/__main__.py

Make sure to update to 0.4.0 (just pushed) to take advantage.