GuardMyPi
Protecting your berries from unauthorised tampering!
Public Member Functions | Public Attributes | Protected Attributes | List of all members
MotionDetector Class Reference

Analyses video feed by using background subtraction with a running average to detect motion changes. More...

#include <guardmypi.h>

Public Member Functions

Mat ProcessContours (Mat camerafeed)
 Takes the incoming frame and performs background subtraction using previous frames. More...
 

Public Attributes

Mat avg
 Running average of the camerafeed.
 
int flag = 0
 Flag variable to invoke ObjectDetector thread t2.
 

Protected Attributes

Mat frame_diff
 Difference output between frames.
 
Mat grayscale
 Grayscaled version of the camera frame.
 
Mat frame_thresh
 Threshold frame.
 
Mat scaled_avg
 8-bit Absolute value frame
 
vector< vector< Point > > cnts
 Vector of points of detected contours.
 
Rect rect
 Up-right rectangle to highlight detected contours.
 
Point pt1
 Start point/coordinate for the contour rectangle.
 
Point pt2
 End point/coordinate for the contour rectangle.
 

Detailed Description

Analyses video feed by using background subtraction with a running average to detect motion changes.

Member Function Documentation

◆ ProcessContours()

Mat MotionDetector::ProcessContours ( Mat  camerafeed)

Takes the incoming frame and performs background subtraction using previous frames.

Performs background subtraction to detect changes in the frame i.e. motion. Subsequently, alters the flag variable equal to 1 if motion is detected to invoke the object detector in a new thread

See also
ObjectDetector::detect Camera::opencam
Parameters
camerafeedframe captured from PiCamera or Webcam
Returns
camerafeed with or without "Motion Detected" text to signify code functioning