Skill: guyoung/opencv (version 1.0.0)

--- name: opencv description: Computer vision and image processing using OpenCV WebAssembly. Uses opencv-component.wasm running in openclaw-wasm-sandbox plugin. Supports image processing, object detection, feature extraction, panorama stitching, photo filters, camera calibration, and ML. 图像处理、OpenCV、目标检测、特征提取、图像拼接、相机标定、机器学习 --- # OpenCV Computer Vision Skill Comprehensive computer vision and image processing using OpenCV WebAssembly. ## Trigger When 使用此技能的场景： - **图像处理 / Image Process**：resize（调整大小）、blur（模糊）、threshold（阈值）、morphology（形态学）、sharpen（锐化）、crop（裁剪）、stats（统计） - **目标检测 / Detection**：cascade（级联检测）、dnn/YOLO（深度学习检测）、hog、contour（轮廓）、circle（圆检测）、line（直线检测） - **特征提取 / Features**：orb、sift、akaze、match（特征匹配）、homography（单应性）、optflow（光流）、template（模板匹配） - **图像拼接 / Stitching**：panorama（全景拼接）、stitch（多图拼接，扫描件模式） - **照片处理 / Photo**：denoise（降噪）、inpaint（修复）、stylize（风格化）、hdr、pencil（素描）、detail（细节增强） - **相机标定 / Calibration**：chessboard（棋盘格）、undistort（去畸变）、corners（亚像素角点）、pose（位姿估计） - **机器学习 / ML**：train-knn（训练KNN）、train-svm（训练SVM）、predict（预测）、kmeans（聚类） - **批处理 / Batch**：batch-process（批量处理）、batch-convert（格式转换）、batch-stats（批量统计），支持多线程 ## Prerequisites - **Required plugin:** `openclaw-wasm-sandbox` - **WASM file:** `~/.openclaw/skills/opencv/files/opencv-component.wasm` - Download if missing: ```bash openclaw wasm-sandbox download \ "https://raw.githubusercontent.com/guyoung/wasm-sandbox-openclaw-skills/main/opencv/files/opencv-component.wasm" \ "~/.openclaw/skills/opencv/files/opencv-component.wasm" ``` ## Tool Use `wasm-sandbox-run` tool with the WASM file: ```javascript wasm-sandbox-run({ wasmFile: "~/.openclaw/skills/opencv/files/opencv-component.wasm", args: ["<operation>", ...args] }) ``` For file access, use `workDir` or `mapDir` to expose directories to the sandbox. ## Operations Overview | Category | Operations | |----------|-----------| | **Image Process** | resize, blur, threshold, morphology, sharpen, crop, stats | | **Detection** | cascade, dnn (YOLO), hog, contour, circle, line | | **Features** | orb, sift, akaze, match, homography, optflow, template | | **Stitching** | panorama, stitch | | **Photo** | denoise, inpaint, stylize, hdr, pencil, detail | | **Calibration** | chessboard, undistort, corners, pose | | **ML** | train-knn, train-svm, predict, kmeans | | **Batch** | batch-process, batch-convert, batch-stats | ## Detailed Usage See [references/operations.md](references/operations.md) for complete operation reference with arguments, examples, and sandbox notes.

path: references/operations.md
content: # OpenCV WASM Operations Reference

Complete reference for all operations supported by `opencv-component.wasm`.

## Tool Usage

**Important:** Use `--` separator to pass arguments directly to the component:

```javascript
wasm-sandbox-run({
  wasmFile: "~/.openclaw/skills/opencv/files/opencv-component.wasm",
  args: ["--", "<command>", "<subcommand>", "-i", "image.jpg", "-o", "out.jpg", ...options]
})
```

The `--` tells wasm-sandbox-run to pass all following arguments directly to the component.

For file access, map directories:
```javascript
wasm-sandbox-run({
  wasmFile: "~/.openclaw/skills/opencv/files/opencv-component.wasm",
  args: ["--", "process", "resize", "-i", "input.jpg", "-o", "out.jpg", "--width", "800", "--height", "600"],
  workDir: "/path/to/images"
})
```

