Arduino Face Detection Shield acts as Arduino Shield via 1Sheeld

Buy 1Sheeld

 

Turn your smartphone into a Face Detector shield for Arduino. Face Detector library allows your phone to detect faces using your camera, then it send faces details to your Arduino so you can take certain actions.
*Supported by IOS application only

 

This shield is one of the sensor shields. Sensor shields allows you to tap into your smartphone’s sensors and use in prototyping with Arduino, you can get information from the surrounding environment and use it to trigger a certain action. Learn more from the

sensors shields tutorial.

FaceDetector library allows you to detect faces and check each face details, so that your Arduino can take certain actions, like turning on LEDs or opening doors when someone smiles or winks.

 

Adding #define CUSTOM_SETTINGS along with #define INCLUDE_FACE_DETECTOR_SHIELD is a key that will let you unlock FaceDetector shield only amongst all shields and prevent 1Sheeld library from eating your memory especially for UNO board.

 

Faces Details

– Left/Right eyes opening.
– Smiling.
– Width;Height of face.
– X;Y coordinates on preview.

 

Notes

-Face Detection shield only detects faces enters the preview and doesn’t recognize faces.
-Max 20 Faces can be saved on your Arduino.
-Video preview dimensions is (1000X1000) with origins in the middle of preview, giving you ranges from (-500,500) for horizontal x-axis and (-500,500) for vertical  y-axis.
-Each face detected gets it’s own ID, while if it gets out off the preview it will lose it’s ID and your Arduino will be notified. If the same face re-enters the preview, it will take a new ID (if another face was detected right before), but in all cases it will be treated as a new face by your Arduino.
-Make sure to open the auto rotation “portrait orientation lock” feature “ON” on your iPhone, if you will use the shield in the landscape position.

 

Face getFace(int)

Returns detected face with certain ID unless the face gets out of the preview.

 

SYNTAX
FaceDetector.getFace(0);

 

RETURN
A struct face if face visible on preview, or a null face if it gets out of the preview.

 

PARAMETERS
ID of existed face.

 

USAGE
Face myFace= FaceDetector.getFace(0);

 

Face getVisibleFace(byte)

Returns face number (n) from preview(hint: face must still exist on preview) given that the max number of faces from getVisibleFacesCount() function.

 

SYNTAX
FaceDetector.getVisibleFace(0);

 

RETURN
A struct face if face visible on preview, or a null face if it gets out of the preview.

 

PARAMETERS
Number of the face on preview.

 

USAGE
for(int i=0 ;i < FaceDetector.getVisibleFacesCount();i++)
{
 Face myFace= FaceDetector.getVisibleFace(i);
}

 

byte getVisibleFacesCount(void)

Returns number of visible faces on preview(max 20 faces).

 

SYNTAX
byte facesNumber = FaceDetector.getVisibleFacesCount();

 

RETURN
Number of visible faces.

 

PARAMETERS
None.

 

USAGE
for(int i=0 ;i < FaceDetector.getVisibleFacesCount();i++)
{
 Face myFace= FaceDetector.getVisibleFace(i);
}

 

bool isFaceVisible(int)

Checks if a certain face “given certain ID” visible on preview.

 

SYNTAX
FaceDetector.isFaceVisible(5);

 

RETURN
A Yes ‘1’ or No ‘0’ if the certain given face ID visible on preview.

 

PARAMETERS
ID of face.

 

USAGE
if(FaceDetector.isFaceVisible(5))
{
 Face myFace= FaceDetector.getFace(5);
}

 

void setOnNewFace(void (*userFunction)(Face))

Sets a certain individual function coded by the user in the sketch to be called and runs its functionality once a new face is detected.

 

SYNTAX
FaceDetector.setOnNewFace(*userFunctionName);

 

RETURN
None.

 

PARAMETERS
*userFunctionName: takes the physical address of the userFunction in the memory and jump to it once called to execute it’s functionality.

 

