Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add turbo jpeg changes #9

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be generic for any user!

"display_name": "Kivy Camera App",
"autostart": false
}
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ install_requires =
wheel
kivy
farm_ng_amiga
PyTurboJPEG
opencv-contrib-python
kornia-rs
tests_require =
pytest
Expand Down
11 changes: 9 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@
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
from farm_ng.core.event_service_pb2 import EventServiceConfigList
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 kornia_rs import ImageDecoder
OloFuchs marked this conversation as resolved.
Show resolved Hide resolved
from turbojpeg import TurboJPEG


os.environ["KIVY_NO_ARGS"] = "1"

Expand Down Expand Up @@ -56,7 +59,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):
Expand Down Expand Up @@ -95,6 +99,7 @@ async def stream_camera(
),
decode=True,
):

try:
img = self.image_decoder.decode(message.image_data)
except Exception as e:
Expand Down Expand Up @@ -145,7 +150,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}")

Expand Down
Loading