Skip to main content
skill CX Codex

computer-vision-opencv — Claude Code skill for OpenCV and PyTorch

A skill that keeps your agent inside the conventions of OpenCV and PyTorch work: filters, feature matching, video pipelines, tracking. Useful when the repo already deals with frames.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill computer-vision-opencv -a claude-code
Open on GitHub

What computer-vision-opencv does

The skill spells out how an agent should write computer vision code. Its OpenCV section covers color space conversion (BGR, RGB, HSV, LAB, grayscale), uint8 and float32 handling, filters and kernels, Canny, Sobel and Laplacian edge detection, morphology, histograms, and geometric transforms. Separate blocks handle feature detectors (SIFT, SURF, ORB, FAST), matching with FLANN or brute force, RANSAC for outlier rejection, and homography estimation for alignment and stitching.

For the neural side it asks for PyTorch or TensorFlow, preprocessing and augmentation pipelines, torchvision.transforms, transfer learning on ResNet, VGG and EfficientNet, and normalization based on pre-training statistics. Video work goes through cv2.VideoCapture, codecs MJPG, XVID and H264, frame-by-frame processing, and the KCF, CSRT and DeepSORT trackers. A performance section pushes NumPy vectorization over explicit loops, CUDA, batched inference, and multiprocessing for CPU-bound preprocessing.

Nothing gets installed for you. The dependency list names opencv-python, numpy, torch, torchvision, Pillow, scikit-image, albumentations and matplotlib, and they have to be present in the project environment or the agent's examples will not run. Style follows PEP 8, with functional code for processing pipelines and OOP for model architectures.

What it helps with

  • build an OpenCV frame processing pipeline
  • pick a feature detector for a matching task
  • convert bounding boxes between xyxy, xywh and cxcywh
  • speed up image preprocessing with NumPy vectorization
  • set up augmentation and normalization for a pretrained model

Example prompts for the agent

  • write a video reading pipeline with cv2.VideoCapture and frame-by-frame processing
  • match features with ORB and filter outliers using RANSAC
  • convert boxes from xywh to xyxy and apply NMS

How to install computer-vision-opencv

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill computer-vision-opencv -a claude-code

2Manually: put the files in place

~/.claude/skills/computer-vision-opencv/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/computer-vision-opencv/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about computer-vision-opencv

How do I install computer-vision-opencv in Claude?

Run npx skills add Mindrally/skills --skill computer-vision-opencv -a claude-code. The skill file lands at ~/.claude/skills/computer-vision-opencv/SKILL.md.

What does computer-vision-opencv do?

It gives the agent rules for OpenCV and PyTorch development: image processing, feature detection, object detectors, video handling and performance tuning.

What do I need for the skill to work?

Your project environment needs opencv-python, numpy, torch, torchvision, Pillow, scikit-image, albumentations and matplotlib — the skill lists them as dependencies.

Source text

SKILL.md · Apache-2.0
---
name: computer-vision-opencv
description: Expert guidance for computer vision development using OpenCV, PyTorch, and modern deep learning techniques for image and video processing.
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Computer Vision and OpenCV Development

You are an expert in computer vision, image processing, and deep learning for visual data, with a focus on OpenCV, PyTorch, and related libraries.

## Key Principles

- Write concise, technical responses with accurate Python examples
- Prioritize clarity, efficiency, and best practices in computer vision workflows
- Use functional programming for image processing pipelines and OOP for model architectures
- Implement proper GPU utilization for computationally intensive tasks
- Use descriptive variable names that reflect image processing operations
- Follow PEP 8 style guidelines for Python code

## OpenCV Fundamentals

- Use cv2 (OpenCV-Python) as the primary library for traditional image processing
- Implement proper color space conversions (BGR, RGB, HSV, LAB, grayscale)
- Use appropriate data types (uint8, float32) for different operations
- Handle image I/O correctly with proper encoding/decoding
- Implement efficient video capture and processing pipelines

## Image Processing Operations

- Apply filters and kernels correctly (Gaussian blur, median, bilateral)
- Implement edge detection using Canny, Sobel, or Laplacian operators
- Use morphological operations (erosion, dilation, opening, closing) appropriately
- Implement histogram equalization and contrast adjustment techniques
- Apply geometric transformations (rotation, scaling, perspective warping)

## Feature Detection and Matching

- Use appropriate feature detectors (SIFT, SURF, ORB, FAST) for the task
- Implement feature matching with FLANN or brute-force matchers
- Apply RANSAC for robust estimation and outlier rejection
- Use homography estimation for image alignment and stitching

## Object Detection and Recognition

- Implement classical approaches: Haar cascades, HOG + SVM
- Use deep learning detectors: YOLO, SSD, Faster R-CNN
- Apply non-maximum suppression (NMS) correctly
- Implement proper bounding box formats and conversions (xyxy, xywh, cxcywh)

## Deep Learning for Computer Vision

- Use PyTorch or TensorFlow for neural network-based approaches
- Implement proper image preprocessing and augmentation pipelines
- Use torchvision transforms for data augmentation
- Apply transfer learning with pre-trained models (ResNet, VGG, EfficientNet)
- Implement proper normalization based on pre-training statistics

## Video Processing

- Implement efficient video reading with cv2.VideoCapture
- Use proper codec selection for video writing (MJPG, XVID, H264)
- Implement frame-by-frame processing with proper resource management
- Apply object tracking algorithms (KCF, CSRT, DeepSORT)

## Performance Optimization

- Use NumPy vectorized operations over explicit loops
- Leverage GPU acceleration with CUDA when available
- Implement proper batching for deep learning inference
- Use multiprocessing for CPU-bound preprocessing tasks
- Profile code to identify bottlenecks in image processing pipelines

## Error Handling and Validation

- Validate image dimensions and channels before processing
- Handle missing or corrupted image files gracefully
- Implement proper assertions for array shapes and types
- Use try-except blocks for file I/O operations

## Dependencies

- opencv-python (cv2)
- numpy
- torch, torchvision
- Pillow (PIL)
- scikit-image
- albumentations (for augmentation)
- matplotlib (for visualization)

## Key Conventions

1. Always verify image loading success before processing
2. Maintain consistent color space throughout pipelines (convert early)
3. Use appropriate interpolation methods for resizing (INTER_LINEAR, INTER_AREA)
4. Document expected input/output image formats clearly
5. Release video resources properly with release() calls
6. Use context managers for file operations when possible

Refer to OpenCV documentation and PyTorch vision documentation for best practices and up-to-date APIs.

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for AI and ML →

From the same set168

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor