问题描述
我想创建一个简单的程序来使用Microsoft Azure Face API和Visual Studio 2015来检测人脸.遵循( https://social.technet.microsoft.com/wiki/contents/articles/37893.每当我的程序调用UploadAndDetectFaces时,c-face-detection-and-recognition with azure-face-api.aspx )
I wanted to create a simple program to detect faces using Microsoft Azure Face API and Visual Studio 2015. Following the guide from (https://social.technet.microsoft.com/wiki/contents/articles/37893.c-face-detection-and-recognition-with-azure-face-api.aspx), whenever my program calls UploadAndDetectFaces:
private async Task<Face[]> UploadAndDetectFaces(string imageFilePath)
{
try
{
using (Stream imageFileStream = File.OpenRead(imageFilePath))
{
var faces = await faceServiceClient.DetectAsync(imageFileStream,
true,
true,
new FaceAttributeType[]
{
FaceAttributeType.Gender,
FaceAttributeType.Age,
FaceAttributeType.Emotion
});
return faces.ToArray();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return new Face[0];
}
}
我还声明了终结点的密钥:
I also declared the keys to the endpoint:
private readonly IFaceServiceClient faceServiceClient = new FaceServiceClient("MY_KEY_HERE");
错误返回:
有人知道发生了什么问题或需要进行任何更改以防止该错误吗?
Does anyone know what's wrong or any changes required to prevent the error?
推荐答案
将键和端点声明更改为:
Change the key and endpoint declaration to:
private readonly IFaceServiceClient faceServiceClient = new FaceServiceClient("MY_KEY_HERE", "ACTUAL_ENDPOINT_HERE");
这篇关于人脸API DetectAsync错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!