oZone Server Framework
Enabling Innovation in Video Applications
MotionDetector Class Reference

#include <ozMotionDetector.h>

Inheritance diagram for MotionDetector:

Public Member Functions

 MotionDetector (const std::string &name, const Options &options=gNullOptions)
 
 MotionDetector (VideoProvider &provider, const Options &options=gNullOptions, const FeedLink &link=gQueuedVideoLink)
 
bool addZone (Zone *zone)
 
uint16_t width () const
 Return the width (in pixels) of video frames supplied by this provider.
 
uint16_t height () const
 Return the height (in pixels) of video frames supplied by this provider.
 
AVPixelFormat pixelFormat () const
 Return the image format of video frames supplied by this provider.
 
FrameRate frameRate () const
 Return the frame rate at this this provider supplies frames. May not be available or accurate.
 
VideoProvidercompImageSlave () const
 
VideoProviderrefImageSlave () const
 
VideoProviderdeltaImageSlave () const
 
VideoProvidervarImageSlave () const
 
- Public Member Functions inherited from VideoConsumer
VideoProvidervideoProvider () const
 Return the first provider cast appropriately, shortcut for when providers == 1. More...
 
- Public Member Functions inherited from FeedConsumer
virtual bool registerProvider (FeedProvider &provider, const FeedLink &link=gQueuedFeedLink)
 
virtual bool deregisterProvider (FeedProvider &provider, bool reciprocate=true)
 
virtual bool deregisterAllProviders ()
 
FeedProviderprovider () const
 Return the first provider, shortcut for when providers == 1.
 
virtual bool hasProvider () const
 
virtual bool hasProvider (FeedProvider &provider) const
 
virtual bool queueFrame (const FramePtr &, FeedProvider *)
 
- Public Member Functions inherited from FeedBase
const std::string & cl4ss () const
 Return the class string.
 
const char * cclass () const
 Return the class string as a c-style string.
 
const std::string & name () const
 Return the name string.
 
const char * cname () const
 Return the name string as a c-style string.
 
const std::string & identity () const
 Return the identity string.
 
const char * cidentity () const
 Return the identity string as a c-style string.
 
- Public Member Functions inherited from FeedProvider
bool hasVideo () const
 Provides video frames.
 
bool hasAudio () const
 Provides audio frames.
 
virtual bool registerConsumer (FeedConsumer &consumer, const FeedLink &link=gQueuedFeedLink)
 
virtual bool deregisterConsumer (FeedConsumer &consumer, bool reciprocate=true)
 
virtual bool hasConsumer () const
 
virtual bool hasConsumer (FeedConsumer &consumer) const
 
bool wait () const
 Indicate whether this provider is ready to supply frames.
 
bool ready () const
 
bool ended () const
 
bool error () const
 
bool frameReady (uint64_t lastFrameCount) const
 Return true if there is a new frame available that the one supplied.
 
uint64_t frameCount () const
 Return the number of frames this provider has supplied.
 
bool canPoll () const
 Indicate whether this provider can supply frames by polling.
 
void setPolling (bool poll)
 Enable the polled frame interface if supported.
 
FramePtr pollFrame () const
 Return a reference to the last generated frame. More...
 
- Public Member Functions inherited from Thread
pid_t tid () const
 < Return the thread id
 
void start ()
 Start the thread and invoke the run method, called by invoker.
 
void stop ()
 Stop the thread, by setting the mStop flag. Thread is responsible for actually existing.
 
void join ()
 Wait for the thread to terminate.
 
bool isThread ()
 
bool running () const
 < Indicate whether the thread is running or not
 
bool stopped () const
 < Indicate whether the thread has been signalled to stop
 

Static Public Member Functions

static bool inAlarm (const FramePtr &, const FeedConsumer *)
 
static bool notInAlarm (const FramePtr &, const FeedConsumer *)
 
- Static Public Member Functions inherited from FeedBase
static std::string makeIdentity (const std::string &cl4ss, const std::string &name)
 Build identity from the class and name strings.
 
- Static Public Member Functions inherited from FeedProvider
static FeedProviderfind (const std::string &identity)
 Locate a provider with the given identity. More...
 
static bool videoFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only video frames. More...
 
static bool audioFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only audio frames. More...
 
static bool dataFramesOnly (const FramePtr &, const FeedConsumer *)
 Comparator function to allow consumers to select only data frames. More...
 
static bool noFrames (const FramePtr &, const FeedConsumer *)
 Comparator function that can be used to suppress frames.
 

Protected Member Functions

int run ()
 
uint32_t detectMotion (const Image &compImage, ZoneSet &motionZones)
 
bool analyse (const Image *image, MotionData *motionData, Image *motionImage)
 
bool alarmed () const
 
- Protected Member Functions inherited from VideoConsumer
 VideoConsumer (const std::string &tag, const std::string &id, int providerLimit=1)
 
 VideoConsumer (const std::string &tag, FeedProvider &provider, const FeedLink &link=gQueuedFeedLink)
 
- Protected Member Functions inherited from FeedConsumer
 FeedConsumer (int providerLimit=1)
 
 FeedConsumer (FeedProvider &provider, const FeedLink &link=gQueuedFeedLink)
 
