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:
CODEBLOCK0
Or use the wrapper for default location:
CODEBLOCK1
This saves to ~/.openclaw/workspace/captures/ with timestamp.
List Available Cameras
CODEBLOCK2
Test Camera (preview window, auto-close after 3 seconds)
CODEBLOCK3
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
摄像头控制技能
控制本地计算机内置摄像头进行拍照和基本操作。
使用场景
- - 用户想要使用电脑摄像头拍照
- 用户要求从网络摄像头捕捉图像
- 用户想要查看摄像头画面
- 命令示例:拍照、打开摄像头、拍张照片、camera、webcam、take a photo
所需工具
- - 安装OpenCV(cv2)的Python 3环境
- 仅使用标准库(除opencv-python外无需额外依赖)
使用方法
拍照
从默认摄像头捕捉单帧图像:
bash
python3 skills/camera/scripts/camera.py capture --output ~/.openclaw/workspace/captures/photo$(date +%Y%m%d%H%M%S).jpg
或使用默认路径的封装命令:
bash
python3 skills/camera/scripts/capture.py
该命令会将照片保存至~/.openclaw/workspace/captures/目录,文件名包含时间戳。
列出可用摄像头
bash
python3 skills/camera/scripts/camera.py list
测试摄像头(预览窗口,3秒后自动关闭)
bash
python3 skills/camera/scripts/camera.py preview --duration 3
输出
- - 照片路径会打印到标准输出
- 使用该路径配合image工具分析拍摄的照片
- 照片默认保存至captures/目录
示例
用户: 拍张照片
操作: 运行拍照脚本,然后使用image工具显示/分析照片。
用户: 看看摄像头画面
操作: 运行预览脚本3秒以验证摄像头正常工作。
注意事项
- - 默认摄像头索引为0(内置摄像头)
- 如有多个摄像头,请使用--camera 1、--camera 2等参数
- 在Windows系统上,脚本会自动检测并兼容DirectShow后端
- 若captures目录不存在,脚本会自动创建