---

## Image Process (`process`)

### resize
```
args: ["process", "resize", "--input", "<input>", "--output", "<output>", "--width", "<px>", "--height", "<px>"]
```
Options: `--interp` (nearest|linear|cubic|lanczos, default: linear)

### grayscale
```
args: ["process", "grayscale", "--input", "<input>", "--output", "<output>"]
```

### blur
```
args: ["process", "blur", "--input", "<input>", "--output", "<output>", "--ksize", "<odd_number>"]
```

### median
```
args: ["process", "median", "--input", "<input>", "--output", "<output>", "--ksize", "<odd_number>"]
```

### bilateral
```
args: ["process", "bilateral", "--input", "<input>", "--output", "<output>"]
```

### canny
```
args: ["process", "canny", "--input", "<input>", "--output", "<output>"]
```

### sobel
```
args: ["process", "sobel", "--input", "<input>", "--output", "<output>"]
```

### rotate
```
args: ["process", "rotate", "--input", "<input>", "--output", "<output>", "--angle", "<degrees>"]
```

### flip
```
args: ["process", "flip", "--input", "<input>", "--output", "<output>", "--mode", "<0|1|-1>"]
```

### threshold
```
args: ["process", "threshold", "--input", "<input>", "--output", "<output>", "--thresh", "<0-255>", "--maxval", "<0-255>"]
```

### morphology
```
args: ["process", "morphology", "--input", "<input>", "--output", "<output>", "--op", "<erode|dilate|open|close|gradient>"]
```

### adjust
```
args: ["process", "adjust", "--input", "<input>", "--output", "<output>", "--alpha", "<contrast>", "--beta", "<brightness>"]
```

### equalize
```
args: ["process", "equalize", "--input", "<input>", "--output", "<output>"]
```

### sharpen
```
args: ["process", "sharpen", "--input", "<input>", "--output", "<output>"]
```

### colorspace
```
args: ["process", "colorspace", "--input", "<input>", "--output", "<output>", "--space", "<BGR|HSV|GRAY|YUV>"]
```

### crop
```
args: ["process", "crop", "--input", "<input>", "--output", "<output>", "--x", "<px>", "--y", "<px>", "--width", "<px>", "--height", "<px>"]
```

### watermark
```
args: ["process", "watermark", "--input", "<input>", "--output", "<output>", "--text", "<text>"]
```

### perspective
```
args: ["process", "perspective", "--input", "<input>", "--output", "<output>", "--src", "<x1,y1,x2,y2,x3,y3,x4,y4>", "--dst", "<x1,y1,x2,y2,x3,y3,x4,y4>"]
```

### stats
```
args: ["process", "stats", "--input", "<input>"]
```

### grid
```
args: ["process", "grid", "--input", "<input>", "--output", "<output>", "--cols", "<n>", "--rows", "<n>"]
```

---

## Detection (`detect`)

### cascade
```
args: ["detect", "cascade", "--input", "<input>", "--output", "<output>", "--cascade", "<cascade_xml>"]
```

### dnn
```
args: ["detect", "dnn", "--input", "<input>", "--output", "<output>", "--model", "<model.onnx>"]
```

### hog
```
args: ["detect", "hog", "--input", "<input>", "--output", "<output>"]
```

### contour
```
args: ["detect", "contour", "--input", "<input>", "--output", "<output>"]
```

### circle
```
args: ["detect", "circle", "--input", "<input>", "--output", "<output>"]
```

### line
```
args: ["detect", "line", "--input", "<input>", "--output", "<output>"]
```

---

## Features (`feature`)

### orb
```
args: ["feature", "orb", "--input", "<input>", "--output", "<output>"]
```

### sift
```
args: ["feature", "sift", "--input", "<input>", "--output", "<output>"]
```

### akaze
```
args: ["feature", "akaze", "--input", "<input>", "--output", "<output>"]
```

### match
```
args: ["feature", "match", "--input", "<img1>", "--ref", "<img2>", "--output", "<output>"]
```

