Create a Flow with the following nodes:
- Event
- Detect Faces (by AWS)
- Run Function
- Send Email
It should look like the one below.
In the Event node, set the Event Name
to photo
and add the Devices you would like the Flow to be triggered by.
In the Run Function node, add the following code to get the number of faces in the image.
if (input.body.faceDetails) { var faceCount = input.body.faceDetails.length; output.body.faceCount = faceCount;} else { output.body.faceCount = 0;}
In the Send Email node, set the To Address and Subject line. In the Body of the email, add the following text.
Found ${input.body.faceCount} faces.
Publish an Event to Wia with the following parameters:
name
-photo
file
- Buffer of your file
After a few seconds you should be able to see the Event in your dashboard and receive an email to your To Address in the Send Email node.
Get Details of a FaceTo access the details of a face, edit the code in the Run Function node.
You can get a particular face using the code input.body.faceDetails[i]
where i
is the face instance you would like to get.
The following variables are available:
Build a Flow the same way as in the Get Number of Faces
example above. In the Run Function node, change the code to the following:
if (input.body.faceDetails) { if (input.body.faceDetails.length > 0) { var face = input.body.faceDetails[0]; output.body.isSmiling = face.smile.value; }} else { output.body.isSmiling = false;}
In the Send Email node, set the To Address and Subject line. In the Body of the email, add the following text.
Person smiling: ${input.body.isSmiling}
Detect LabelsThis detects instances of real-world entities within an image. This includes objects like flower, tree, and table; events like wedding, graduation, and birthday party; and concepts like landscape, evening, and nature.
Get a List of LabelsCreate a Flow with the following nodes:
- Event
- Detect Labels (by AWS)
- Run Function
- Send Email
It should look like the one below.
In the Event node, set the Event Name
to photo
and add the Devices you would like the Flow to be triggered by.
In the Run Function node the following variables are available in the input
variable.
Field NameType
labels
Array
labels[i].confidence
Replace i
by instance number you would like to return e.g. 0, 1, etc.
Number
labels[i].name
Replace i
by instance numberyou would like to return e.g. 0, 1, etc.
String
orientationCorrection
String
Add the following code to get the labels of the photo:
output.body = JSON.stringify(input.body, null, 2);
In the Send Email node, set the To Address to your email address and Subject line to 'Detect Labels'. In the Body of the email, add the following text.
Got labels: ${input.body}
Publish an Event to Wia with the following parameters:
name
-photo
file
- Buffer of your file
After a few seconds you should be able to see the Event in your dashboard and receive an email to your To Address in the Send Email node.
Detect TextDetects text in the input image and converts it into machine-readable text.
Get a List of TextsCreate a Flow with the following nodes:
- Event
- Detect Text (by AWS)
- Run Function
- Send Email
It should look like the one below.
In the Event node, set the Event Name
to photo
and add the Devices you would like the Flow to be triggered by.
In the Run Function node the following variables are available in the input
variable.
Add the following code to get the texts of the photo:
var textList = [];input.body.textDetections.forEach(function(td) { textList.push({ confidence: td.confidence, detectedText: td.detectedText });});output.body = JSON.stringify(textList, null, 2);
In the Send Email node, set the To Address to your email address and Subject line to 'Detect Text'. In the Body of the email, add the following text.
Got texts: ${input.body}
Publish an Event to Wia with the following parameters:
name
-photo
file
- Buffer of your file
After a few seconds you should be able to see the Event in your dashboard and receive an email to your To Address in the Send Email node.
*Amazon Rekognition makes it easy to add image to your applications. You just provide an image to the Rekognition API, and the service can identify the objects, people, text, scenes, and activities, as well as detect any inappropriate content. Amazon Rekognition also provides highly accurate facial analysis and facial recognition. You can detect, analyze, and compare faces for a wide variety of user verification, cataloging, people counting, and public safety use cases.
Comments