The code forFollow the Getting started to get set up. Create a new file with the code below or use https://bitbucket.org/socialroboticshub/framework/src/master/sic_framework/tests/demo_desktop_camera_facerecognition.py.
Expand |
---|
title | Imports and callbacks |
---|
|
Code Block |
---|
| import queue
import cv2
from sic_framework.core.message_python2 import BoundingBoxesMessage
from sic_framework.core.message_python2 import CompressedImageMessage
from sic_framework.core.utils_cv2 import draw_on_image
from sic_framework.devices.desktop.desktop_camera import DesktopCamera
from sic_framework.services.face_recognition_dnn.face_recognition_service import DNNFaceRecognition
imgs_buffer = queue.Queue()
def on_image(image_message: CompressedImageMessage):
imgs_buffer.put(image_message.image)
faces_buffer = queue.Queue()
def on_faces(message: BoundingBoxesMessage):
faces_buffer.put(message.bboxes)
# code continues below |
|
...
Here is the schematic overview of how this program works. The camera streams its output to the face recognition service, and both stream the output to the program on your laptop.
...