This function is used to check if the input image belongs to one of the classes previously defined. The class to be checked with can be set using the argument as label_number.
The example demonstrates how face recognition works with analysis on the camera.
The example demonstrates the application of face recognition with camera feed. Following are the key steps happening:
- Initializing the program with parameters for the sprite and face detection library.
- Saving the face showing in the camera as class 1.
- Running face recognition and reporting whether class 1 is detected or not.
Code
sprite = Sprite('Tobi')
fd = FaceDetection()
import time
fd.setthreshold(0.5)
fd.video("on", 0)
fd.enablebox()
time.sleep(2)
fd.deleteallclass()
# Adding face 1 to database
fd.addclassfromstage(1, "Face 1")
while True:
fd.recognisefromcamera()
if fd.isclassdetected(1):
sprite.say("Face 1 Recognised")
else:
sprite.say("Face 1 Missing")
Output
Read More