Skip to content

Commit 52882f6

Browse files
committed
add first stub
1 parent 26d8a88 commit 52882f6

File tree

7 files changed

+94
-0
lines changed

7 files changed

+94
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TODO
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc)
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
from typing import Literal
6+
7+
from arduino.app_peripherals.camera import BaseCamera, Camera
8+
9+
10+
class HandGestureTracking:
11+
def __init__(self, camera: BaseCamera | None = None):
12+
if camera is None:
13+
camera = Camera(fps=30)
14+
self.camera = camera
15+
16+
def on_gesture(self, gesture, callback, hand: Literal["left", "right", "both"] = "both"):
17+
pass
18+
19+
def on_enter(self, callback, hand: Literal["left", "right", "both"] = "both"):
20+
pass
21+
22+
def on_exit(self, callback, hand: Literal["left", "right", "both"] = "both"):
23+
pass
24+
25+
def on_frame(self, callback):
26+
pass
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
hand-gesture-tracker:
3+
image: hand-gesture-tracker
4+
privileged: true
5+
ports:
6+
- ${BIND_ADDRESS:-0.0.0.0}:5002:5002
7+
user: 0:0
8+
healthcheck:
9+
test: [ "CMD-SHELL", "nc -zv hand-gesture-tracker 5002 || exit 1" ]
10+
interval: 1s
11+
timeout: 2s
12+
retries: 30
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
id: arduino:hand_gesture_tracking
2+
name: Hand gesture tracking
3+
description: |
4+
This hand gesture tracking brick utilizes a pre-trained model to analyze video streams from a camera.
5+
The output is a video stream featuring hand gesture tracking as overlay, with the added capability to
6+
trigger actions based on these detections.
7+
category: video
8+
requires_container: true
9+
required_devices:
10+
- camera
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc)
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
# EXAMPLE_NAME = "Hand gesture detection"
6+
# EXAMPLE_REQUIRES = "Requires a connected camera"
7+
8+
from arduino.app_bricks.hand_gesture_detection import HandGestureTracking
9+
from arduino.app_utils.app import App
10+
11+
pd = HandGestureTracking()
12+
pd.on_gesture("Victory", lambda: print("All your bases are belong to us"))
13+
pd.on_gesture("Open_Palm", lambda: print("Moving left!"), hand="left")
14+
pd.on_gesture("Open_Palm", lambda: print("Moving right!"), hand="right")
15+
16+
App.run()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc)
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
# EXAMPLE_NAME = "Hand enter/exit detection"
6+
# EXAMPLE_REQUIRES = "Requires a connected camera"
7+
8+
from arduino.app_bricks.hand_gesture_detection import HandGestureTracking
9+
from arduino.app_utils.app import App
10+
11+
pd = HandGestureTracking()
12+
pd.on_enter(lambda: print("Hi there!"))
13+
pd.on_exit(lambda: print("Goodbye!"))
14+
15+
App.run()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-FileCopyrightText: Copyright (C) ARDUINO SRL (http://www.arduino.cc)
2+
#
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
# EXAMPLE_NAME = "Get user confirmation with hand gestures"
6+
# EXAMPLE_REQUIRES = "Requires a connected camera"
7+
8+
from arduino.app_bricks.hand_gesture_detection import HandGestureTracking
9+
from arduino.app_utils.app import App
10+
11+
pd = HandGestureTracking()
12+
pd.on_gesture("Thumb_Up", lambda: print("Operation confirmed!"))
13+
14+
App.run()

0 commit comments

Comments
 (0)