plugins/python-master/skills/python-opencv/SKILL.md
Complete OpenCV computer vision system for Python. PROACTIVELY activate for: (1) Image loading with cv2.imread (BGR format gotcha), (2) Video capture with cv2.VideoCapture, (3) Color space conversion (BGR to RGB, HSV, grayscale), (4) Image filtering (GaussianBlur, medianBlur, bilateralFilter), (5) Edge detection (Canny), (6) Contour detection with cv2.findContours, (7) Image resizing with interpolation methods, (8) Template matching, (9) Feature detection (SIFT, ORB, AKAZE), (10) Drawing functions (rectangle, circle, text), (11) Video writing with cv2.VideoWriter, (12) Morphological operations, (13) Deep learning with cv2.dnn module, (14) GPU acceleration with cv2.cuda, (15) Coordinate system (x,y vs row,col) gotchas. Provides: Image processing patterns, video capture/writing, memory management, performance optimization, Jupyter notebook workarounds. Ensures correct BGR handling and memory-safe OpenCV usage.
npx skillsauth add JosiahSiegel/claude-plugin-marketplace python-opencvInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Function | Purpose | Gotcha |
|----------|---------|--------|
| cv2.imread(path) | Load image | Returns None if path invalid (no error!) |
| cv2.imwrite(path, img) | Save image | Expects BGR, not RGB |
| cv2.cvtColor(img, code) | Color conversion | BGR is default, not RGB |
| cv2.VideoCapture(src) | Video/camera input | Always check isOpened() and release() |
| cv2.VideoWriter(...) | Save video | Expects BGR frames, codec matters |
| cv2.resize(img, (w, h)) | Resize image | Size is (width, height), not (height, width) |
| Coordinate System | Order | Usage |
|-------------------|-------|-------|
| NumPy indexing | img[row, col] = img[y, x] | Pixel access |
| Image shape | (height, width, channels) | Shape is (rows, cols, ch) |
| OpenCV functions | (x, y) | Drawing functions |
| Resize/ROI | (width, height) | Size parameters |
| Color Conversion | Code | Note |
|------------------|------|------|
| BGR to RGB | cv2.COLOR_BGR2RGB | For Matplotlib display |
| BGR to Gray | cv2.COLOR_BGR2GRAY | Single channel output |
| BGR to HSV | cv2.COLOR_BGR2HSV | H: 0-179, S/V: 0-255 |
| Interpolation | Best For | Speed |
|---------------|----------|-------|
| INTER_NEAREST | Speed, pixelated OK | Fastest |
| INTER_LINEAR | General purpose (default) | Fast |
| INTER_AREA | Downscaling | Medium |
| INTER_CUBIC | Upscaling quality | Slow |
| INTER_LANCZOS4 | Best upscaling | Slowest |
Use for computer vision and image processing:
Related skills:
python-fundamentals-313python-asynciopython-type-hintsOpenCV (Open Source Computer Vision Library) is the most popular computer vision library. Python bindings (opencv-python) provide access to all functionality through NumPy arrays. OpenCV uses BGR color format by default, which is a critical gotcha.
# CPU-only (most common)
pip install opencv-python
# With contrib modules (SIFT, SURF, extra features)
pip install opencv-contrib-python
# Headless (no GUI, for servers)
pip install opencv-python-headless
# Verify installation
python -c "import cv2; print(cv2.__version__)"
cv2.imwrite.(height, width, channels), NumPy indexing is img[row, col], but OpenCV drawing functions use (x, y).cv2.imread returns None on missing or undecodable files; always check before using the image.VideoCapture and GUI windows must be released/closed in finally or context-manager cleanup paths.uint8; use OpenCV arithmetic or explicit float normalization when needed.Read references/opencv-critical-gotchas.md for the full preserved examples and safe patterns.
The detailed API patterns and code recipes have been split into focused references. Load the file that matches the user's task.
Read this for full examples of the most common OpenCV failure modes:
cv2.imwrite usagecv2.imread None checks and pathlib validationVideoCapture release patterns and context-manager wrapperuint8 overflow, cv2.add, float normalization, Canny dtype expectationsRead this for everyday OpenCV work:
cv2.imread flags, loading from URLs, cv2.imwrite quality params, multi-image batch loadingVideoWriter codecs (mp4v, XVID, H264), FPS/resolution probingfindContours, area/perimeter, bounding boxes, contour approximation, hierarchycv2.matchTemplate, multi-scale matching, TM_CCOEFF_NORMED thresholdingcv2.dnn.readNet for ONNX/TF/Caffe, blob preprocessing, YOLO/MobileNet inferencecv2.imshow + waitKey loops, Jupyter cv2.imshow workaround with Matplotlibcv2.UMat for OpenCL, cv2.cuda GPU operationsRead this for specialized computer-vision pipelines:
undistortcv2.Stitcher panorama assemblyThis skill should activate when the user mentions any of: OpenCV, cv2, BGR, image processing, contours, Canny, Hough transform, template matching, ORB/SIFT/AKAZE, VideoCapture, VideoWriter, cv2.dnn, cv2.cuda, computer vision in Python.
development
Use for Clerk sessions, tokens, webhooks, orgs, and security. PROACTIVELY activate for session tokens, JWT templates, getToken(), custom claims, pending sessions, multi-session UX, organizations, roles, permissions, system vs custom permissions, features/plans, MFA/passkeys/password policy/bot protection, Clerk webhooks, Svix signatures, verifyWebhook(), user/org sync, retries/replays, environment variables, custom domains, secret rotation, logs, and auth security reviews. Provides token semantics, webhook idempotency, authorization defaults, and hardening checklist.
tools
Use for Clerk in Next.js. PROACTIVELY activate for @clerk/nextjs setup, App Router auth()/currentUser(), clerkMiddleware(), proxy.ts/middleware.ts, createRouteMatcher(), protected pages/layouts/Route Handlers/Server Actions/API routes/tRPC, auth.protect() role/permission/token checks, ClerkProvider placement, server-only clerkClient, Link prefetch, redirects, 401/404 auth failures, custom domains, __clerk proxy paths, and deployment gotchas. Provides file patterns, server/client boundary rules, matcher templates, and production checks.
development
Use for Clerk frontend auth flows. PROACTIVELY activate for React, JavaScript, Vue, Nuxt, Astro, Expo, React Router, TanStack React Start, or SPA setup; ClerkProvider and publishable-key wiring; SignIn/SignUp/UserButton/UserProfile/OrganizationSwitcher; custom useUser/useAuth/useClerk/useSignIn/useSignUp/useSession/useOrganization flows; multi-session UX; cross-origin getToken() fetches; loading states, redirects, routing, CORS/cookies, or hydration bugs. Provides SDK selection, UI patterns, token-fetch templates, and frontend gotchas.
development
Use for Clerk dev/prod readiness, deployment, and multi-language implementation planning. PROACTIVELY activate for environment variables, pk_test/sk_test vs pk_live/sk_live, local dev, preview/staging/prod instances, domains/DNS, redirects, OAuth credentials, custom domains/proxy, authorizedParties, CSP, CORS/cookies, webhooks/tunnels, Vercel/Netlify/Cloudflare/API gateways, monitoring/troubleshooting, and backends in Node/Express/Fastify, Python/FastAPI/Django/Flask, Go, Ruby/Rails, Java/Spring, .NET, PHP/Laravel. Provides checklists, rollout plans, and language-portable patterns.