图像大小太小Azure Face API Android

Ami*_*raj 5 android azure microsoft-cognitive face-api

我正在尝试在Android上使用Azure Face API。我正在从设备相机捕获图像,然后将其转换为InputStream以发送到detect方法。我不断收到错误“ com.microsoft.projectoxford.face.rest.ClientException:图像大小太小”

我检查了文档,图像大小为1.4Mb,在1Kb-4Mb范围内。我不明白为什么它不起作用。

Bitmap bitmap = cameraKitImage.getBitmap();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos);
bitmapdata = bos.toByteArray();

new FaceTask().execute(new ByteArrayInputStream(bitmapdata));

Face[] faces = faceServiceClient.detect(inputStreams[0], true, false, null);
Run Code Online (Sandbox Code Playgroud)

小智 0

不知何故,您的文件被压缩超过 1Kb 或者实际大小已经很小。尝试将其保存在可绘制或资产文件夹中的某个位置,然后在输入流中打开它。