← 返回
未分类 中文

Webcam Motion Monitor

Webcam motion detection and monitoring system for WSL2 with USB/IP passthrough. Use when setting up motion detection on a USB webcam, monitoring camera snaps...
在WSL2中使用USB/IP透传的摄像头运动检测与监控系统,适用于设置USB摄像头的运动检测、监控抓拍等场景。
jadegaul jadegaul 来源
未分类 clawhub v1.0.3 1 版本 100000 Key: 无需
★ 0
Stars
📥 630
下载
💾 1
安装
1
版本
#latest

概述

Webcam Monitor

Complete webcam motion detection and monitoring system for WSL2 environments.

Overview

This skill provides:

  • Motion detection with automatic snapshot capture
  • Real-time folder monitoring with auto-analysis queue
  • Web-based live preview (port 8081)
  • Auto-cleanup of old snapshots (1 hour default)
  • Person identification via AI image analysis

Prerequisites

Windows Side (PowerShell as Admin):

winget install usbipd
usbipd list
usbipd bind --busid=1-4
usbipd attach --wsl --busid=1-4

WSL2 Side:

ls /dev/video*  # Should show /dev/video0

Note: If /dev/video* does not appear, you may need to restart WSL2:

# In Windows PowerShell:
wsl --shutdown
# Then re-attach the camera:
usbipd attach --wsl --busid=1-4

Quick Start

1. Start Motion Detection

python3 scripts/motion_detector_headless.py
  • Runs in background (no GUI)
  • Saves snapshots to ~/.openclaw/workspace/camera/snapshots/
  • Logs to ~/.openclaw/workspace/camera/motion.log

2. Start Folder Monitor with Auto-Cleanup

python3 scripts/watcher_with_cleanup.py
  • Monitors for new snapshots every 2 seconds
  • Auto-deletes snapshots older than 1 hour (every 5 minutes)
  • Queues new images for analysis
  • Logs to ~/.openclaw/workspace/camera/watcher.log

3. Start Web Preview (Optional)

python3 scripts/web_preview.py
  • Opens web server on port 8081
  • View at http://localhost:8081
  • Note: Stop motion detection first — camera can only be used by one program

Configuration

Edit scripts/motion_detector_headless.py:

  • MOTION_THRESHOLD — Sensitivity (lower = more sensitive, default: 25)
  • MIN_CONTOUR_AREA — Minimum motion area (default: 500)
  • SNAPSHOT_COOLDOWN — Seconds between snapshots (default: 5)
  • MAX_AGE_HOURS — Auto-cleanup threshold (default: 1)

Scripts

ScriptPurpose
-----------------
motion_detector_headless.pyBackground motion detection daemon
watcher_with_cleanup.pyFolder monitor + auto-cleanup + analysis queue
web_preview.pyWeb-based live preview (port 8081)
snapshot.shQuick manual snapshot
cleanup.pyManual cleanup of old snapshots

File Locations

  • Snapshots: ~/.openclaw/workspace/camera/snapshots/
  • Logs: ~/.openclaw/workspace/camera/motion.log
  • Watcher Log: ~/.openclaw/workspace/camera/watcher.log
  • Analysis Queue: ~/.openclaw/workspace/camera/analysis_queue/

Troubleshooting

"Could not open camera"

# Check USB passthrough
ls /dev/video*

If no video devices appear, restart WSL2:

# In Windows PowerShell:
wsl --shutdown
# Then re-attach the camera:
usbipd attach --wsl --busid=1-4

Then verify in WSL2:

ls /dev/video*  # Should now show /dev/video0

Permission denied

sudo chmod 666 /dev/video0

Camera in use

Only one program can use the camera at a time:

# Stop motion detection
pkill -f motion_detector

# Stop web preview
pkill -f web_preview

# Stop watcher
pkill -f watcher

Person Identification

The watcher can queue snapshots for AI analysis. To identify people:

  1. Update MEMORY.md with person details:
  2. ### Webcam Identification
    - **Person:** [Name]
    - **Appearance:** [Description - include hair, jewelry, clothing, wigs if applicable]
    - **Setting:** [Location details]
    

Example:

### Webcam Identification
- **Person:** Jade
- **Appearance:** Middle-aged, light-colored/graying hair (short, receding), often wears star-shaped pendant necklace, sometimes in bathrobe/robe when at desk, sometimes wears shoulder-length hair wig
- **Setting:** Home office with black mesh chair, cat tree, bookshelves
  1. Analyze queued images using the image tool with qwen model

Auto-Cleanup

By default, snapshots older than 1 hour are automatically deleted every 5 minutes.

To change:

  • Edit CLEANUP_INTERVAL in watcher_with_cleanup.py (seconds)
  • Edit MAX_AGE_HOURS in watcher_with_cleanup.py (hours)

Integration with OpenClaw

The watcher creates queue files in analysis_queue/ that can trigger automatic image analysis by the main agent. Check for new queue files and analyze with:

# Example: Check queue and analyze
queue_dir = Path.home() / ".openclaw/workspace/camera/analysis_queue"
for queue_file in queue_dir.glob("analyze_*.txt"):
    image_path = queue_file.read_text().strip()
    # Analyze image with image tool

版本历史

共 1 个版本

  • v1.0.3 当前
    2026-05-02 04:01 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

OpenCode Game Builder

jadegaul
将 OpenCode 作为 ACP(代理客户端协议)子代理启动,用于复杂编码任务。适用于构建游戏、Web应用、多文件项目,或当用户需要时。
★ 0 📥 453
it-ops-security

Free Ride - Unlimited free AI

shaivpidadi
管理OpenClaw的OpenRouter免费AI模型,自动按质量排名模型,配置速率限制备用方案,并更新opencla...
★ 473 📥 79,133
it-ops-security

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装后可防止您和您的用户受到提示注入、数据泄露及恶意行为的侵害。
★ 116 📥 31,120