diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7cd7d27..47c6c08 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -53,17 +53,16 @@ jobs: brew install tesseract pip install --no-binary tesserocr tesserocr - # - name: Install pyinstaller for Windows - # if: matrix.os == 'windows-latest' - # # $env:PYINSTALLER_COMPILE_BOOTLOADER="True" - # run: | - # Invoke-WebRequest -Uri https://github.com/pyinstaller/pyinstaller/archive/refs/tags/v6.5.0.zip -OutFile pyinstaller-6.5.0.zip - # Expand-Archive -Path pyinstaller-6.5.0.zip -DestinationPath . - # cd pyinstaller-6.5.0 - # python -m pip install . - # cd .. - # Remove-Item -Recurse -Force pyinstaller-6.5.0 - # Remove-Item -Force pyinstaller-6.5.0.zip + - name: Install pyinstaller for Windows + if: matrix.os == 'windows-latest' + run: | + Invoke-WebRequest -Uri https://github.com/pyinstaller/pyinstaller/archive/refs/tags/v6.6.0.zip -OutFile pyinstaller-6.6.0.zip + Expand-Archive -Path pyinstaller-6.6.0.zip -DestinationPath . + cd pyinstaller-6.6.0 + python -m pip install . + cd .. + Remove-Item -Recurse -Force pyinstaller-6.6.0 + Remove-Item -Force pyinstaller-6.6.0.zip - name: Install dependencies run: | diff --git a/INSTALL.md b/INSTALL.md index f8da53c..01a0fbc 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -36,6 +36,14 @@ To install on Windows, simply click the .zip file and then the .exe setup instal Once the setup is complete, ScoreSight will be available as an application. +If you get an error of a virus (which is a false alarm) like so + +![alt text](docs/image-14.png) + +Make sure to disable real-time protection + +![alt text](docs/image-15.png) + ## Mac OS On Mac OS ScoreSight comes as packaged .app application which doesn't need installation. diff --git a/README.md b/README.md index e1afeaf..889cf4d 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ See the [releases](https://github.com/occ-ai/scoresight/releases) page for downl See the [Install Guide](INSTALL.md) for help with installation. -## Build from Source +## Running and Building from Source ### Prerequisites @@ -54,9 +54,9 @@ There are some extra steps for installation on Windows: - Download and install https://visualstudio.microsoft.com/visual-cpp-build-tools/ C++ Build Tools - Build the win32DeviceEnum pyd by `$ cd win32DeviceEnum && python.exe setup.py build_ext --inplace` -## Usage +### Running from source -1. Launch the application: +1. Once everything is installed launch the application: ```shell python main.py @@ -64,6 +64,31 @@ There are some extra steps for installation on Windows: 2. Follow the on-screen instructions to load an image of the scoreboard and extract the text. +### Build an executable + +You may want to build a distributable .exe or .app or even an installer, this is possible with [PyInstaller](https://github.com/pyinstaller/pyinstaller). + +To build the executable run PyInstaller. + +#### MacOS + +``` +pyinstaller --clean --noconfirm scoresight.spec -- --mac_osx +``` + +#### Windows + +``` +pyinstaller --clean --noconfirm scoresight.spec -- --win +``` + +#### Linux + +``` +pyinstaller --clean --noconfirm scoresight.spec +``` + + ## Contributing Contributions are welcome! If you would like to contribute to this project, please follow these steps: diff --git a/camera_view.py b/camera_view.py index 4f36047..5967196 100644 --- a/camera_view.py +++ b/camera_view.py @@ -5,7 +5,7 @@ QGraphicsScene, QGraphicsPixmapItem, ) -from PyQt6.QtCore import Qt, QTimer +from PyQt6.QtCore import Qt from PyQt6.QtGui import QImage, QPixmap, QPainter from PyQt6.QtCore import QThread, pyqtSignal import cv2 diff --git a/docs/http_server.md b/docs/http_server.md new file mode 100644 index 0000000..be35d26 --- /dev/null +++ b/docs/http_server.md @@ -0,0 +1,81 @@ +# Using the ScoreSight HTTP Server + +Get your scoreboard information in the browser for a simple integration into many streaming software, like OBS. + +This feature is only available on ScoreSight Pro. + +To get started, set up your scoreboard with the information you want to extract. See the Setup Process Guide for instructions. + +Enable the HTTP Server from the bottom-right section of ScoreSight: "Start HTTP Server" + +You can then open any browser and enter "http://localhost:18099/scoresight" as the URL. A simple scoreboard will appear. You may now use this URL in your streaming software. + +All the scoreboard information will be delivered as JSON in http://localhost:18099/json . This can be used as API in any other software or even HTML pages. + +If you want to create a more customized HTML scoreboard you are able to do so. Create a ".html" file anywhere on your disk and use the template example below to fetch data automatically from ScoreSight into the browser. + +Here is a simple HTML example that uses the JSON output: + +```html + + + + + +Scoreboard + + + + + +
+
+
+
Home Team
+
0
+
Fouls: 0
+
+
+
00:00
+
+
+
Away Team
+
0
+
Fouls: 0
+
+
+
+ + + +``` diff --git a/docs/image-10.png b/docs/image-10.png new file mode 100644 index 0000000..f5246fa Binary files /dev/null and b/docs/image-10.png differ diff --git a/docs/image-11.png b/docs/image-11.png new file mode 100644 index 0000000..aca3c5e Binary files /dev/null and b/docs/image-11.png differ diff --git a/docs/image-12.png b/docs/image-12.png new file mode 100644 index 0000000..743e11f Binary files /dev/null and b/docs/image-12.png differ diff --git a/docs/image-13.png b/docs/image-13.png new file mode 100644 index 0000000..5faf4e8 Binary files /dev/null and b/docs/image-13.png differ diff --git a/docs/image-14.png b/docs/image-14.png new file mode 100644 index 0000000..9afe6bb Binary files /dev/null and b/docs/image-14.png differ diff --git a/docs/image-15.png b/docs/image-15.png new file mode 100644 index 0000000..802369b Binary files /dev/null and b/docs/image-15.png differ diff --git a/docs/image-8.png b/docs/image-8.png new file mode 100644 index 0000000..e86d323 Binary files /dev/null and b/docs/image-8.png differ diff --git a/docs/image-9.png b/docs/image-9.png new file mode 100644 index 0000000..c5539de Binary files /dev/null and b/docs/image-9.png differ diff --git a/docs/vmix.md b/docs/vmix.md new file mode 100644 index 0000000..74f435f --- /dev/null +++ b/docs/vmix.md @@ -0,0 +1,35 @@ +# vMix Integration + +ScoreSight can interact directly with vMix through an API, providing a smooth and fast connection to vMix scoreboard Titles. Here is how to get it up and running. + +First make sure vMix is accepting connections. This can be verified in the vMix Settings -> Web Controller screen. (Enable the TCP API option) + +![alt text](image-8.png) + +In a vMix input add a Title that fits your needs, for example this scoreboard (which is available in vMix): + +![alt text](image-9.png) + +Right click and open the Title Editor: + +![alt text](image-10.png) + +Note the names of the various texts in the Title, these would be controlled by ScoreSight. + +In ScoreSight setup your scoreboard with detection boxes: + +![alt text](image-11.png) + +Go on the vMix tab and update or inspect the connection information like host and port (8099 is the vMix default), and choose the vMix Input according to your vMix setup. Next, set the mapping between ScoreSight detections and the vMix Title texts according to the information in the Title Editor (seen above). + +![alt text](image-12.png) + +Make sure the mappings are exactly as they appear in the Title Editor. + +Once the mapping is complete the information will be updated on vMix automatically. + +![alt text](image-13.png) + +Consult the vMix guide on their API for reference: vMix User Guide + +ScoreSight will be sending information using the SetText function. diff --git a/http_server.py b/http_server.py index 53162f5..c6785f3 100644 --- a/http_server.py +++ b/http_server.py @@ -189,10 +189,13 @@ async def shutdown(): def stop_http_server(): logger.info("Stopping server...") - conn = http.client.HTTPConnection("localhost", PORT) - conn.request("GET", "/shutdown") - conn.close() - logger.info("Server stopped") + try: + conn = http.client.HTTPConnection("localhost", PORT) + conn.request("GET", "/shutdown") + conn.close() + logger.info("Server stopped") + except Exception as e: + pass def update_http_server(results: list[TextDetectionTargetWithResult]): diff --git a/requirements.txt b/requirements.txt index a075e86..85327df 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,8 +4,9 @@ obsws-python opencv-python pillow platformdirs -pyinstaller -pyqt6 +pyinstaller==6.6.0 +pyqt6==6.6.1 +PyQt6-Qt6==6.7.0 python-dotenv requests tesserocr