指南
任务(识别)
VisionEngine

视觉引擎

警告

使用 createTask 创建任务。

此接口无需单独获取结果,将直接返回图像识别结果!

任务的 type 字段如下

  • VisionEngine

创建任务

使用 createTask 创建任务。

任务对象结构

请注意,此类任务在 createTask 后会直接返回任务执行结果,而不是通过 getTaskResult 异步获取。

属性类型必填描述
typeString必填VisionEngine
moduleString必填所有支持的模型如下表所示
websiteURLString可选页面来源URL,用于提高准确性
imageString必填图像的 base64 编码内容(无换行符,无 data:image/***;charset=utf-8;base64,)
imageBackgroundString必填背景图像的 base64 编码内容(无换行符,无 data:image/***;charset=utf-8;base64,)
questionString可选space_detection 需要

支持的图片类型

模块验证码示例图像背景图像
slider_1img.pngimg.pngimg.png
rotate_1img_2.pngimg_2.pngimg_2.png
rotate_2img_3.pngimg_3.png
sheinimg_4.pngimg_4.png

请求示例

// 使用 slider 模块的请求示例
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
Payload:
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "VisionEngine",
    "module": "slider_1",
    "image": "/9j/4AAQSkZJRgABA......",
    "imageBackground": "/9j/4AAQSkZJRgABA......",
    "websiteURL": "https://xxxx.com"
  }
}


// slider 模块的响应示例
{
  "errorId": 0,
  "errorCode": "",
  "errorDescription": "",
  "status": "ready",
  "solution": {
     "distance": 213,
  },
  "taskId": "..."
}

使用 SDK 请求

# pip install --upgrade capsolver
# export CAPSOLVER_API_KEY='...'
 
import capsolver
 
capsolver.api_key = "..."
 
solution = capsolver.solve({
    "type": "VisionEngine",
    "module": "slider_1",
    "image": "/9j/4AAQSkZJRgABA......",
    "imageBackground": "/9j/4AAQSkZJRgABA......"
})
print(solution)