Face Detection
Import KOI 2 Library
Serial Initialization
Initializes the serial connection to KOI.
Parameters:
tx: TX Pin, use P2 for Robotbit EDU
rx: RX Pin, use P12 for Robotbit EDU
Select Face Mask Mode
Sets the KOI mode to Face Mask Detection.
Get Face Data
Returns data for the detected face.
Parameters:
data: The type of data to return.
0
X coordinates
1
Y coordinates
2
Width of face
3
Height of face
Get Mask Value
Returns whether the face detected is wearing a mask.
Return Value:
"with-mask": Person is wearing mask
"without-mask": Person is not wearing mask
Sample Code: Mask Detection
Select Face Attribute Mode
Sets the KOI mode to Face Attribute Detection.
Get Face Data
Returns data for the detected face.
Parameters:
data: The type of data to return.
0
X coordinates
1
Y coordinates
2
Width of face
3
Height of face
Get Number of Faces
Returns the number of faces detected.
Return Value: Integer
Parameters:
attr:
8
Total number of faces detected
9
Total number of male detected
10
Total number of open mouths detected
11
Total number of smiles detected
12
Total number of glasses detected
13
Total number of female detected
Get Attribute of Main Character
Returns the attribute of main character.
Return Value: Boolean
Parameters:
attr:
4
Whether the person is a male
5
Whether the person has an open mouth
6
Whether the person is smiling
7
Whether the person is wearing glasses
Sample Code: Face Attribute
Last updated