Opencv

From pipixia-labs/openteamwork · View interactive version

Opencv is an AI agent skill from the GitHub repository pipixia-labs/openteamwork. Use OpenCV for Python image processing, contour analysis, thresholding, filtering, geometric transforms, and basic video I/O. Trigger when the user asks to process images or video with cv2/OpenCV, or when a task clearly fits classical computer vision instead of a remote VLM.

How to use this skill

Skill file

OpenCV

Use this skill when the user wants local computer-vision work with OpenCV, especially:

Prefer this skill for deterministic image processing. If the task is mainly semantic understanding, captioning, or open-ended visual reasoning, consider an image-understanding expert instead of forcing OpenCV.

Workflow

  1. Confirm the real task type first: image enhancement, segmentation, contour extraction, geometry transform, or video I/O.
  2. Start with the smallest reproducible pipeline and save intermediate outputs when debugging.
  3. Use Python and import OpenCV as cv2 as cv unless the surrounding code clearly uses a different style.
  4. For image-processing tasks, prefer a simple pipeline such as read -> colorspace convert -> threshold or filter -> morphology or contours -> save result.
  5. For video tasks, check cap.isOpened(), check ret on every frame, and always release capture and writer objects.
  6. If parameter choices are unclear, expose them as function arguments instead of hard-coding many magic numbers.
  7. When the exact API behavior matters, read the relevant skill reference file before coding.

Reference Map

Read these skill-local references on demand instead of expanding the skill with long examples:

references/install.md

references/image-basics.md

references/threshold-and-contours.md

references/video-io.md

If a request goes beyond these references, keep the implementation conservative and prefer simple, well-known OpenCV APIs over speculative or heavyweight patterns.

Guardrails

Minimal Patterns

Read and threshold an image

import cv2 as cv

image = cv.imread(input_path, cv.IMREAD_COLOR)
if image is None:
    raise FileNotFoundError(input_path)

gray = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
_, binary = cv.threshold(gray, 0, 255, cv.THRESH_BINARY + cv.THRESH_OTSU)
cv.imwrite(output_path, binary)

Find outer contours

import cv2 as cv

image = cv.imread(input_path, cv.IMREAD_GRAYSCALE)
if image is None:
    raise FileNotFoundError(input_path)

_, binary = cv.threshold(image, 0, 255, cv.THRESH_BINARY + cv.THRESH_OTSU)
contours, _ = cv.findContours(binary, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)

Safe video loop

import cv2 as cv

cap = cv.VideoCapture(input_path)
if not cap.isOpened():
    raise RuntimeError(f"Cannot open video: {input_path}")

while True:
    ret, frame = cap.read()
    if not ret:
        break
    # process frame here

cap.release()
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.