isaac-jordan / obs-screen-recognition

A script designed to recognise a particular screen or image on-screen, and change scene in OBS
MIT License
26 stars 6 forks source link

Error message in OBS-Studio #1

Open FwSchultz opened 4 years ago

FwSchultz commented 4 years ago

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.

isaac-jordan commented 4 years ago

Hey, thanks for the report.

It sounds like you might be running the script as an "OBS script" i.e. using the UI in OBS.

Unfortunately, this script is not designed to work like that, you need to run this script separately using a command-line terminal, as described in the README.

Let me know how it goes trying that, or if you already are doing that.

FwSchultz commented 4 years ago

Ok i have delete in obs the skript. now when i start obs and then i starting the script manually i get this fault.

I must say this is my first time with pyhton and i dont know what i do...

Running with settings: {'monitor_to_capture': 1, 'image_directory': 'D:/Projekte/Twitch/Twitch overlay/hll_map_open_detection/image_files', 'mask_file': 'D:/Projekte/Twitch/Twitch overlay/hll_map_open_detection/mask.jpg', 'default_scene_name': 'inGame-Overlay', 'target_scene_name': 'autooverlay', 'num_features_to_detect': 500, 'num_good_matches_required': 20, 'show_debug_window': False} Detected scenes in OBS: <GetSceneList request ({}) called: success ({'current-scene': 'inGame-Overlay', 'scenes': [{'name': 'Start Szene', 'sources': [{'alignment': 5, 'cx': 697.2368774414062, 'cy': 792.1008911132812, 'groupChildren': [{'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 12, 'locked': True, 'muted': False, 'name': 'Chat', 'parentGroupName': 'Chatbereich', 'render': True, 'source_cx': 0, 'source_cy': 0, 'type': 'ffmpeg_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}, {'alignment': 5, 'cx': 414.0, 'cy': 449.0000305175781, 'id': 11, 'locked': True, 'muted': False, 'name': 'Chatfenster', 'parentGroupName': 'Chatbereich', 'render': True, 'source_cx': 350, 'source_cy': 380, 'type': 'browser_source', 'volume': 1.0, 'x': 41.0, 'y': 68.0}], 'id': 13, 'locked': True, 'muted': False, 'name': 'Chatbereich', 'render': False, 'source_cx': 455, 'source_cy': 517, 'type': 'group', 'volume': 1.0, 'x': 2555.0, 'y': 385.0}, {'alignment': 5, 'cx': 1685.0, 'cy': 947.0, 'groupChildren': [{'alignment': 5, 'cx': 1173.3333740234375, 'cy': 879.3893432617188, 'id': 4, 'locked': True, 'muted': False, 'name': 'YT', 'parentGroupName': 'Youtube', 'render': False, 'source_cx': 800, 'source_cy': 600, 'type': 'browser_source', 'volume': 0.29794222116470337, 'x': 673.0, 'y': 371.0}, {'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 5, 'locked': True, 'muted': False, 'name': 'Rahmen YT', 'parentGroupName': 'Youtube', 'render': False, 'source_cx': 0, 'source_cy': 0, 'type': 'ffmpeg_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}], 'id': 10, 'locked': True, 'muted': False, 'name': 'Youtube', 'render': False, 'source_cx': 1685, 'source_cy': 947, 'type': 'group', 'volume': 1.0, 'x': 1589.0, 'y': 426.0}, {'alignment': 5, 'cx': -2473.823974609375, 'cy': 1775.995361328125, 'groupChildren': [{'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 7, 'locked': True, 'muted': True, 'name': 'Logitech Brio 4K Webcam', 'parentGroupName': 'Webcam Start', 'render': True, 'source_cx': 0, 'source_cy': 0, 'type': 'dshow_input', 'volume': 1.0, 'x': 117.0400390625, 'y': 366.9999694824219}, {'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 6, 'locked': True, 'muted': False, 'name': 'Webcamrahmen', 'parentGroupName': 'Webcam Start', 'render': False, 'source_cx': 0, 'source_cy': 0, 'type': 'ffmpeg_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}, {'alignment': 5, 'cx': -224.99998474121094, 'cy': 37.0, 'id': 9, 'locked': True, 'muted': False, 'name': 'Fw.Schultz', 'parentGroupName': 'Webcam Start', 'render': False, 'source_cx': 1572, 'source_cy': 256, 'type': 'text_gdiplus_v2', 'volume': 1.0, 'x': 1037.25048828125, 'y': 707.1497802734375}], 'id': 8, 'locked': False, 'muted': False, 'name': 'Webcam Start', 'render': False, 'source_cx': 1038, 'source_cy': 745, 'type': 'group', 'volume': 1.0, 'x': 1092.0, 'y': 931.0}, {'alignment': 5, 'cx': 2.0, 'cy': 72.0, 'id': 2, 'locked': True, 'muted': False, 'name': 'Countdown', 'render': True, 'source_cx': 2, 'source_cy': 72, 'type': 'text_gdiplus_v2', 'volume': 1.0, 'x': 1276.0, 'y': 826.0}, {'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 1, 'locked': True, 'muted': False, 'name': 'Start-BG', 'render': True, 'source_cx': 0, 'source_cy': 0, 'type': 'ffmpeg_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}]}, {'name': 'inGame-Overlay', 'sources': [{'alignment': 5, 'cx': 3440.0, 'cy': 1440.0, 'id': 44, 'locked': False, 'muted': False, 'name': 'autooverlay', 'render': False, 'source_cx': 3440, 'source_cy': 1440, 'type': 'image_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}, {'alignment': 5, 'cx': -1791.63525390625, 'cy': 1357.475341796875, 'groupChildren': [{'alignment': 5, 'cx': -0.0, 'cy': 0.0, 'id': 38, 'locked': False, 'muted': True, 'name': 'Logitech Brio 4K Webcam', 'parentGroupName': 'Webcam', 'render': False, 'source_cx': 0, 'source_cy': 0, 'type': 'dshow_input', 'volume': 1.0, 'x': 284.0001220703125, 'y': 291.99993896484375}, {'alignment': 5, 'cx': -0.0, 'cy': 0.0, 'id': 41, 'locked': True, 'muted': False, 'name': 'Webcamrahmen', 'parentGroupName': 'Webcam', 'render': False, 'source_cx': 0, 'source_cy': 0, 'type': 'ffmpeg_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}, {'alignment': 5, 'cx': -170.902587890625, 'cy': 27.718164443969727, 'id': 42, 'locked': True, 'muted': False, 'name': 'Fw.Schultz', 'parentGroupName': 'Webcam', 'render': False, 'source_cx': 1572, 'source_cy': 256, 'type': 'text_gdiplus_v2', 'volume': 1.0, 'x': 888.307861328125, 'y': 809.0033569335938}], 'id': 39, 'locked': False, 'muted': False, 'name': 'Webcam', 'render': False, 'source_cx': 1598, 'source_cy': 1211, 'type': 'group', 'volume': 1.0, 'x': 1271.0, 'y': 758.0000610351562}, {'alignment': 5, 'cx': 9770.0, 'cy': 4089.0, 'groupChildren': [{'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 17, 'locked': True, 'muted': False, 'name': 'inGame Aufnahme', 'parentGroupName': 'Overlay', 'render': True, 'source_cx': 0, 'source_cy': 0, 'type': 'game_capture', 'volume': 1.0, 'x': 0.0, 'y': 0.0}, {'alignment': 5, 'cx': 253.0, 'cy': 340.0, 'id': 27, 'locked': True, 'muted': False, 'name': 'Logo', 'parentGroupName': 'Overlay', 'render': False, 'source_cx': 800, 'source_cy': 1076, 'type': 'image_source', 'volume': 1.0, 'x': 4582.7001953125, 'y': 3742.27099609375}, {'alignment': 5, 'cx': 3507.0, 'cy': 1441.9996337890625, 'id': 32, 'locked': True, 'muted': False, 'name': 'Latest Donation', 'parentGroupName': 'Overlay', 'render': False, 'source_cx': 3440, 'source_cy': 1440, 'type': 'browser_source', 'volume': 0.21332032978534698, 'x': 4567.72265625, 'y': 2005.2744140625}, {'alignment': 5, 'cx': 3650.14306640625, 'cy': 1500.85693359375, 'id': 33, 'locked': True, 'muted': False, 'name': 'Latest Follower', 'parentGroupName': 'Overlay', 'render': False, 'source_cx': 3440, 'source_cy': 1440, 'type': 'browser_source', 'volume': 0.22031009197235107, 'x': 9301.6875, 'y': 1999.375732421875}, {'alignment': 5, 'cx': 1735.633056640625, 'cy': 1301.3387451171875, 'id': 19, 'locked': True, 'muted': False, 'name': 'AlertBox', 'parentGroupName': 'Overlay', 'render': False, 'source_cx': 800, 'source_cy': 600, 'type': 'browser_source', 'volume': 0.22165547311306, 'x': 4600.072265625, 'y': 2216.648681640625}], 'id': 8, 'locked': False, 'muted': False, 'name': 'Overlay', 'render': True, 'source_cx': 9770, 'source_cy': 4089, 'type': 'group', 'volume': 1.0, 'x': -17.0, 'y': -13.0}, {'alignment': 5, 'cx': 2878.0, 'cy': 1619.0, 'groupChildren': [{'alignment': 5, 'cx': 2177.0, 'cy': 1225.0, 'id': 35, 'locked': True, 'muted': False, 'name': 'inGame tot', 'parentGroupName': 'ingameOverlay', 'render': False, 'source_cx': 1920, 'source_cy': 1080, 'type': 'image_source', 'volume': 1.0, 'x': 319.0, 'y': 192.0}, {'alignment': 5, 'cx': 2878.0, 'cy': 1619.0, 'id': 34, 'locked': True, 'muted': False, 'name': 'inGame', 'parentGroupName': 'ingameOverlay', 'render': False, 'source_cx': 1920, 'source_cy': 1080, 'type': 'image_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}], 'id': 40, 'locked': True, 'muted': False, 'name': 'ingameOverlay', 'render': False, 'source_cx': 2878, 'source_cy': 1619, 'type': 'group', 'volume': 1.0, 'x': 309.0, 'y': -90.0}]}, {'name': 'Pause Szene', 'sources': [{'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 1, 'locked': True, 'muted': False, 'name': 'Pause', 'render': True, 'source_cx': 0, 'source_cy': 0, 'type': 'ffmpeg_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}]}, {'name': 'Ende-Szene', 'sources': [{'alignment': 5, 'cx': 3440.0, 'cy': 1440.0, 'id': 2, 'locked': False, 'muted': False, 'name': 'Credits_Abspann', 'render': True, 'source_cx': 3440, 'source_cy': 1440, 'type': 'browser_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}, {'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 1, 'locked': True, 'muted': True, 'name': 'Ende', 'render': True, 'source_cx': 0, 'source_cy': 0, 'type': 'ffmpeg_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}]}, {'name': 'inGame-Chat', 'sources': [{'alignment': 5, 'cx': 800.0, 'cy': 600.0, 'id': 5, 'locked': True, 'muted': False, 'name': 'AlertBox', 'render': True, 'source_cx': 800, 'source_cy': 600, 'type': 'browser_source', 'volume': 0.22165547311306, 'x': 2590.0, 'y': 835.0}, {'alignment': 5, 'cx': 667.0, 'cy': 724.0, 'id': 3, 'locked': False, 'muted': False, 'name': 'Chatfenster', 'render': True, 'source_cx': 350, 'source_cy': 380, 'type': 'browser_source', 'volume': 1.0, 'x': 2653.0, 'y': 246.0}, {'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 1, 'locked': False, 'muted': False, 'name': 'Chat', 'render': True, 'source_cx': 0, 'source_cy': 0, 'type': 'ffmpeg_source', 'volume': 1.0, 'x': 0.0, 'y': 0.0}, {'alignment': 5, 'cx': 0.0, 'cy': 0.0, 'id': 2, 'locked': True, 'muted': False, 'name': 'inGame-Aufnahme', 'render': True, 'source_cx': 0, 'source_cy': 0, 'type': 'game_capture', 'volume': 1.0, 'x': 95.0, 'y': 175.0}]}]})>

OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\core\src\arithm.cpp:250: error: (-215:Assertion failed) (mtype == CV_8U || mtype == CV_8S) && _mask.sameSize(*psrc1) in function 'cv::binary_op'

Elenedeath commented 3 years ago

I got this bug when i use 1440p parameter on my 1080p monitor,dont know how to resolve than set the correct resolution on settings.json

try to change opencv version, python 3.6 and python 3.9, all do the same.

isaac-jordan commented 3 years ago

I've added autodetection of the screen resolution in 4613fa57658bfe2277c79fc9591c9cd790aeef96, and I've added an error message in 47125dd0990fbea517f1739a3c90cb9d935af328 if the resolution isn't one of the valid ones.

Let me know if this helps at all.