안녕하세요. 아마존 AWS Rekognition 이용하려는데 이미지 경로 지정하는데 이미지가 안 불러져서요. 이미지를 어떤 폴더, 위치에 넣어야 하는건지 모르겠어요. drawable, 배경화면, assets, 애뮬레이터 내부에도 다 저장해봤는데도 아래와 같이 파일을 불러오는데 실패해요 s3 버킷에 이미지 업로드해서 cmd로는 실행되는거 확인했고요. Device File Explorer에서 저렇게도 뜹니다. 자세한 방법 알려주시면 감사하겠습니다..!!
public void compareFaces() {
String path = Environment.getExternalStorageDirectory().getPath();
Float similarityThreshold = 70F;
String sourceImage ="sdcard\\Download\\jj.jpg";
String targetImage ="sdcard\\Download\\bp.jpg";
ByteBuffer sourceImageBytes = null;
ByteBuffer targetImageBytes = null;
AmazonRekognition rekognitionClient = new AmazonRekognitionClient(new BasicAWSCredentials("AKIAYOYJ2IFNWTKWWCRC", "e8erLmFH0+KHiEgQv0NPElSMi0xQcl1pwoyG6Njz"));
//Load source and target images and create input parameters
try (InputStream inputStream = new FileInputStream(new File(sourceImage))) {
sourceImageBytes = ByteBuffer.wrap(IOUtils.toByteArray(inputStream));
}
catch(Exception e)
{
System.out.println("Failed to load source image " + sourceImage);
System.exit(1);
}
try (InputStream inputStream = new FileInputStream(new File(targetImage))) {
targetImageBytes = ByteBuffer.wrap(IOUtils.toByteArray(inputStream));
}
catch(Exception e)
{
System.out.println("Failed to load target images: " + targetImage);
System.exit(1);
}
Image source = new Image()
.withBytes(sourceImageBytes);
Image target = new Image()
.withBytes(targetImageBytes);
}