opencv
Skill15 starsChanged 43 days agoMITView on GitHub
Expert OpenCV assistance covering computer vision, image filtering, edge detection, contour analysis, and real-time video processing. Use when processing visual data, building camera pipelines, or object detection.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- MarieLynneBlock/arcanum-artifextheir own version, first seen Nov 1, 2026
- Ronnasayd/aipptheir own version, first seen Oct 20, 2026
- ZeroTokenClaw/agents-skillstheir own version, first seen Sep 21, 2026
- amariwan/facetraktheir own version, first seen Jun 11, 2026
- tondevrel/scientific-agent-skillstheir own version, first seen Feb 1, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- tondevrel/scientific-agent-skills★ 22same name
- MarieLynneBlock/arcanum-artifex★ 4same name
- Ronnasayd/aipp★ 1same name
- ZeroTokenClaw/agents-skills★ 1same name
- amariwan/facetrak★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- service-meshSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 143
Always release hardware resources (cap.release()) and destroy windows (cv2.destroyAllWindows()).
- Distinctive: line 144
Use HSV or LAB color spaces rather than RGB when performing color-based segmentation under varying lighting.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OpenCV
OpenCV (Open Source Computer Vision Library) is the standard library for real-time computer vision, image processing, camera calibration, and deep learning model inference.
When to Use
- Real-Time Computer Vision & Video Processing: Frame-by-frame analysis of camera feeds, robotics, and industrial automation.
- Image Preprocessing for Deep Learning: Resizing, normalizing, thresholding, and color-space conversions.
- Edge, Contour & Shape Detection: Canny edge detection, Hough transforms, and bounding box polygon calculations.
- Feature Matching & Homography: Aligning perspectives and matching keypoints with ORB and SIFT.
Quick Start
import cv2
# Load image, convert to grayscale, apply Gaussian blur and Canny edge detection
img = cv2.imread("input.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
edges = cv2.Canny(blurred, threshold1=50, threshold2=150)
cv2.imwrite("edges.jpg", edges)Core Concepts
Image Preprocessing, Thresholding & Contours
Detecting object shapes and drawing bounding boxes:
import cv2
import numpy as np
# Load image in grayscale
image = cv2.imread('circuit_board.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Apply Gaussian blur to reduce high-frequency noise
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
# Canny edge detection
edges = cv2.Canny(blurred, threshold1=50, threshold2=150)
# Find contours in the binary edge image
contours, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
output = image.copy()
for cnt in contours:
area = cv2.contourArea(cnt)
if area > 100: # Filter small noise specks
x, y, w, h = cv2.boundingRect(cnt)
cv2.rectangle(output, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.putText(output, f"Area: {int(area)}", (x, y - 5), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
cv2.imwrite('detected_components.jpg', output)Color Space Filtering with HSV Masking
Isolating colored objects independent of scene brightness:
# Convert to Hue-Saturation-Value (HSV)
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
# Define range for blue color in HSV
lower_blue = np.array([100, 150, 50])
upper_blue = np.array([140, 255, 255])
# Threshold image to obtain binary mask
mask = cv2.inRange(hsv, lower_blue, upper_blue)
# Bitwise-AND mask and original image
blue_segmented = cv2.bitwise_and(image, image, mask=mask)
cv2.imwrite('blue_segmented.jpg', blue_segmented)Video Stream Processing Loop
Reading frames continuously from a camera feed or video file:
cap = cv2.VideoCapture(0) # 0 = default webcam
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
# Process frame
gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('Live Monitor', gray_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()Common Patterns
Real-Time Video Stream Processing with FPS Throttling
Problem: Processing high-resolution webcam frames in Python causes frame buffering lag.
Solution: Process frames in a tight loop with resolution resizing:
cap = cv2.VideoCapture(0)
# Set capture resolution
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
while cap.isOpened():
ret, frame = cap.read()
if not ret: break
# Process frame
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('Live Stream', gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()Best Practices
Do:
- Remember OpenCV stores images in BGR format by default; convert with
cv2.COLOR_BGR2RGBbefore Matplotlib/PyTorch. - Always release hardware resources (
cap.release()) and destroy windows (cv2.destroyAllWindows()). - Use HSV or LAB color spaces rather than RGB when performing color-based segmentation under varying lighting.
- Apply Gaussian or bilateral blurring prior to edge detection to suppress noise.
Don't:
- Perform heavy deep learning inferences sequentially inside the video capture loop; use background threads.
- Hardcode kernel sizes with even numbers; blurring and morphological kernels should be odd (e.g. 3x3, 5x5).
- Assume
cv2.imread()succeeded without checking if the returned array is notNone.
Troubleshooting
| Error | Cause | Solution |
cv2.error: (-215:Assertion failed) !ssize.empty() | cv2.imread() returned None because file path was wrong. | Verify image file exists at specified path and is non-empty. |
OpenCV: FFMPEG: tag 0x... is not supported with codec | Incompatible video codec FourCC code during VideoWriter initialization. | Use cv2.VideoWriter_fourcc(*'mp4v') for MP4 video output. |
Color distortion in exported image | Displaying or saving BGR image as RGB (OpenCV default is BGR). | Convert color space with cv2.cvtColor(img, cv2.COLOR_BGR2RGB). |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

