Skip to content

Instantly share code, notes, and snippets.

View pliablepixels's full-sized avatar
💭
A clear conscience is usually the sign of a bad memory

Pliable Pixels pliablepixels

💭
A clear conscience is usually the sign of a bad memory
View GitHub Profile
my @daemons = (
'zmc',
'zma',
'zmf',
'zmfilter.pl',
'zmaudit.pl',
'zmtrigger.pl',
'zmx10.pl',
'zmwatch.pl',
'zmupdate.pl',
#include "../base/zmApp.h"
#include "../base/zmListener.h"
#include "../providers/zmNetworkAVInput.h"
#include "../processors/zmMotionDetector.h"
#include "../processors/zmQuadVideo.h"
#include "../protocols/zmHttpController.h"
#include "../libgen/libgenDebug.h"
//
include "../base/zmApp.h"
#include "../base/zmListener.h"
#include "../providers/zmNetworkAVInput.h"
#include "../processors/zmMotionDetector.h"
#include "../processors/zmQuadVideo.h"
#include "../protocols/zmHttpController.h"
#include "../libgen/libgenDebug.h"
//
class nvrCameras
{
public:
NetworkAVInput *cam;
MotionDetector *motion;
EventDetector *event; // used if RECORD_VIDEO = 0
MovieFileOutputDetector *movie; // used if RECORD_VIDEO = 1
};
nvrcam.face = new FaceDetector( "face-"+name ); // init face detection
nvrcam.rate = new RateLimiter( "rate-"+name,face_refresh_rate,true ); // no need to perform detection on every frame!
nvrcam.rate->registerProvider(*(nvrcam.cam) ); // rate reads frames from camera
nvrcam.face->registerProvider(*(nvrcam.rate) ); // face reads frames from rate!
nvrcam.motion = new MotionDetector( "modect-"+name );
nvrcam.motion->registerProvider(*(nvrcam.cam) ); // motion detect reads frames from camera
// now do the magic!
nvrcam.cam->start();
nrvcam.rate->start();
class nvrCameras
{
public:
NetworkAVInput *cam;
Detector *motion; // keeping two detectors as they can run in parallel
Detector *face;
Recorder *event; // will either store video or images
RateLimiter *rate; // will modify rate of output
LocalFileOutput *fileOut; // will store images to disk, and we'll feed in rate as its input, not cam
nvrcam.fileOut = new LocalFileOutput( "file-"+name, "/tmp" );
nvrcam.rate = new RateLimiter( "rate-"+name,0.5,true );
nvrcam.rate->registerProvider(*(nvrcam.cam) );
nvrcam.fileOut->registerProvider(*(nvrcam.rate) );
#include <base/ozApp.h>
#include <base/ozListener.h>
#include <providers/ozMemoryInputV1.h>
#include <processors/ozRateLimiter.h>
#include <processors/ozShapeDetector.h>
#include <processors/ozFaceDetector.h>
#include <processors/ozAVFilter.h>
//#include processors/ozRecognizer.h>
#include <consumers/ozVideoRecorder.h>
#include <consumers/ozMemoryTriggerV1.h>
// trigger motion if 1% of the frame is covered with motion
Options mOptions;
mOptions.add( "zone_default_alarmPercent_min", 1);
MotionDetector *motion = new MotionDetector(idString,mOptions);
motion->registerProvider(*limiter);
app.addThread(motion);
// Connect input of ShapeDetection to output of motion detection
ShapeDetector *detector = new ShapeDetector( idString,"person.svm",ShapeDetector::OZ_SHAPE_MARKUP_OUTLINE );
detector->registerProvider( *motion, FeedLink(FEED_QUEUED, alarmFramesOnly) );
HttpController httpController( "http", 9292 );
httpController.addStream( "live",*input );
httpController.addStream( "detect", *detector );