360 Secure SkillHub
360 安全技能中心

Camera Capture

通过 Python 与 OpenCV 调用本机内置摄像头,支持单帧拍照并保存到本地目录、列出可用摄像头、限时预览窗口;拍照路径打印到标准输出,运行需 python3 与 opencv-python。

dddjj0
dddjj0
热度 52.45
最近更新 2026-05-11 17:39:22
分类:自动化依赖:代码执行 / 读写文件应用场景:自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add camera-capture
Metadata
name
camera
version
1.0.2
description
Control the local computer's built-in camera for capturing photos and basic operations.
metadata
{"openclaw":{"emoji":"📷","requires":{"bins":["python3"],"python_packages":["opencv-python"]}}}

Camera Control Skill

Control the local computer's built-in camera for capturing photos and basic operations.

When to Use

  • User wants to take a photo using the computer camera
  • User asks to capture an image from the webcam
  • User wants to check the camera view
  • Commands like: "拍照", "打开摄像头", "拍张照片", "camera", "webcam", "take a photo"

Tools Required

  • Python 3 with OpenCV (cv2)
  • Standard library only (no extra deps beyond opencv-python)

Usage

Take a Photo

Capture a single frame from the default camera:

python3 skills/camera/scripts/camera.py capture --output "~/.openclaw/workspace/captures/photo_$(date +%Y%m%d_%H%M%S).jpg"

Or use the wrapper for default location:

python3 skills/camera/scripts/capture.py

This saves to ~/.openclaw/workspace/captures/ with timestamp.

List Available Cameras

python3 skills/camera/scripts/camera.py list

Test Camera (preview window, auto-close after 3 seconds)

python3 skills/camera/scripts/camera.py preview --duration 3

Output

  • Photo path is printed to stdout
  • Use this path with the image tool to analyze the captured photo
  • Photos are saved to captures/ directory by default

Examples

User: "拍张照片" Action: Run capture script, then use image tool to show/analyze the photo.

User: "看看摄像头画面" Action: Run preview script for 3 seconds to verify camera works.

Notes

  • Default camera index is 0 (built-in webcam)
  • If you have multiple cameras, use --camera 1, --camera 2, etc.
  • On Windows, the script auto-detects and works with DirectShow backend
  • Captures directory is auto-created if it doesn't exist