[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EFQCC0PXWDCKCTQDSGVRYB":3,"skill-same:01M6EFQCC0PXWDCKCTQDSGVRYB":50},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":23,"linkOnly":24,"markdownContent":25,"markdownBody":25,"frontMatter":26,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M6EFQCC0PXWDCKCTQDSGVRYB","opencv",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fopencv\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",[5],"2026-11-10 10:12:30",false,"# OpenCV — Computer Vision Library\n\nYou are an expert in OpenCV (Open Source Computer Vision Library), the most popular library for real-time computer vision. You help developers build image processing pipelines, object detection systems, video analysis tools, augmented reality, and document processing using OpenCV's 2,500+ algorithms for image manipulation, feature detection, camera calibration, 3D reconstruction, and DNN inference — in Python, C++, or JavaScript.\n\n## Core Capabilities\n\n### Image Processing\n\n```python\nimport cv2\nimport numpy as np\n\n# Read and display\nimg = cv2.imread(\"photo.jpg\")\ngray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n\n# Resize\nresized = cv2.resize(img, (800, 600))\n# Or maintain aspect ratio\nscale = 800 \u002F img.shape[1]\nresized = cv2.resize(img, None, fx=scale, fy=scale)\n\n# Blur (noise reduction)\nblurred = cv2.GaussianBlur(img, (5, 5), 0)\nmedian = cv2.medianBlur(img, 5)           # Better for salt-and-pepper noise\n\n# Edge detection\nedges = cv2.Canny(gray, 50, 150)\n\n# Thresholding\n_, binary = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)\nadaptive = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\n                                  cv2.THRESH_BINARY, 11, 2)\n\n# Morphological operations\nkernel = np.ones((5, 5), np.uint8)\ndilated = cv2.dilate(binary, kernel, iterations=1)\neroded = cv2.erode(binary, kernel, iterations=1)\nopened = cv2.morphologyEx(binary, cv2.MORPH_OPEN, kernel)   # Remove noise\nclosed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel)  # Fill gaps\n```\n\n### Object Detection (DNN Module)\n\n```python\n# YOLO inference with OpenCV DNN\nnet = cv2.dnn.readNetFromONNX(\"yolov8n.onnx\")\n\ndef detect_objects(image, conf_threshold=0.5):\n    \"\"\"Detect objects using YOLOv8 with OpenCV DNN backend.\n\n    Args:\n        image: BGR image (numpy array)\n        conf_threshold: Minimum confidence to keep detection\n\n    Returns:\n        List of (class_id, confidence, x, y, w, h) tuples\n    \"\"\"\n    blob = cv2.dnn.blobFromImage(image, 1\u002F255.0, (640, 640), swapRB=True, crop=False)\n    net.setInput(blob)\n    outputs = net.forward(net.getUnconnectedOutLayersNames())\n\n    detections = []\n    h, w = image.shape[:2]\n\n    for output in outputs:\n        for detection in output[0]:\n            scores = detection[4:]\n            class_id = np.argmax(scores)\n            confidence = scores[class_id]\n\n            if confidence > conf_threshold:\n                cx, cy, bw, bh = detection[:4]\n                x = int((cx - bw\u002F2) * w \u002F 640)\n                y = int((cy - bh\u002F2) * h \u002F 640)\n                detections.append((class_id, float(confidence), x, y, int(bw*w\u002F640), int(bh*h\u002F640)))\n\n    return detections\n```\n\n### Video Processing\n\n```python\n# Real-time video processing\ncap = cv2.VideoCapture(0)                  # Webcam\n# cap = cv2.VideoCapture(\"video.mp4\")     # File\n\n# Output video\nfourcc = cv2.VideoWriter_fourcc(*\"mp4v\")\nout = cv2.VideoWriter(\"output.mp4\", fourcc, 30.0, (640, 480))\n\nwhile cap.isOpened():\n    ret, frame = cap.read()\n    if not ret:\n        break\n\n    # Process frame\n    processed = cv2.GaussianBlur(frame, (15, 15), 0)\n    edges = cv2.Canny(frame, 50, 150)\n\n    # Draw detections\n    for cls, conf, x, y, w, h in detect_objects(frame):\n        cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)\n        cv2.putText(frame, f\"{CLASSES[cls]} {conf:.2f}\", (x, y-10),\n                    cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)\n\n    out.write(frame)\n    cv2.imshow(\"Detection\", frame)\n    if cv2.waitKey(1) & 0xFF == ord(\"q\"):\n        break\n\ncap.release()\nout.release()\n```\n\n### Contours and Shape Detection\n\n```python\n# Find and analyze contours\ngray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n_, thresh = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)\ncontours, hierarchy = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n\nfor contour in contours:\n    area = cv2.contourArea(contour)\n    if area \u003C 100:                         # Skip small noise\n        continue\n\n    # Bounding box\n    x, y, w, h = cv2.boundingRect(contour)\n\n    # Shape approximation\n    peri = cv2.arcLength(contour, True)\n    approx = cv2.approxPolyDP(contour, 0.04 * peri, True)\n    sides = len(approx)\n\n    shape = \"circle\" if sides > 8 else {3: \"triangle\", 4: \"rectangle\"}.get(sides, \"polygon\")\n    cv2.drawContours(img, [contour], -1, (0, 255, 0), 2)\n    cv2.putText(img, shape, (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 0, 0), 2)\n```\n\n## Installation\n\n```bash\npip install opencv-python                  # Core + main modules\npip install opencv-contrib-python          # + extra modules (SIFT, face detection, tracking)\npip install opencv-python-headless         # Without GUI (for servers)\n```\n\n## Best Practices\n\n1. **BGR not RGB** — OpenCV loads images in BGR; convert with `cv2.cvtColor` when using with matplotlib or PIL\n2. **DNN for inference** — Use `cv2.dnn` for running YOLO, SSD, face detection; no PyTorch\u002FTF dependency needed\n3. **Preprocessing pipeline** — Resize → blur → convert → threshold → morphology → contours; order matters\n4. **Contour hierarchy** — Use `RETR_EXTERNAL` for outermost contours only; `RETR_TREE` for nested relationships\n5. **Video with codec** — Use `mp4v` for MP4, `XVID` for AVI; check codec availability on your platform\n6. **NumPy integration** — OpenCV images are NumPy arrays; use NumPy for fast pixel-level operations\n7. **Headless for servers** — Install `opencv-python-headless`; no X11\u002FGUI dependencies needed for processing pipelines\n8. **GPU acceleration** — Build from source with CUDA support for 10-50x speedup on GPU; or use `cv2.cuda` module\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fopencv",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill opencv",{"tool":42,"command":43},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill opencv",{"tool":45,"command":46},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill opencv","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fopencv\u002FSKILL.md",true,[],[51,63,73,82,88,95],{"skillNo":52,"name":53,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":59,"publishedAt":23},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[56],{"categoryNo":57,"categoryName":58,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[60,61,62],"model","model hierarchy","model hierarchy skill",{"skillNo":64,"name":65,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":69,"publishedAt":23},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[68],{"categoryNo":57,"categoryName":58,"taxonomyType":20,"taxonomyTypeDesc":21},[70,71,72],"MCP","zoom","zoom mcp",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":23},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[79,80,81,71],"sdk","zoom apps sdk","apps",{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":23},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[84],{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":94,"publishedAt":23},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[93],{"categoryNo":57,"categoryName":58,"taxonomyType":20,"taxonomyTypeDesc":21},[90],{"skillNo":96,"name":97,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":23},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[97]]