USAGE
FaceDetector.setOnNewFace(&newFaceFunction);
/* On new barcode scanned function. */
void newFaceFunction(Face myface)
{
  int smile = myFace.getSmileProbability();
}

 

void setOnNotVisible(int)

Sets a certain individual function coded by the user in the sketch to be called and runs its functionality once certain face get off the preview.

 

SYNTAX
FaceDetector.setOnNotVisible(*userFunctionName);

 

RETURN
None.

 

PARAMETERS
*userFunctionName: takes the physical address of the userFunction in the memory and jump to it once called to execute it’s functionality.

 

USAGE
FaceDetector.setOnNotVisible(*deleteFaceFunction);
/* On new barcode scanned function. */
void deleteFaceFunction(int deletedFace)
{
  Terminal.print("Face Deleted");
  Terminal.println(deletedFace);
}

 

Struct Face

Functions that belongs to the structure face.

 

int getSmileProbability (void)

int getLeftEyeOpenProbability (void)

int getRightEyeOpenProbability (void)

int getXCoordinates (void)

int getYCoordinates (void)

int getID (void)

unsigned int getWidth (void)

unsigned int getHeight (void)

 

int getSmileProbability(void)

Returns face smiling probability.

 

SYNTAX
myFace.getSmileProbability();

 

RETURN
Returns values from 0 “not smiling” to 100 “totally smiling” or a -1 of face is not visible on preview.

 

PARAMETERS
None.

 

USAGE
 Face myFace= FaceDetector.getFace(5);
 int smiling= myFace.getSmileProbability();

 

int getLeftEyeOpenProbability(void)

Returns left eye open probability.

 

SYNTAX
myFace.getLeftEyeOpenProbability();

 

RETURN
Returns values from 0 “not opened” to 100 “totally opened” or a -1 if face is not visible on preview.

 

PARAMETERS
None.

 

USAGE
 Face myFace= FaceDetector.getFace(5);
 int leftEye= myFace.getLeftEyeOpenProbability();

 

int getRightEyeOpenProbability(void)

Returns right eye open probability.

 

SYNTAX
myFace.getRightEyeOpenProbability();

 

RETURN
Returns values from 0 “not opened” to 100 “totally opened” or a -1 if face is not visible on preview.

 

PARAMETERS
None.

 

USAGE
 Face myFace= FaceDetector.getFace(5);
 int rightEye= myFace.getRightEyeOpenProbability();

 

int getXCoordinates(void)

Returns x-axis value from -500 to 500 with the origin in the middle of preview.

 

SYNTAX
myFace.getXCoordinates();

 

RETURN
Returns values from -500 to 500.

 

PARAMETERS
None.

 

USAGE
 Face myFace= FaceDetector.getFace(5);
 int xCoordinates= myFace.getXCoordinates();

 

int getYCoordinates(void)

Returns y-axis value from -500 to 500 with the origin in the middle of preview.

 

SYNTAX

myFace.getYCoordinates();

RETURN
Returns values from -500 to 500.

 

PARAMETERS
None.

 

USAGE
 Face myFace= FaceDetector.getFace(5);
 int yCoordinates= myFace.getYCoordinates();

 

int getID(void)

Returns ID of face.(ID’s start from 0)

 

SYNTAX
myFace.getID();

 

RETURN
Returns 0 or above as an ID.

 

PARAMETERS
None.

 

USAGE
 Face myFace= FaceDetector.getFace(5);
 int faceID= myFace.getID();

 

unsigned int getWidth(void)

Returns width of face.

 

SYNTAX
myFace.getWidth();

 

RETURN
Returns width of face.

 

PARAMETERS
None.

 

USAGE
 Face myFace= FaceDetector.getFace(5);
 int faceWidth= myFace.getWidth();

 

unsigned int getHeight(void)

Returns height of face.

 

SYNTAX
myFace.getHeight();

 

RETURN
Returns height of face.

 

PARAMETERS
None.

 

USAGE
 Face myFace= FaceDetector.getFace(5);
 int faceHeight= myFace.getHeight();