去水印
自动识别并去除图片中的水印、Logo 等不需要的叠加元素,还原干净的图片背景;也可以指定区域直接去除。
创建任务
基本信息
| 项目 | 值 |
|---|
| 请求方法 | POST |
| 请求路径 | /task/image_purify |
| Content-Type | application/json |
| 鉴权方式 | Authorization 请求头(直接传 API Key) |
请求参数(Body)
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|
file_id | string | 是 | — | 已上传图片文件的 ID |
purify_scope | string | 否 | "full_screen" | 净化范围:full_screen(自动识别并去除)/ region(按 regions 给出的框直接去除) |
regions | array | region 时必填 | — | 要直接去除的区域,1–16 个框,每项 {"x","y","w","h"},为 0-1 画面比例,需 w>0、h>0、x+w≤1、y+h≤1 |
请求示例
curl -X POST https://api.ai-mcn.tv:10000/task/image_purify \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"file_id": "537489015178246"}'
region 模式示例(去除左上角的台标):
curl -X POST https://api.ai-mcn.tv:10000/task/image_purify \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file_id": "537489015178246",
"purify_scope": "region",
"regions": [{"x": 0.02, "y": 0.02, "w": 0.15, "h": 0.08}]
}'
region 模式不做识别,框内全部内容都会被处理(包括画面主体),适合深色台标、图形贴片这类识别不到的元素。框越小、越贴近要去除的元素,效果越好。
成功响应示例
{
"code": 200,
"msg": "success",
"data": {
"task_id": "537489015178247",
"task_type": "image_purify",
"status": "queued"
}
}
查询任务结果
基本信息
| 项目 | 值 |
|---|
| 请求方法 | GET |
| 请求路径 | /task/image_purify/{task_id} |
| 鉴权方式 | Authorization 请求头(直接传 API Key) |
响应参数(output_result)
| 参数名 | 类型 | 说明 |
|---|
file_id | string | 处理后的图片文件 ID |
成功响应示例
{
"code": 200,
"msg": "success",
"data": {
"task_id": "537489015178247",
"status": "completed",
"progress": 100,
"output_result": {
"file_id": "537489015178248"
},
"create_time": "2026-04-05T08:00:00Z",
"update_time": "2026-04-05T08:00:08Z"
}
}
错误码
| 错误码 | HTTP 状态码 | 说明 | 解决方案 |
|---|
6013 | 400 | file_id 缺失 | 传入 file_id 参数 |
6016 | 400 | purify_scope 非法,或 region 模式 regions 缺失或非法(为空、超过 16 个、坐标越界) | 检查 purify_scope / regions |
6014 | 400 | 文件类型与接口不匹配 | 传入图片文件 |
6004 | 404 | 文件不存在 | 检查 file_id 是否正确 |
6502 | 401 | 鉴权失败 | 检查 Authorization 请求头 |
6202 | 402 | 余额不足 | 前往仪表盘充值 |