Я получаю сообщение об ошибке при отправке изображения для распознавания в AWS Rekognition.
Это код, который я использую:
val byteBuffer = ByteBuffer.allocate(facePicture.byteCount)
facePicture.copyPixelsToBuffer(byteBuffer)
val image = Image().withBytes(byteBuffer)
val searchFacesByImageResult = rekognitionClient.searchFacesByImage(
SearchFacesByImageRequest()
.withCollectionId(collectionId)
.withImage(image)
.withMaxFaces(1)
.withFaceMatchThreshold(88F)
)
И это ошибка:
com.amazonaws.AmazonServiceException: 1 validation error detected: Value 'java.nio.HeapByteBuffer[pos=0 lim=0 cap=0]' at 'image.bytes' failed to satisfy constraint: Member must have length greater than or equal to 1 (Service: AmazonRekognition; Status Code: 400; Error Code: ValidationException; Request ID: 70a3f05c-8166-11e9-a1cb-fbae8cf4359b)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
at com.amazonaws.services.rekognition.AmazonRekognitionClient.invoke(AmazonRekognitionClient.java:3006)
at com.amazonaws.services.rekognition.AmazonRekognitionClient.searchFacesByImage(AmazonRekognitionClient.java:238
Исключение выглядит как ByteBuffer
пусто, я отладил и проверил, что ByteBuffer допустим и не пуст