isaac-jordan / obs-screen-recognition Goto Github PK
View Code? Open in Web Editor NEWA script designed to recognise a particular screen or image on-screen, and change scene in OBS
License: MIT License
A script designed to recognise a particular screen or image on-screen, and change scene in OBS
License: MIT License
This will prevent OBS from changing scene while in a "Be Right Back" scene for example.
Will require some thought in order to not impact latency of the script, since OBS calls are relatively slow.
Hello,
i try your script on my game with the newest update and when i open map ingame doesnt work but do the job on the deploy screen.
The bug is due to the incorrect mask, i dont know if it's my screen, new update or simply incorrect mask but i resolve by doing a new mask with the correct screen.
I send in attached file, the correct mask and my psd use to do it.
mask-1080p.zip
mask-1440p.zip
edit:
instead of pip install -r requirements.txt
the command used by people is python -m pip install -r requirements.txt
and in file requirements.txt you need to put or you get No matching distribution found on opencv
mss==6.1.0
numpy==1.19.3
obs-websocket-py==0.5.1
opencv-contrib-python==4.4.0.46
opencv-python==4.4.0.46
six==1.15.0
websocket-client==0.57.0
click==7.1.2
All packages are update to latest, only numpy are leave to 1.19.3 because a bug on latest numpy
the message when try to use latest numpy is
RuntimeError: The current Numpy installation ('C:\\Python\\lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://tinyurl.com/y3dm3h86
A new monitor had a different aspect ratio, therefore I had to redo profiles and scenes in OBS. Previously script worked fine. nVidia control panel shows changed monitor as "1", like the old monitor. Just to be sure I've redone the mask and hll_map_key_while_alive/dead_image files.
{ "monitor_to_capture": 1, "image_directory": "./hll_map_open_detection/image_files", "mask_file": "./hll_map_open_detection/mask.jpg", "default_scene_name": "HLL", "target_scene_name": "HLL-map", "num_features_to_detect": 500, "num_good_matches_required": 20, "show_debug_window": false }
From Bash:
(https://pastebin.com/THz1BEzX)
Any idea whats going on?
Hi
Houston we got a problem.
When i start OBS Studio the script give me a error message.
[obs_screen_recognition_script.py] File "D:/Projekte/Twitch/Twitch overlay\obs_screen_recognition_script.py", line 12, in
[obs_screen_recognition_script.py]from mss import mss
[obs_screen_recognition_script.py] ModuleNotFoundError: No module named 'mss'
sry for my english.
I'm getting this error message when trying to run script w/o being on a HLL server: https://pastebin.com/Fp1Q6irS OBS is ran as an admin. Script refuses to work until the pc is rebooted no matter what.
Therefore could the following features be added?
Hi,
Trying to run the script and getting an authentication error. The OBS websocket script is installed and has a password set to it. The reason is because I'm also using a streamdeck and the "OBS Tools" from barraider, which strongly advises you to put a password on the websocket.
The error:
C:\gitrepos\obs-screen-recognition>python obs_screen_recognition_script.py ./hll
Running with settings: {'monitor_to_capture': 1, 'screen_format': '1080p', 'default_scene_name': 'Scene', 'target_scene_name': 'Scene (map covered)', 'num_features_to_detect': 500, 'num_good_matches_required': 20}
Traceback (most recent call last):
File "obs_screen_recognition_script.py", line 140, in <module>
main()
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "obs_screen_recognition_script.py", line 115, in main
obs.connect()
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\obswebsocket\core.py", line 70, in connect
self._auth(self.password)
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\obswebsocket\core.py", line 140, in _auth
raise exceptions.ConnectionFailure(result['error'])
obswebsocket.exceptions.ConnectionFailure: Authentication Failed.
Where can I set the password for the the obs*.py script? I have tried to read --help, but there are no options for it. I have also tried to paste the password behind "./hll", but as it has special characters, python has a booboo :-)
C:\gitrepos\obs-screen-recognition>python obs_screen_recognition_script.py --help
Usage: obs_screen_recognition_script.py [OPTIONS] RESOURCE_DIR
Options:
--show-debug-window
--help Show this message and exit.
Hi there,
Thanks for the script, I'm just trying to play with it a bit and see what I can do with it.
Since I'm still learning Python AND how to use OBS properly I might have done something wrong, but after following every steps of the README I got this error when running the script : obswebsocket.exceptions.ConnectionFailure: Authentication Failed.
websocket is installed properly, I'm using it for something else and it works well.
Any idea on how to fix this?
Hi can this script still work if ruuning a gaming pc and then obs on a 2nd streaming pc.
I installed the mss module. The problem of my predecessor. The script doesn´t work.
script log is empty
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.