去水印

自动识别并去除图片中的水印、Logo 等不需要的叠加元素,还原干净的图片背景;也可以指定区域直接去除。

创建任务

基本信息

项目值
请求方法POST
请求路径/task/image_purify
Content-Typeapplication/json
鉴权方式Authorization 请求头(直接传 API Key)

请求参数(Body)

参数名类型必填默认值说明
file_idstring是—已上传图片文件的 ID
purify_scopestring否"full_screen"净化范围:full_screen(自动识别并去除)/ region(按 regions 给出的框直接去除)
regionsarrayregion 时必填—要直接去除的区域,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_idstring处理后的图片文件 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 状态码说明解决方案
6013400file_id 缺失传入 file_id 参数
6016400purify_scope 非法,或 region 模式 regions 缺失或非法(为空、超过 16 个、坐标越界)检查 purify_scope / regions
6014400文件类型与接口不匹配传入图片文件
6004404文件不存在检查 file_id 是否正确
6502401鉴权失败检查 Authorization 请求头
6202402余额不足前往仪表盘充值