diff --git a/README.md b/README.md index cf7c4cd..915075f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Additionally: - Scanning the clipboard takes basically zero system resources on macOS and Windows - Supports reading images and/or writing text to a websocket with the `-r=websocket` and/or `-w=websocket` parameters (the port is 7331 by default, and is configurable in the config file) - On macOS and Linux, supports reading images from a Unix domain socket (`/tmp/owocr.sock`) with `-r=unixsocket` -- On Windows and macOS, supports capturing from the screen directly or from a specific window with `-r=screencapture`. By default it will open a coordinate picker so you can select an area of the screen and then read from it every 3 seconds, but you can change it to screenshot the whole screen, a manual set of coordinates `x,y,width,height` or just a specific window (with the window title). You can also change the delay between screenshots or specify a keyboard combo if you don't want screenshots to be taken periodically. Refer to the config file or to `owocr --help` for more details about the screen capture settings +- On Windows and macOS, supports capturing from the screen directly or from a specific window with `-r=screencapture`. By default it will open a coordinate picker so you can select an area of the screen and then read from it without delays, but you can change it to screenshot the whole screen, a manual set of coordinates `x,y,width,height` or just a specific window (with the window title). You can also change the delay between screenshots or specify a keyboard combo if you don't want screenshots to be taken periodically. Refer to the config file or to `owocr --help` for more details about the screen capture settings - You can read images from another source at the same time with `-rs=`, the arguments are the same as `-r` - You can pause/unpause the image processing by pressing "p" or terminate the script with "t" or "q" inside the terminal window - You can switch between OCR providers pressing their corresponding keyboard key inside the terminal window (refer to the list of keys in the providers list below) @@ -23,7 +23,6 @@ Additionally: - You can auto pause the script after a successful text recognition with the `-a=seconds` option if you're not using screen capture. 0 (the default) disables it. - You can enable notifications in the config file or with `-n` to show the text with a native OS notification if you're not using screen capture with automatic screenshots. **Important for macOS users:** if you use Python from brew, you need to enter this command in your terminal before the first notification: `codesign -f -s - $(brew --cellar python)/3.*/Frameworks/Python.framework` (works on Ventura/Sonoma). Older macOS versions might require Python to be installed from the [official website](https://www.python.org/downloads/). Nothing can be done about this unfortunately. - Optionally, you can speed up the online providers by installing fpng-py: `pip install owocr[faster-png]` (requires setting up a developer environment on most operating systems/Python versions) -- Optionally, you can improve filtering of non-Japanese text for screen capture by installing transformers and sentencepiece: `pip install owocr[accurate-filtering]` - A config file (which will be automatically created in `user directory/.config/owocr_config.ini`, on Windows `user directory` is the `C:\Users\yourusername` folder) can be used to configure the script, as an example to limit providers (to reduce clutter/memory usage) as well as specifying provider settings such as api keys etc. A sample config file is also provided [here](https://raw.githubusercontent.com/AuroraWright/owocr/master/owocr_config.ini) - For systems where text can be copied to the clipboard at the same time as images, if `*ocr_ignore*` is copied with an image, the image will be ignored (mostly useful for devs making their own sender tool) diff --git a/owocr/config.py b/owocr/config.py index 839ce86..1dd8053 100644 --- a/owocr/config.py +++ b/owocr/config.py @@ -84,7 +84,7 @@ class Config: 'combo_pause': '', 'combo_engine_switch': '', 'screen_capture_area': '', - 'screen_capture_delay_secs': -1, + 'screen_capture_delay_secs': 0, 'screen_capture_only_active_windows': True, 'screen_capture_frame_stabilization': -1, 'screen_capture_combo': '', diff --git a/owocr/run.py b/owocr/run.py index 26ed4de..76643fe 100644 --- a/owocr/run.py +++ b/owocr/run.py @@ -1271,6 +1271,8 @@ def run(): global periodic_screenshot_queue periodic_screenshot_queue = queue.Queue() screen_capture_periodic = True + if not (screen_capture_on_combo or screen_capture_periodic): + raise ValueError('screen_capture_delay_secs or screen_capture_combo need to be valid values') screenshot_event = threading.Event() screenshot_thread = ScreenshotThread() screenshot_thread.start() diff --git a/pyproject.toml b/pyproject.toml index 551c884..414539a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,6 @@ dependencies = [ "websockets>=14.0", "desktop-notifier>=6.1.0", "mss", - "pysbd", - "langid", "psutil", "requests", "pywin32;platform_system=='Windows'", @@ -38,11 +36,6 @@ faster-png = [ "fpng-py" ] -accurate-filtering = [ - "transformers", - "sentencepiece" -] - easyocr = [ "easyocr" ]