In this exercise, you will create a browser-based application that uses your computer’s webcam to ‘see’ images, and then displays the labels for the features that have been detected.
Download the source code bundle from www.zip file and explode the zip file onto your filesystem. Or run the following code:
Open the config/config.jsfile in a text editor such as Eclipse. Replace the following values with the value from CloudFormation Outputs tab:
Text
CloudFormation output value
REPLACE_WITH_COGNITO_IDENTITY_POOL_ID
CognitoIdentityPoolId
REPLACE_WITH_DETECTOR_UPLOAD_BUCKET
S3BucketDetectorUploads
REPLACE_WITH_YOUR_DYNAMO_DB_TABLE_NAME
DynamoDBFaces
REPLACE_WITH_YOUR_AWS_REGION
Your current region
Save the file.
Copy the contents of the folder you exploded the zip file into, to the S3 bucket that lab has created for you to host your website, using the following command:
To be able to access the website, we need to Make public using ACL the objects in the bucket.
Access m7www bucket, select Permissions tab. Scroll down to Access control list (ACL), click bucket owner enforced.
Select ACLs enabled, then click Save changes
Select Objects tab, then select all objects. Then click Actions | Make public using ACL
Visit the website with the following link:
https://m7www.s3-<region>.amazonaws.com/index.html
You will see a landing page with four options. Click the first option, Object Scanner
When the page loads, it will ask for permission to use the webcam on your computer. If you see an error instead, check that you are browsing to the site securely, using HTTPS.
Select Start Rekognition button to start sending images to the Rekognition service.
The page will connect using Amazon Cognito, and then push the webcam image to Rekognition. In response, the page will show a list of all the objects it can ‘see’ in the image.
Try holding up different objects in front of the camera to see the list of objects detected change.
Take a few minutes to look at the source code implementation of this demo to ensure you understand how it works.