This function returns the width of the face detected. You can specify the face for which the value is needed. The position is mapped with the stage coordinates.
The example demonstrates the application of face detection with a stage feed.
The example demonstrates the application of face detection with a stage feed. Following are the key steps happening:
- Initializing the program with parameters for the sprite and face detection library.
- Running face detection
- Running the loop to show every face and its expression
Code
sprite = Sprite('Square Box')
import time
fd = FaceDetection()
# Disable Bounding Box on the stage
fd.disablebox()
# Set Theshold of the stage
fd.setthreshold(0.4)
fd.analysestage()
print(fd.count())
for i in range(fd.count()):
sprite.setx(fd.x(i + 1))
sprite.sety(fd.y(i + 1))
sprite.setsize(fd.width(i + 1))
sprite.say("Face " + str(i + 1) + ": " + fd.expression(i + 1))
time.sleep(1)
Output
Read More