图像预处理服务 - 下载图像并返回几何分析结果,用于下游 LLM 规划
健康检查接口,用于监控服务状态
{"status": "ok"}
图像预处理分析 - 分析图像中的颜色组和几何形状
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| image_url | string | 是 | 需要分析的图像 URL |
{
"image_url": "https://example.com/image.png"
}
| 字段 | 类型 | 说明 |
|---|---|---|
| success | boolean | 是否成功 |
| image_meta | object | 图像元信息 |
| └─ source_url | string | 图像来源 URL |
| └─ width_px | integer | 图像宽度(像素) |
| └─ height_px | integer | 图像高度(像素) |
| └─ color_mode | string | 颜色模式(如 RGB/RGBA) |
| └─ mime_type | string | MIME 类型 |
| connectivity | integer | 连通区域数量 |
| color_group_count | integer | 颜色组数量 |
| color_groups | array[object] | 颜色组详细信息列表 |
| └─ group_id | integer | 颜色组 ID |
| └─ rgb | object | RGB 颜色值 |
| └─ r | integer | 红色通道 (0-255) |
| └─ g | integer | 绿色通道 (0-255) |
| └─ b | integer | 蓝色通道 (0-255) |
| └─ pixel_count | integer | 像素数量 |
| └─ percentage | float | 占比百分比 |
| └─ center_px | object | 中心点坐标 |
| └─ x | float | X 坐标 |
| └─ y | float | Y 坐标 |
| └─ radius_px | float | 半径(像素) |
| └─ bbox | object | 边界框 |
| └─ left | integer | 左边界 |
| └─ top | integer | 上边界 |
| └─ right | integer | 右边界 |
| └─ bottom | integer | 下边界 |
| └─ width | integer | 宽度 |
| └─ height | integer | 高度 |
| └─ is_background | boolean | 是否为背景 |
| └─ source_type | string | 源类型 |
| └─ geometry | object|null | 几何信息(根据类型不同字段不同) |
| └─ type | string | 几何类型 (circle/rectangle/line/polyline) |
| └─ center | object|null | 中心点 {x, y} |
| └─ radius_px | float|null | 半径(圆形) |
| └─ width_px | float|null | 宽度(矩形) |
| └─ height_px | float|null | 高度(矩形) |
| └─ length_px | float|null | 长度(线段) |
| └─ thickness_px | float|null | 粗细(线段) |
| └─ endpoint_1 | object|null | 端点1 {x, y} |
| └─ endpoint_2 | object|null | 端点2 {x, y} |
| └─ corners | array[object]|null | 角点列表 [{x, y}] |
| └─ polyline_points | array[object]|null | 折线点列表 [{x, y}] |
| notes | array[string] | 处理备注字符串列表 |
{
"success": true,
"image_meta": {
"source_url": "https://example.com/image.png",
"width_px": 800,
"height_px": 600,
"color_mode": "RGB",
"mime_type": "image/png"
},
"connectivity": 5,
"color_group_count": 3,
"color_groups": [
{
"group_id": 0,
"rgb": {"r": 255, "g": 0, "b": 0},
"pixel_count": 12500,
"percentage": 15.5,
"center_px": {"x": 400.5, "y": 300.2},
"radius_px": 45.3,
"bbox": {"left": 100, "top": 50, "right": 200, "bottom": 150, "width": 100, "height": 100},
"is_background": false,
"source_type": "circle",
"geometry": {
"type": "circle",
"center": {"x": 400.5, "y": 300.2},
"radius_px": 45.3
}
}
],
"notes": ["自动检测背景颜色", "发现 5 个连通区域"]
}
渲染路径图像 - 在背景图上绘制航点路径
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| image_url | string | 是 | 背景图像 URL |
| waypoints | array[object] | 是 | 航点列表 [{x, y, role}] |
| title | string | 否 | 图像标题 |
| coordinate_conversion | object | 否 | 坐标转换配置 |
{
"image_url": "https://example.com/map.png",
"waypoints": [
{"x": 100, "y": 200, "role": "start"},
{"x": 300, "y": 400, "role": "end"}
],
"title": "路径规划"
}
| 字段 | 类型 | 说明 |
|---|---|---|
| success | boolean | 是否成功 |
| image_url | string | 渲染后的图像 URL(可直接访问) |
| image_path | string | 图像在服务器上的本地路径 |
| csv_url | string|null | 航点 CSV 文件 URL |
| csv_path | string|null | CSV 文件本地路径 |
| markdown_table | string|null | 航点 Markdown 表格字符串 |
| cached_source | boolean|null | 是否使用了缓存的源图像 |
| converted_waypoints | array[object]|null | 坐标转换后的航点列表 |
| └─ role | string | 航点角色 |
| └─ real | object | 实际坐标 |
| └─ x | float | X 坐标(实际单位) |
| └─ y | float | Y 坐标(实际单位) |
| conversion_unit | string|null | 坐标单位(如 mm/cm/m) |
{
"success": true,
"image_url": "http://localhost:18765/tmp/path_123456.png?v=20240101120000",
"image_path": "/app/tmp/path_123456.png",
"csv_url": "http://localhost:18765/tmp/waypoints_123456.csv?v=20240101120000",
"csv_path": "/app/tmp/waypoints_123456.csv",
"markdown_table": "| Role | X | Y |\n|------|---|---|\n| start | 100 | 200 |",
"cached_source": false,
"converted_waypoints": [
{"role": "start", "real": {"x": 10.5, "y": 20.3}},
{"role": "end", "real": {"x": 45.2, "y": 60.8}}
],
"conversion_unit": "mm"
}
curl -X POST http://localhost:18765/image/preprocess \
-H "Content-Type: application/json" \
-d '{"image_url": "https://example.com/image.png"}'
curl -X POST http://localhost:18765/render/path \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/map.png",
"waypoints": [
{"x": 100, "y": 200, "role": "start"},
{"x": 300, "y": 400, "role": "end"}
]
}'