AGENT SKILL

opencv-grayscale

Convert images from RGB/BGR to grayscale using OpenCV and save in-place.

License 许可
MIT
最近更新
2026-10-02
Stars
★ 93
Forks
8

01 前言 Front Matter

name
opencv-grayscale
description
Convert images from RGB/BGR to grayscale using OpenCV and save in-place.

03 SKILL.md 正文

OpenCV Grayscale Conversion

Code

import cv2

img = cv2.imread("input.png")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imwrite("input.png", gray)  # overwrite in-place

Batch conversion

import cv2
import glob

for f in sorted(glob.glob("/root/keyframes_*.png")):
    img = cv2.imread(f)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    cv2.imwrite(f, gray)

04 同仓库更多 Skills