This plugin is a face detector which is able to detect faces in an image (see PFrame).
The algorithm accepts every pixel formats available in Papillon (see PImage::EPixelFormat).
The detector uses openVINO models

This plugin creates a PDetector object.

  • Plugin: PPluginDetectorFace6
  • Product name: FaceDetector6
  • Version: 1.0

How to create a face detector from this plugin?

PDetector detector
PResult ret = PDetector::Create("FaceDetector6", PProperties(), detector)
if (ret.Failed()) ...


To configure this detector you have 3 options:

  1. Use PProperties container argument in the PDetector::Create() factory
  2. Use PDetector specific methods, e.g. PDetector::EnableLocaliser() or PDetector::SetMinDetectionSize(), see PDetector documentation to learn more.
  3. Use PDetector generic PDetector::Set() and PDetector::Get() using parameters' names.

Parameters are the following:

Parameter Type Default Value Description
model papillon::PString "" Path to model file
regionOfInterest papillon::PRectanglei (0,0,0,0) Region of interest ((0,0,0,0) means whole image)
minDetectionSize papillon::PSizei (60,60) Minimum detection size
maxDetectionSize papillon::PSizei (0,0) Maximum detection size
maxDetections papillon::int32 0 Limit number of detection in result (0 - not limited)
threshold float 0.7f Detection threshold
gpuId int -1 GPU ID to use. (-1 is CPU)
enableLocaliser bool false Enable localiser
localiser papillon::PDetector () Localiser object to use (null object for using default localiser)
maxNumDetectors int 4 Limit number of detector threads. This parameter is only used at detector creation stage. (advanced)
inThreadProcessing bool true Run each detector worker in separate thread. This parameter is only used at detector creation stage. (advanced)
maxAllowedTasks int 200 In the thread processing mode defines maximum number of tasks in the queue. This parameter is only used at detector creation stage. (advanced)


* Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
* Contact: http://www.digitalbarriers.com/
* This file is part of the Papillon SDK.
* You can't use, modify or distribute any part of this file without
* the explicit written agreements of Digital Barriers.
#include <PapillonCore.h>
const PString SAMPLE_DIR = PPath::Join(PUtils::GetEnv("PAPILLON_INSTALL_DIR"),
"Samples"); // path to find sample data: $PAPILLON_INSTALL_DIR/Data/Samples
const float SCALE_FACTOR = 1.0f;
const int LINE_WIDTH = 2;
static void RunDemo() {
// ************************************************************************
// 1. Open Video Stream
// ************************************************************************
PInputVideoStream::Open(PPath::Join(SAMPLE_DIR, "busy_office.avi"), ivs).OrDie();
// ************************************************************************
// 2. Create Face Detector
// ************************************************************************
PDetector detector;
if(0) {
// This creates an instance of FaceDetector5. FaceDetector5 has been optimised for the
// NVidia GPUs. If you set the gpuId=0, then the detector will try and use the first NVidia GPU it finds.
PDetector::Create("FaceDetector5", PProperties::CreateFromKeyValueString("gpuId=0;"), detector).OrDie();
// FaceDetector5 will always provide a five-point location of face features. For most situations this is fine.
// However, you can also use another localiser which provides a 68 landmarks.
if(0) {
PDetector localiser;
PProperties localiserProperties =
PDetector::Create("FaceDetector2", localiserProperties, localiser).OrDie();
} else {
// This creates an instance of FaceDetector6. FaceDetector6 has been optimised for Intel CPUs and GPUs.
// It also works well on faces wearing mask images - and should be used in this scenario.
// If you have an Intel GPU you can specify to use it by setting gpuId=-2
// If you enable the localiser, it will output 68 landmarks.
PDetector::Create("FaceDetector6", PProperties::CreateFromKeyValueString("gpuId=-2;enableLocaliser=True;"), detector).OrDie();
// ************************************************************************
// 3. Apply Face Detector to the video stream
// ************************************************************************
PFrame frame;
PDetectionList detectionList;
while (ivs.GetFrame(frame).Ok() && !PUtils::IsEscPressed()) {
detector.Detect(frame, detectionList);
PUtils::DisplayDetectionList(frame, detectionList, "Papillon SDK - Person Detector example",
SCALE_FACTOR, PColour3i::Red(), false, true, LINE_WIDTH);
//display first detection in separate window
if (detectionList.Size() > 0) {
PDetection detection = detectionList.Get(0);
const float scale = 4;
PImage crop;
PPoint2Di origin;
PUtils::CropDetection(detection, crop, origin, 0.3).OrDie();
PFeatureMap featureMap = detection.GetFeatureMapShared();
//translate feature map (careful it will modify feature map in detection!)
PUtils::DrawFeatureMap(crop, featureMap);
crop.Display("Detection with feature map");
int main() {
return 0;