diff --git a/entry.sh b/entry.sh index 330f640..1f3f3a8 100755 --- a/entry.sh +++ b/entry.sh @@ -3,6 +3,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" $DIR/bootstrap.sh $DIR $DIR/venv -$DIR/venv/bin/python $DIR/src/main.py +DISPLAY=:0 $DIR/venv/bin/python $DIR/src/main.py exit 0 diff --git a/manifest.json b/manifest.json index ee753a1..6b87ace 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "camera-app-kivy": { "name": "camera-app-kivy", "type": "app", - "exec_cmd": "/mnt/managed_home/farm-ng-user-edgar/camera-streamer-kivy/entry.sh", + "exec_cmd": "/mnt/managed_home/farm-ng-user-oliverfuchs/camera-streamer-kivy/entry.sh", "display_name": "Kivy Camera App", "autostart": false } diff --git a/setup.cfg b/setup.cfg index 4600c83..e0fe12e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,6 +23,8 @@ install_requires = wheel kivy farm_ng_amiga + PyTurboJPEG + opencv-contrib-python kornia-rs tests_require = pytest diff --git a/src/main.py b/src/main.py index 13dea02..5197b79 100644 --- a/src/main.py +++ b/src/main.py @@ -19,6 +19,7 @@ import os from pathlib import Path from typing import Literal +import cv2 from farm_ng.core.event_client import EventClient from farm_ng.core.event_service_pb2 import EventServiceConfig @@ -26,7 +27,8 @@ from farm_ng.core.event_service_pb2 import SubscribeRequest from farm_ng.core.events_file_reader import proto_from_json_file from farm_ng.core.uri_pb2 import Uri -from kornia_rs import ImageDecoder +from turbojpeg import TurboJPEG + os.environ["KIVY_NO_ARGS"] = "1" @@ -56,7 +58,8 @@ def __init__(self, service_config: EventServiceConfig, stream_every_n: int) -> N self.service_config = service_config self.stream_every_n = stream_every_n - self.image_decoder = ImageDecoder() + # self.image_decoder = ImageDecoder() + self.image_decoder = TurboJPEG() self.image_subscription_tasks: list[asyncio.Task] = [] def build(self): @@ -95,6 +98,7 @@ async def stream_camera( ), decode=True, ): + try: img = self.image_decoder.decode(message.image_data) except Exception as e: @@ -145,7 +149,9 @@ def find_config_by_name( ) # filter out services to pass to the events client manager + print(args.camera_name) oak_service_config = find_config_by_name(service_config_list, args.camera_name) + # print(oak_service_config) if oak_service_config is None: raise RuntimeError(f"Could not find service config for {args.camera_name}")