Test for sending taken photo to nodered

This commit is contained in:
2025-12-31 13:27:47 +01:00
parent 01594d02ed
commit b4330706cd
4 changed files with 17 additions and 4 deletions

View File

@@ -1,3 +1,6 @@
import cv2
import requests
from services.clock_service import ClockService
from services.detection_service import DetectionService
@@ -17,7 +20,14 @@ class GameService:
def stop(self):
self.clock_service.stop()
self.detection_service.stop()
def make_move(self) -> None:
fen = self.detection_service.analyze_single_frame()
print(fen)
img, fen = self.detection_service.analyze_single_frame()
print(fen)
encoded_frame = cv2.imencode('.jpg', img)
image_bytes = encoded_frame[1].tobytes()
headers = {'Content-Type': 'image/jpeg'}
response = requests.post("https://192.168.15.125/party/image", data=image_bytes, headers=headers)
print(response.status_code)