API端点
POST https://api.example.com/v1/face/compare
请求参数
输入第一张包含人脸的图像URL
输入第二张包含人脸的图像URL
注意:这是一个演示界面,不会发送实际请求
代码示例
JavaScript
// 人脸比对API调用示例
fetch('https://api.example.com/v1/face/compare', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image_url1: 'https://example.com/images/person1.jpg',
image_url2: 'https://example.com/images/person2.jpg',
return_face_data: true
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
响应结果
响应状态:200 OK耗时: 527ms
{ "request_id": "a6c58b5b-e6f7-4d5c-9043-f7c9e6a8b6d5", "time_used": 527, "confidence": 89.45, "thresholds": { "1e-3": 65.3, "1e-4": 70.1, "1e-5": 75.7 }, "faces1": [ { "face_rectangle": { "top": 128, "left": 145, "width": 176, "height": 176 } } ], "faces2": [ { "face_rectangle": { "top": 138, "left": 152, "width": 168, "height": 168 } } ] }
可视化结果
图像1预览
图像2预览
比对结果摘要
相似度: 89.45%
相似度阈值: 1e-3 (65.3%), 1e-4 (70.1%), 1e-5 (75.7%)
结论: 很可能是同一个人