### homography
```
args: ["feature", "homography", "--input", "<img1>", "--ref", "<img2>", "--output", "<output>"]
```

### optflow
```
args: ["feature", "optflow", "--input", "<frame1>", "--ref", "<frame2>", "--output", "<output>"]
```

### template
```
args: ["feature", "template", "--input", "<input>", "--template", "<template>", "--output", "<output>"]
```

---

## Stitching (`stitch`)

```
args: ["stitch", "--inputs", "<img1>", "<img2>", "...", "--output", "<output>", "--mode", "<panorama|scans>"]
```

Example:
```javascript
wasm-sandbox-run({
  wasmFile: "~/.openclaw/skills/opencv/files/opencv-component.wasm",
  args: ["stitch", "--inputs", "left.jpg", "center.jpg", "right.jpg", "--output", "panorama.jpg", "--mode", "panorama"],
  workDir: "/path/to/images"
})
```

---

## Photo (`photo`)

### denoise
```
args: ["photo", "denoise", "--input", "<input>", "--output", "<output>"]
```

### inpaint
```
args: ["photo", "inpaint", "--input", "<input>", "--mask", "<mask>", "--output", "<output>"]
```

### stylize
```
args: ["photo", "stylize", "--input", "<input>", "--output", "<output>"]
```

### pencil
```
args: ["photo", "pencil", "--input", "<input>", "--output", "<output>"]
```

### detail
```
args: ["photo", "detail", "--input", "<input>", "--output", "<output>"]
```

### edge-preserve
```
args: ["photo", "edge-preserve", "--input", "<input>", "--output", "<output>"]
```

### hdr
```
args: ["photo", "hdr", "--input", "<input>", "--output", "<output>"]
```

### seamless-clone
```
args: ["photo", "seamless-clone", "--input", "<input>", "--mask", "<mask>", "--output", "<output>"]
```

### decolor
```
args: ["photo", "decolor", "--input", "<input>", "--output", "<output>"]
```

---

## Calibration (`calib`)

### chessboard
```
args: ["calib", "chessboard", "--input", "<input>", "--output", "<output>"]
```

### undistort
```
args: ["calib", "undistort", "--input", "<input>", "--output", "<output>"]
```

### corners
```
args: ["calib", "corners", "--input", "<input>", "--output", "<output>"]
```

---

## ML (`ml`)

### train-knn
```
args: ["ml", "train-knn", "--data", "<data_dir>", "--labels", "<labels_file>", "--output", "<model.xml>"]
```

### train-svm
```
args: ["ml", "train-svm", "--data", "<data.txt>", "--labels", "<labels.txt>", "--output", "<model.xml>"]
```

### predict
```
args: ["ml", "predict", "--model", "<model.xml>", "--input", "<test.jpg>"]
```

### kmeans
```
args: ["ml", "kmeans", "--input", "<input>", "--output", "<output>", "--clusters", "<K>"]
```

---

## Batch (`batch`)

### process
```
args: ["batch", "process", "--inputs", "<input_dir>", "--outputs", "<output_dir>", "--op", "<resize|blur|...>", "--width", "800", "--height", "600"]
```

### convert
```
args: ["batch", "convert", "--inputs", "<input_dir>", "--outputs", "<output_dir>", "--format", "<jpg|png|webp>"]
```

### stats
```
args: ["batch", "stats", "--inputs", "<input_dir>"]
```

---

## Info

```
args: ["info"]
```
Prints OpenCV build info and available modules.

---

## Global Options

| Option | Description |
|--------|-------------|
| `-v, --verbose` | Enable verbose/debug output |
| `-f, --format <FORMAT>` | Output format: text or json (default: text) |
| `-h, --help` | Print help |
| `-V, --version` | Print version |

---

## Sandbox Notes

- Input/output paths are relative to mapped `workDir`
- Use `--map-dir ./local::/guest` or `--work-dir` to expose directories
- Use `--wasm-timeout` for long operations on large images (recommended: 30+ seconds)
- No network access unless explicitly allowed with `--allowed-outbound-hosts`


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)