Detect people (pedestrian)
/*
* 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>
USING_NAMESPACE_PAPILLON
const PString SAMPLE_DIR = PPath::Join(PUtils::GetEnv("PAPILLON_INSTALL_DIR"), "Data", "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, "glasgow.avi"), ivs).OrDie();
// ************************************************************************
// 2. Create Person Detector
// ************************************************************************
PDetector personDetector;
PDetector::Create("PersonDetector", PProperties(), personDetector).OrDie();
// ************************************************************************
// 3. Apply Person Detector on the video stream
// ************************************************************************
PFrame frame;
PDetectionList detectionList;
while (ivs.GetFrame(frame).Ok() && !PUtils::IsEscPressed())
{
personDetector.Detect(frame, detectionList);
papillon::PUtils::DisplayDetectionList(frame, detectionList, "Papillon SDK - Person Detector example", SCALE_FACTOR, PColour3i::Red(), false, true, LINE_WIDTH);
}
}
int main()
{
RunDemo();
return 0;
}