$npx -y skills add SharpAI/DeepCamera --skill depth-estimationReal-time depth map privacy transforms using Depth Anything v2 (CoreML + PyTorch)
| 1 | # Depth Estimation (Privacy) |
| 2 | |
| 3 | Real-time monocular depth estimation using Depth Anything v2. Transforms camera feeds with colorized depth maps — near objects appear warm, far objects appear cool. |
| 4 | |
| 5 | When used for **privacy mode**, the `depth_only` blend mode fully anonymizes the scene while preserving spatial layout and activity, enabling security monitoring without revealing identities. |
| 6 | |
| 7 | ## Hardware Backends |
| 8 | |
| 9 | | Platform | Backend | Runtime | Model | |
| 10 | |----------|---------|---------|-------| |
| 11 | | **macOS** | CoreML | Apple Neural Engine | `apple/coreml-depth-anything-v2-small` (.mlpackage) | |
| 12 | | Linux/Windows | PyTorch | CUDA / CPU | `depth-anything/Depth-Anything-V2-Small` (.pth) | |
| 13 | |
| 14 | On macOS, CoreML runs on the Neural Engine, leaving the GPU free for other tasks. The model is auto-downloaded from HuggingFace and stored at `~/.aegis-ai/models/feature-extraction/`. |
| 15 | |
| 16 | ## What You Get |
| 17 | |
| 18 | - **Privacy anonymization** — depth-only mode hides all visual identity |
| 19 | - **Depth overlays** on live camera feeds |
| 20 | - **3D scene understanding** — spatial layout of the scene |
| 21 | - **CoreML acceleration** — Neural Engine on Apple Silicon (3-5x faster than MPS) |
| 22 | |
| 23 | ## Interface: TransformSkillBase |
| 24 | |
| 25 | This skill implements the `TransformSkillBase` interface. Any new privacy skill can be created by subclassing `TransformSkillBase` and implementing two methods: |
| 26 | |
| 27 | ```python |
| 28 | from transform_base import TransformSkillBase |
| 29 | |
| 30 | class MyPrivacySkill(TransformSkillBase): |
| 31 | def load_model(self, config): |
| 32 | # Load your model, return {"model": "...", "device": "..."} |
| 33 | ... |
| 34 | |
| 35 | def transform_frame(self, image, metadata): |
| 36 | # Transform BGR image, return BGR image |
| 37 | ... |
| 38 | ``` |
| 39 | |
| 40 | ## Protocol |
| 41 | |
| 42 | ### Aegis → Skill (stdin) |
| 43 | ```jsonl |
| 44 | {"event": "frame", "frame_id": "cam1_1710001", "camera_id": "front_door", "frame_path": "/tmp/frame.jpg", "timestamp": "..."} |
| 45 | {"command": "config-update", "config": {"opacity": 0.8, "blend_mode": "overlay"}} |
| 46 | {"command": "stop"} |
| 47 | ``` |
| 48 | |
| 49 | ### Skill → Aegis (stdout) |
| 50 | ```jsonl |
| 51 | {"event": "ready", "model": "coreml-DepthAnythingV2SmallF16", "device": "neural_engine", "backend": "coreml"} |
| 52 | {"event": "transform", "frame_id": "cam1_1710001", "camera_id": "front_door", "transform_data": "<base64 JPEG>"} |
| 53 | {"event": "perf_stats", "total_frames": 50, "timings_ms": {"transform": {"avg": 12.5, ...}}} |
| 54 | ``` |
| 55 | |
| 56 | ## Setup |
| 57 | |
| 58 | ```bash |
| 59 | python3 -m venv .venv && source .venv/bin/activate |
| 60 | pip install -r requirements.txt |
| 61 | ``` |