粒子图像测速分析服务

OpenPIV MCP Server 是一个提供粒子图像测速(PIV)分析的服务,通过MCP协议连接多种客户端,支持计算速度场和生成矢量场可视化。

  • by OpenPIV
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 OpenPIV/openpiv-mcp

使用说明


标题:OpenPIV MCP服务器 表情符号🌊 颜色来源:蓝色 颜色To:紫色 sdk:docker sdk版本:边缘 固定:false 许可证:mit

OpenPIV MCP服务器

通过MCP协议进行粒子图像测速(PIV)分析。

特性

  • 计算机piv:根据图像对计算速度场
  • create_twick_plot:生成矢量场可视化
  • 网页用户界面:用于上传图像和查看结果的交互式Gradio界面
  • MCP协议:连接到Claude Desktop、Cursor、Windsurf和其他MCP客户端

快速开始

选项1:本地MCP服务器(建议用于开发)

使用stdio传输在本地运行MCP服务器:

# Clone and install
git clone https://huggingface.co/spaces/alexliberzon/openpiv-mcp
cd openpiv-mcp
pip install -r requirements.txt

# Run the MCP server
python src/openpiv_mcp.py

Claude桌面配置 (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "openpiv": {
      "command": "python",
      "args": ["/absolute/path/to/openpiv-mcp/src/openpiv_mcp.py"]
    }
  }
}

选项2:拥抱面部空间(远程HTTP)

服务器部署在Hugging Face Spaces上,具有web UI和MCP端点:

  • 网页用户界面: https://alexliberzon-openpiv-mcp.hf.space
  • MCP端点: https://alexliberzon-openpiv-mcp.hf.space/gradio_api/mcp/

MCP客户端配置:

{
  "mcpServers": {
    "openpiv": {
      "url": "https://alexliberzon-openpiv-mcp.hf.space/gradio_api/mcp/"
    }
  }
}

注: 使用远程MCP服务器时,必须提供以下图像:

  • HTTP/HTTPS URL(例如。, https://example.com/image.png)
  • Base64数据URL(例如。, data:image/png;base64,iVBOR...)

选项3:仅限Web UI

访问https://alexliberzon-openpiv-mcp.hf.space要使用交互式web界面:

  1. 上传两个连续的帧(帧A和帧B)
  2. 调整参数(窗口大小、重叠、时间延迟)
  3. 点击“计算PIV”以获取速度场数据
  4. 使用“Quiver Plot”选项卡可视化结果

API 参考

计算机piv

从两幅图像计算粒子图像测速速度场。

参数:

  • image_a (str):图像URL、base64数据URL或文件路径(仅限本地)
  • image_b (str):图像URL、base64数据URL或文件路径(仅限本地)
  • window_size (int):询问窗口大小(默认值:32)
  • overlap (int):窗口之间的重叠(默认值:16)
  • dt (浮动):帧之间的时间延迟(默认值:1.0)

退货: 摘要统计信息和CSV文件路径

create_twick_plot

根据PIV结果创建箭袋(矢量场)图。

参数:

  • csv_file (str):PIV结果CSV文件的路径
  • title (str):绘图标题(默认:“PIV速度场”)
  • scale (int):Quiver比例因子(默认值:50)
  • cmap (str):颜色映射(默认值:“viridis”)

退货: PIL箭袋图图像

输出示例

**PIV computation successful!**

**Summary Statistics:**
- Total vectors computed: 660
- Valid vectors (s2n>1): 580
- Mean U velocity: -0.0814
- Max U velocity: 1.7142
- Max V velocity: 6.9067

本地测试

# Test with demo images
python -c "
from openpiv_client import compute_piv, create_quiver_plot
import asyncio

async def test():
    result = await compute_piv(
        image_a_path='demo/test1/exp1_001_a.bmp',
        image_b_path='demo/test1/exp1_001_b.bmp'
    )
    print(result)

asyncio.run(test())
"

许可证

MIT许可证