A quick Processing library to make using Rekognition API easy to use in Processing.
Rekognition is an open API platform provided by Orbeus, which helps developers easily incorporate the state-of-the-art computer vision capabilities of facial recognition, object recognition and scene understanding into your app or software.
To use the library, you'll need to:
Rekognition rekog = new Rekognition(this, APIKEY, APISECRET);
// Optionall set namespace and app name
rekog.setNamespace("processing");
rekog.setUserID("demo");
// Get a list of faces
RFace[] faces = rekog.detectFacesPath(filename);
// Get face meta data
for (int i = 0; i < faces.length; i++) {
PVector center = faces[i].center;
PVector eye_right = faces[i].eye_right;
PVector eye_right = faces[i].eye_right;
PVector eye_left = faces[i].eye_left;
PVector mouth_right = faces[i].mouth_right;
PVector mouth_left = faces[i].mouth_left;
PVector nose = faces[i].nose;
String gender = faces[i].gender;
float age = faces[i].age;
// and more!
}
// Here we tell Rekognition that the face in this image associated with this name
rekog.addFace("pitt.jpg", "Pitt");
// We need a second API call to train Rekognition of whatever faces have been added
// Here it's one face, then train, but you could add a lot of faces before training
rekog.train();
for (int i = 0; i < faces.length; i++) {
// Possible face matches come back in a FloatDict
// A string (name of face) is paired with a float from 0 to 1 (how likely is it that face)
FloatDict matches = faces[i].getMatches();
for (String key : matches.keys()) {
float likely = matches.get(key);
println(key + ": " + likely);
}
}