- Prerequisites
- AWS Account, AWS IAM Credentials (containting secret key id and secret key): see tutorial of AWS
- AWS SDK for Java (include aws libs and third party libs in the projects): download from AWS website
- S3 bucket: creating a S3 bucket and set its name
Note: Remember regions of each amazon services
Optional: - Java Swing to initialize User Interface
- Java CV to use camera and implete some facial detection algorithms (such as Haar Cascade)
- Projects in this reposity
- CheckInByCamera: authenticating users by picture captured by webcam
- CompareFaceDemoV2: capture image from webcam and compare with an image stored in S3 bucket
- CompareFacesDemo: compare faces between a source image and a set of target images
- DetectFaceDemo: detect faces in an image
- Important note:
-
To create Basic AWS Credentials
BasicAWSCredentials credentials = new BasicAWSCredentials(accessKeyID, secretAccessKey);
-
To use any services of amazon, you should create client
AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.standard()
.withRegion(region)
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.build();
-
Pair request/result
- Make request:
DetectFacesRequest detectFacesRequest = new DetectFacesRequest() .withImage(new Image() .withS3Object(new S3Object() .withBucket(bucketName) .withName(key))) .withAttributes(Attribute.ALL);
- Get result:
DetectFacesResult result = rekognitionClient.detectFaces(detectFacesRequest);
- AWS Rekognition These projects mainly use AWS Rekognition to analyze images and get results. Images can be tranfered to Rekognition by 2 ways:
- Use ByteBuffer:
- Use S3Object:
Image image = new Image().withS3Object(new S3Object() .withBucket(bucketName) .withName(key)));