关于 farshid-mcp-imageProcessing
farshid-mcp-imageProcessing 是基于 OpenCV 的 MCP 服务,面向 VS Code Copilot Agent Mode 及其他 MCP 客户端,提供摄像头采集、图像操作、检测和视频处理工具。
主要功能
- 01摄像头采集与录制
- 02图像转换与变换
- 03颜色、滤镜与边缘处理
- 04轮廓检测与特征匹配
- 05人脸、眼睛、身体和二维码检测
- 06视频信息与帧提取
适用场景
- 01采集并调整摄像头图像尺寸
- 02为图像应用滤镜或检测边缘
- 03在图像中查找人脸或二维码
- 04从视频中提取帧
MCP 相关
它将 OpenCV 图像和视频处理能力作为工具提供给 MCP 客户端,并通过 stdio 通信。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
farshid-mcp-imageProcessing
面向 VS Code Copilot Agent Mode(或任何 MCP 客户端)的综合 OpenCV 图像处理 MCP 服务。提供约 40 种工具,涵盖网络摄像头捕获、图像 I/O、变换、颜色、滤波、边缘检测、阈值处理、形态学、轮廓/形状、特征匹配、对象检测(人脸/眼睛/身体/QR)、绘图、图像运算、模板匹配和视频处理。
- PyPI:
farshid-mcp-imageProcessing - MCP 注册表:
io.github.pirahansiah/farshid-mcp-imageProcessing - Python: 3.14+
- 操作系统: 最新版 Windows 11、最新版 macOS、最新主流 Linux(Ubuntu 24.04+/Fedora 41+)
安装(PyPI)
pip install farshid-mcp-imageProcessing
farshid-mcp-imageprocessing # runs the stdio MCP server
在 VS Code 中注册
将以下内容添加到用户或工作区的 mcp.json:
{
"servers": {
"imageProcessing": {
"command": "farshid-mcp-imageprocessing",
"type": "stdio"
}
}
}
或者,如果你克隆了此仓库,并想使用本地 .venv 从源码运行:
git clone https://github.com/pirahansiah/farshid-mcp-imageProcessing
cd farshid-mcp-imageProcessing
# Windows (PowerShell):
py -3.14 -m venv .venv ; .\.venv\Scripts\Activate.ps1
# macOS / Linux:
python3.14 -m venv .venv && source .venv/bin/activate
pip install -U pip
pip install -e .
此项目使用 opencv-contrib-python,以便使用捆绑的 Haar 级联分类器和额外算法。
快速开始:/cv Copilot 提示词
此仓库附带一个工作区提示词文件: .github/prompts/cv.prompt.md。在 VS Code Copilot Chat(Agent 模式)中输入:
/cv take image from webcam and save it as gray scale 240 * 240
Agent 将调用此服务中的 webcam_save、image_to_grayscale 和 image_resize,在 ./.farshid/cv/ 下生成所需文件。
工具目录
网络摄像头/捕获
webcam_capture(camera_index=0)→ 返回 PNG 图像webcam_save(output_path="", camera_index=0)webcam_preview(camera_index=0, seconds=10)(本地桌面窗口)webcam_record(output_path, seconds=5, camera_index=0, fps=20)
图像 I/O 与信息
image_show(path)— 将图像返回到聊天中image_info(path)— 形状、dtype、均值、文件大小image_convert(input_path, output_path, quality=95)
几何变换
image_resize(... width|height|scale, interpolation)image_crop(input_path, output_path, x, y, width, height)image_rotate(input_path, output_path, angle, scale=1, keep_size=False)image_flip(input_path, output_path, direction)image_pad(... top, bottom, left, right, border_type, color)
颜色
image_to_grayscalecolor_convert(target=gray|hsv|hls|lab|ycrcb|rgb|bgr)adjust_brightness_contrasthistogram_equalize(method=clahe|global)histogram_data(bins=32)
滤波
blur_gaussian(ksize, sigma)blur_median(ksize)blur_bilateral(d, sigma_color, sigma_space)sharpen(amount)denoise(strength)
边缘/梯度
edges_canny(threshold1, threshold2)edges_sobel(ksize)edges_laplacian(ksize)
阈值处理与形态学
threshold(method=otsu|binary|binary_inv|adaptive_mean|adaptive_gaussian)morphology(op=erode|dilate|open|close|gradient|tophat|blackhat)
轮廓与形状
find_contours(input_path, output_path?, thresh, min_area)detect_circles(...)— Houghdetect_lines(...)— 概率 Houghdetect_corners(...)— Shi-Tomasi
特征匹配
feature_match(image1, image2, output_path?)— ORB + BFMatcher
对象检测(Haar)
detect_facesdetect_eyesdetect_bodiesdetect_qrcode
绘图
draw_rectangle、draw_circle、draw_line、draw_text
合成/运算
image_blend(image1, image2, output_path, alpha)image_diff(image1, image2, output_path?)→ 平均/最大差异image_concat(images, output_path, direction)template_match(image_path, template_path, output_path?, threshold)
视频
video_info(path)video_extract_frames(video_path, output_dir, every_n, max_frames, ext)video_thumbnail(video_path, output_path, time_seconds)
构建与发布
pip install -U build twine mcp-publisher
python -m build
twine upload dist/*
mcp-publisher login github
mcp-publisher publish .mcp/server.json
操作系统说明
- Windows 11(最新版本): 摄像头开箱即用;请确保 设置 → 隐私和安全性 → 摄像头 → 允许桌面应用访问你的摄像头 已设为开。
- macOS(最新版本): 首次调用摄像头时会触发系统摄像头权限提示;请向终端/VS Code 进程授予权限。
- Linux(最新版本): 需要可正常工作的
/dev/video*设备。没有显示器的无头服务器无法使用webcam_preview(它会打开一个 OpenCV 窗口)。
说明
- 请勿在工具函数中使用
print():stdout 是 MCP 协议通道。请使用sys.stderr(server.py底部的_log辅助函数)。 webcam_preview会打开真实的桌面窗口——仅在服务具有显示器的环境中有效(不能通过纯 SSH 或在无头容器中使用)。- 所有路径均支持
~展开。输出目录会自动创建。 - 返回带注释图像的工具接受可选的
output_path;省略时只返回 JSON 元数据。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。