/
Face Detection on Desktop
Face Detection on Desktop
Prerequisites
redis server is running
face detection service is running
Code (in separate terminals):
redis-server conf/redis/redis.conf
run-face-detection
Walkthrough
Import necessary libraries
import queue
import cv2
from sic_framework.core import utils_cv2
from sic_framework.core.message_python2 import (
BoundingBoxesMessage,
CompressedImageMessage,
)
from sic_framework.devices.common_desktop.desktop_camera import DesktopCameraConf
from sic_framework.devices.desktop import Desktop
from sic_framework.services.face_detection.face_detection import FaceDetection
Create buffers for image/face objects, define callback functions
Whenever a new image or face detection is received, on_image or on_faces will be called to place the data object into its respective buffer.
imgs_buffer = queue.Queue(maxsize=1)
faces_buffer = queue.Queue(maxsize=1)
def on_image(image_message: CompressedImageMessage):
imgs_buffer.put(image_message.image)
def on_faces(message: BoundingBoxesMessage):
faces_buffer.put(message.bboxes)
Set up the camera, register callback functions
Display face detection
The full code can be found here
, multiple selections available,
Related content
Facial Recognition on Desktop
Facial Recognition on Desktop
More like this
Available services
Available services
More like this
Getting started
Getting started
Read with this
Creating a Simple Service
Creating a Simple Service
More like this
Getting started with the Nao robot
Getting started with the Nao robot
Read with this
Display an image from the robot
Display an image from the robot
More like this