bool waitForProviders (unsigned int=0)
 
bool checkProviders ()
 Verify that providers exist and are in good condition. More...
 
virtual void cleanup ()
 Tidy up relationships with providers etc before destruction.
 
- Protected Member Functions inherited from FeedBase
void setIdentity (const std::string &cl4ss, const std::string &name)
 Identify this instance.
 
- Protected Member Functions inherited from VideoProvider
 VideoProvider (const std::string &tag, const std::string &id)
 
- Protected Member Functions inherited from FeedProvider
virtual void distributeFrame (const FramePtr &frame)
 Pass a frame on to all registered consumers. More...
 
void addToMap ()
 Add this provider to the static provider map.
 
void removeFromMap ()
 Remove this provider from the static provider map.
 
virtual void cleanup ()
 Tidy up relations before destruction.
 
void setReady ()
 
void setEnded ()
 
void setError ()
 
- Protected Member Functions inherited from Thread
 Thread (const std::string &threadLabel)
 
 Thread (const char *threadLabel="...")
 
pid_t id () const
 
void exit (long int status=0)
 

Additional Inherited Members

- Public Types inherited from FeedConsumer
typedef std::map< FeedProvider *, FeedLinkProviderMap
 
typedef std::deque< FramePtrFrameQueue
 
- Public Types inherited from FeedProvider
enum  State { PROV_ERROR =-1, PROV_WAIT, PROV_READY, PROV_ENDED }
 
- Public Types inherited from Thread
typedef void *(* ThreadFunc) (void *)
 
- Protected Types inherited from FeedProvider
typedef std::deque< FeedConsumer * > ConsumerList
 
typedef std::map< FeedConsumer *, FeedLinkConsumerMap
 
- Static Protected Member Functions inherited from Thread
static void * mThreadFunc (void *arg)
 
- Protected Attributes inherited from FeedConsumer
Mutex mQueueMutex
 Protects the frame queue.
 
FrameQueue mFrameQueue
 Queue of frames from providers that are ready to be handled.
 
int mProviderLimit
 Max number of providers, many consumers can only have one.
 
Mutex mProviderMutex
 Protects the provider map.
 
ProviderMap mProviders
 Collection of providers.
 
- Protected Attributes inherited from FeedBase
std::string mClass
 Identifier for the class of provider/consumer.
 
std::string mName
 Unique identifier of this provider/consumer instance.
 
- Protected Attributes inherited from FeedProvider
State mState
 Provider state.
 
uint64_t mFrameCount
 Number of frames, advisory only.
 
bool mCanPoll
 Whether consumers can request frames on demand.
 
Mutex mFrameMutex
 Protects the 'on-demand' frame.
 
FramePtr mLastFrame
 The 'on-demand' frame.
 
Mutex mConsumerMutex
 Protects the consumers.
 
ConsumerMap mConsumers
 Collection of frame consumer.
 
bool mHasVideo
 
bool mHasAudio
 
- Protected Attributes inherited from Thread
pthread_t mThread
 Base pthread data.
 
std::string mThreadLabel
 Label to help identify the thread.
 
Mutex mThreadMutex
 Mutex protecting this thread from concurrent access.
 
Condition mThreadCondition
 Used to signal thread states to invoking process/thread.
 
pid_t mTid
 Thread id.
 
bool mRunning
 Flag indicating whether this thread has begun and is running.
 
bool mStop
 Flag indicating whether this thread has been signalled to stop.
 
- Static Protected Attributes inherited from FeedBase
static const int INTERFRAME_TIMEOUT = 10000
 Needs to be short enough to cope with all possible frame rates.This allows for 100fps.
 
- Static Protected Attributes inherited from FeedProvider
static const int RECONNECT_TIMEOUT = 1
 How long to wait before reconnecting to a lost source, in seconds.
 

Detailed Description

Processor that detects motion on a video frame feed and reports on the nature of the motion via MotionFrame objects.

Definition at line 25 of file ozMotionDetector.h.

Constructor & Destructor Documentation

MotionDetector::MotionDetector ( const std::string &  name,
const Options options = gNullOptions 
)
Parameters
name

Definition at line 68 of file ozMotionDetector.cpp.

Member Function Documentation

bool MotionDetector::addZone ( Zone zone)
Parameters
zone
Returns

Definition at line 118 of file ozMotionDetector.cpp.

Here is the caller graph for this function:

bool MotionDetector::analyse ( const Image compImage,
MotionData motionData,
Image motionImage 
)
protected
Parameters
compImage
motionData
motionImage
Returns

Definition at line 238 of file ozMotionDetector.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t MotionDetector::detectMotion ( const Image compImage,
ZoneSet &  motionZones 
)
protected
Parameters
compImage
motionZones
Returns

Definition at line 343 of file ozMotionDetector.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool MotionDetector::inAlarm ( const FramePtr frame,
const FeedConsumer  
)
static
Parameters
frame

Definition at line 543 of file ozMotionDetector.cpp.

int MotionDetector::run ( )
protectedvirtual
Returns

Implements Thread.

Definition at line 129 of file ozMotionDetector.cpp.

Here is the call graph for this function:


The documentation for this class was generated from the following files: