本接口用于对比两张图片相似值。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
|
名称 |
类型 |
是否必选 |
示例值 |
描述 |
| Action | String | 是 | CompareSimilarByImage | 系统规定参数。取值:CompareSimilarByImage。 |
| PrimaryPicContent | String | 是 | AAAANSUhEUgAAAPcAAAEVCAYAAAA8d3NuAAAAAXNSR0IArs......RK5CYII= | 图片内容。
|
| SecondaryPicContent | String | 是 | AAAANSUhEUgAAAPcAAAEVCAYAAAA8d3NuAAAAAXNSR0IArs......RK5CYII= | 图片内容。
|
| InstanceName | String | 是 | demoinstance1 | 图搜实例名称。最多支持20个字符。 如果已经购买图搜实例可登录图像搜索管控台查看。 说明 这里的实例名称并非实例ID,使用时请区分。 |
返回数据
名称 |
类型 |
示例值 |
描述 |
| Score | double | 0.85 | 图片相似打分。取值范围:0~1。 |
| Success | Boolean | true | 请求是否成功。 |
| RequestId | String | B3137727-7D6E-488C-BA21-0E034C38A879 | 请求ID。 |
| Msg | String | success | 错误信息。 |
| AccessDeniedDetail | Object | 鉴权返回集合。 |
|
| AuthAction | String | xxx | 鉴权请求Action。 |
| AuthPrincipalDisplayName | String | 111 | 鉴权主体信息。 |
| AuthPrincipalOwnerId | String | 222 | 鉴权主体的主账号ID。 |
| AuthPrincipalType | String | SubUser | 鉴权主体类型。 |
| EncodedDiagnosticMessage | String | xxxxxx | 加密后的完整诊断信息。 |
| NoPermissionType | String | ImplicitDeny | ImplicitDeny:未命中任何策略。 ExplicitDeny:明确命中Deny策略。 |
| PolicyType | String | AccountLevelIdentityBasedPolicy | 引起无权限的策略类型。 |
| Code | Integer | 0 | 错误码。
|
示例
请求示例
http(s)://[Endpoint]/?Action=CompareSimilarByImage
&PrimaryPicContent=AAAANSUhEUgAAAPcAAAEVCAYAAAA8d3NuAAAAAXNSR0IArs......RK5CYII=
&SecondaryPicContent=AAAANSUhEUgAAAPcAAAEVCAYAAAA8d3NuAAAAAXNSR0IArs......RK5CYII=
&InstanceName=demoinstance1
&公共请求参数
正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<CompareSimilarByImageResponse>
<Score>0.85</Score>
<Success>true</Success>
<RequestId>B3137727-7D6E-488C-BA21-0E034C38A879</RequestId>
<Msg>success</Msg>
<AccessDeniedDetail>
<AuthAction>xxx</AuthAction>
<AuthPrincipalDisplayName>111</AuthPrincipalDisplayName>
<AuthPrincipalOwnerId>222</AuthPrincipalOwnerId>
<AuthPrincipalType>SubUser</AuthPrincipalType>
<EncodedDiagnosticMessage>xxxxxx</EncodedDiagnosticMessage>
<NoPermissionType>ImplicitDeny</NoPermissionType>
<PolicyType>AccountLevelIdentityBasedPolicy</PolicyType>
</AccessDeniedDetail>
<Code>0</Code>
</CompareSimilarByImageResponse>
JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"Score" : 0.85,
"Success" : true,
"RequestId" : "B3137727-7D6E-488C-BA21-0E034C38A879",
"Msg" : "success",
"AccessDeniedDetail" : {
"AuthAction" : "xxx",
"AuthPrincipalDisplayName" : "111",
"AuthPrincipalOwnerId" : "222",
"AuthPrincipalType" : "SubUser",
"EncodedDiagnosticMessage" : "xxxxxx",
"NoPermissionType" : "ImplicitDeny",
"PolicyType" : "AccountLevelIdentityBasedPolicy"
},
"Code" : 0
}
错误码
|
HttpCode |
错误码 |
错误信息 |
描述 |
| 400 | SearchTimeout | The request timed out. | 请求超时 |
| 400 | TimeoutForTransferImage | Image transfer timed out. | 客户端图片传输超时 |
| 400 | UnsupportedPicFormat | The specified image format is invalid. | 无效的图片格式 |
| 400 | UnsupportedPicPixels | The specified pixels is not supported. | 图片像素值不支持 |
| 400 | UnsupportedPictureFormat | The format of the specified picture is not supported. | 用户图片格式不支持 |
| 400 | Console.InstanceNotFound | The specified ImageSearch instance is not found. | 查找不到实例,检查购买的实例ID是否正确。 |
| 400 | Console.PidError | The number of PID bindings of the current instance exceeds 50. | 当前实例PID绑定数量超过50 |
| 400 | EmptyMeta | The body content has an empty meta field. | 请求body含有空的字段 |
| 400 | IncorrectOrientation | The image contains incorrect rotation flags in the meta data. | 图片包含不支持的旋转参数 |
| 400 | InstanceOverQuota | The number of items exceeds the limit. | 实例的图片数量超过限制值 |
| 400 | InstanceStatusError | The current instance status does not support this operation. | 实例状态不可用 |
| 400 | InvalidInstance | The specified instance name is invalid. | 实例名错误 |
| 400 | InvalidPicContent | The image size exceeds 4 MB. | 图片大小超过4M |
| 400 | InvalidPicUrl | The specified parameter PicUrl is not valid. | 无效的PicUrl参数 |
| 400 | NeedRegisterBeforeInvoke | Register for PID before invoking the service. | 调用前需要先注册pid |
| 400 | NoCaretSeperator | The body content is missing the ^ separator. | 请求body缺少特定符号 |
| 400 | NoSpecifiedPic | The content of an image is not specified in the HTTP POST body. | 图片未指定 |
| 400 | PicNotExist | The specified image does not exist. | 图片未指定 |
| 400 | InvalidSecondaryPicContent | The specified parameter SecondaryPicContent is not valid. | 无效的SecondaryPicContent参数 |
| 400 | InvalidPrimaryPicContent | The specified parameter PrimaryPicContent is not valid. | 无效的PrimaryPicContent参数 |
| 400 | PictureError | [download] Img Download Failed. | 图片下载失败,请检查图片 |
| 400 | UnsupportedOperationType | The specified action is not supported. | 内部错误:不支持的action |
| 400 | UnsupportedInstanceType | The instance type is not supported. | 内部错误:不支持的实例类型 |
| 403 | Console.NoPermissionError | You are not authorized to perform this operation. | 你没有权限进行该操作 |
| 403 | Console.NotAllowedModifyToken | You are not allowed to modify token today. | 今天不允许用户修改该token值 |
| 403 | DeniedRequest | Your request was denied due to instance flow control. | 请求被限流 |
| 403 | NoPermission | You are not authorized to perform this operation. | 未授权的行为 |
| 409 | Console.TaskAlreadyExist | A task that is in progress already exists. | 已经存在正在运行的任务。 |
| 500 | ServerInternalError | An internal error occurred. | 系统内部错误 |
| 500 | UnknownException | An internal server error occurred. | 未知异常 |
| 500 | AccessEngineFailed | An error occurred while accessing the search engine. | 内部错误:请求引擎失败 |
| 500 | ConnectionDVException | Failed to obtain collection. | internalError |
| 500 | Console.CallServiceError | An internal service error occurred. | 访问内部服务错误 |
| 500 | ExtractFeatureTimeout | The request timed out while extracting features. | 内部错误:提取特征超时 |
| 500 | InternalOssError | An internal OAS error occurred. | 内部错误:请求内部算法错误 |
| 500 | InternalSwiftError | An internal SWIFT error occurred. | 内部错误:请求内部消息队列错误 |
| 500 | InternalTableStoreError | An internal Table Store error occurred. | 内部错误:请求特征存储错误 |
| 500 | NetworkException | A network error occurred. | 内部错误:请求网络异常 |
| 500 | RequestTimeout | The request timed out. | 内部错误:请求超时 |
访问错误中心查看更多错误码。