v2.0
updated documentation and cleaned up the code. preparing to release to master.
This commit is contained in:
parent
83b206c06c
commit
19872b3ff5
63
README.md
63
README.md
|
@ -44,76 +44,39 @@ web_root = /var/www/html
|
||||||
# warning: this will overwrite any existing index.html files so be sure
|
# warning: this will overwrite any existing index.html files so be sure
|
||||||
# to choose a directory that doesn't have an existing website.
|
# to choose a directory that doesn't have an existing website.
|
||||||
#
|
#
|
||||||
buff_dir = /tmp
|
|
||||||
# this application records small clips of the footage from the camera and
|
|
||||||
# then stores them into this directory. any clips with motion detected in
|
|
||||||
# them are moved to web_root; if no motion is detected, they are deleted.
|
|
||||||
# it is highly recommend to use a ramdisk tempfs for this since this
|
|
||||||
# directory is used for large amounts of writes.
|
|
||||||
#
|
|
||||||
cam_name = cam-1
|
cam_name = cam-1
|
||||||
# this is the optional camera name parameter to identify the camera. this
|
# this is the optional camera name parameter to identify the camera. this
|
||||||
# name will be used to form the directory structure in the web_root as
|
# name will also be used to as the base directory in web_root. if not
|
||||||
# well as buff_dir. if not defined, the name of the config file will be
|
# defined, the name of the config file will be used.
|
||||||
# used.
|
|
||||||
#
|
#
|
||||||
pix_thresh = 150
|
pix_thresh = 150
|
||||||
# this value tells the application how far different the pixels need to be
|
# this value tells the application how far different the pixels need to be
|
||||||
# before the pixels are actually considered different. think of this as
|
# before the pixels are actually considered different. think of this as
|
||||||
# pixel diff sensitivity, the higher the value the lesser the sensitivity.
|
# pixel diff sensitivity, the higher the value the lesser the sensitivity.
|
||||||
#
|
# maximum is 255.
|
||||||
frame_gap = 20
|
|
||||||
# this value is used to tell the application how far in between frames to
|
|
||||||
# check the pixel diffs for motion. the lower the value, the more frames
|
|
||||||
# will be checked, however with that comes higher cpu usage.
|
|
||||||
#
|
#
|
||||||
img_thresh = 80000
|
img_thresh = 80000
|
||||||
# this indicates how many pixels need to be different in between frame_gap
|
# this indicates how many pixels need to be different in between frames
|
||||||
# before it is considered motion. any video clips found with frames
|
# before it is considered motion. any video clips found with frames
|
||||||
# exceeding this value will be moved from buff_dir to web_root.
|
# exceeding this value will be copied from live footage to event footage.
|
||||||
#
|
#
|
||||||
clip_len = 20
|
max_events = 40
|
||||||
# this parameter indicate the amount of seconds to record in each video
|
# this indicates the maximum amount of motion event video clips to keep
|
||||||
# clip from the camera that will be stored and then processed in buff_dir.
|
# before deleting the oldest clip.
|
||||||
#
|
#
|
||||||
num_of_clips = 3
|
sch_sec = 60
|
||||||
# this will tell the application how many video clips should be recorded
|
# this is the amount of seconds to wait in between running post_cmd.
|
||||||
# to buff_dir from the camera before the recording loop pauses to do some
|
|
||||||
# house keeping. by house keeping, it will wait until all motion detection
|
|
||||||
# threads are finished, reload the config file and then call the post_cmd
|
|
||||||
# if no motion was detected in any of the video clips.
|
|
||||||
#
|
#
|
||||||
post_cmd = move_the_ptz_camera.py
|
post_cmd = move_the_ptz_camera.py
|
||||||
# this an optional command to run after num_of_clips is met. one great use
|
# this an optional command to run with sch_sec. one great use for this
|
||||||
# for this is to move a ptz camera to the next position of it's patrol
|
# is to move a ptz camera to the next position of it's patrol pattern.
|
||||||
# pattern. note: the call to this command will be delayed if motion was
|
# note: the call to this command will be delayed if motion was detected.
|
||||||
# detected.
|
|
||||||
#
|
|
||||||
max_days = 15
|
|
||||||
# this defines the maximum amount of days worth of video clips that is
|
|
||||||
# allowed to be stored in the web_root. whenever this limit is met, the
|
|
||||||
# oldest day and all of it's associated video clips will be deleted.
|
|
||||||
#
|
|
||||||
max_clips = 30
|
|
||||||
# this is the maximum amount of video clips that is allowed to be stored
|
|
||||||
# in web_root per day. whenever this limit is met, the oldest clip is
|
|
||||||
# deleted.
|
|
||||||
#
|
#
|
||||||
max_log_size = 50000
|
max_log_size = 50000
|
||||||
# this is the maximum byte size of all log files that can be stored in
|
# this is the maximum byte size of all log files that can be stored in
|
||||||
# web_root. whenever this limit is met, the log file will be deleted and
|
# web_root. whenever this limit is met, the log file will be deleted and
|
||||||
# then eventually recreated blank.
|
# then eventually recreated blank.
|
||||||
#
|
#
|
||||||
vid_container = mp4
|
|
||||||
# this is the video file format to use for recording footage from the
|
|
||||||
# camera. the format support depends entirely on the under laying ffmpeg
|
|
||||||
# installation.
|
|
||||||
#
|
|
||||||
vid_codec = copy
|
|
||||||
# this is the video codec to use when pulling footage from the camera
|
|
||||||
# via ffmpeg. the default is "copy" meaning it will just match the codec
|
|
||||||
# from the camera itself without trans-coding.
|
|
||||||
#
|
|
||||||
web_text = #dee5ee
|
web_text = #dee5ee
|
||||||
# this can be used to customize the color of the text in the web
|
# this can be used to customize the color of the text in the web
|
||||||
# interface. it can be defined as any color understood by html5 standard.
|
# interface. it can be defined as any color understood by html5 standard.
|
||||||
|
|
|
@ -221,7 +221,6 @@ bool rdConf(const string &filePath, shared_t *share)
|
||||||
rdLine("post_cmd = ", line, &share->postCmd);
|
rdLine("post_cmd = ", line, &share->postCmd);
|
||||||
rdLine("pix_thresh = ", line, &share->pixThresh);
|
rdLine("pix_thresh = ", line, &share->pixThresh);
|
||||||
rdLine("img_thresh = ", line, &share->imgThresh);
|
rdLine("img_thresh = ", line, &share->imgThresh);
|
||||||
rdLine("max_days = ", line, &share->maxDays);
|
|
||||||
rdLine("max_events = ", line, &share->maxEvents);
|
rdLine("max_events = ", line, &share->maxEvents);
|
||||||
rdLine("max_log_size = ", line, &share->maxLogSize);
|
rdLine("max_log_size = ", line, &share->maxLogSize);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +240,6 @@ bool rdConf(shared_t *share)
|
||||||
share->retCode = 0;
|
share->retCode = 0;
|
||||||
share->pixThresh = 50;
|
share->pixThresh = 50;
|
||||||
share->imgThresh = 800;
|
share->imgThresh = 800;
|
||||||
share->maxDays = 15;
|
|
||||||
share->maxEvents = 40;
|
share->maxEvents = 40;
|
||||||
share->maxLogSize = 50000;
|
share->maxLogSize = 50000;
|
||||||
share->skipCmd = false;
|
share->skipCmd = false;
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unistd.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -24,10 +23,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <mutex>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include <opencv4/opencv2/opencv.hpp>
|
#include <opencv4/opencv2/opencv.hpp>
|
||||||
|
@ -38,7 +34,7 @@ using namespace std;
|
||||||
using namespace std::filesystem;
|
using namespace std::filesystem;
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
|
|
||||||
#define APP_VER "2.0.t13"
|
#define APP_VER "2.0"
|
||||||
#define APP_NAME "Motion Watch"
|
#define APP_NAME "Motion Watch"
|
||||||
#define REC_LOG_NAME "rec_log_lines.html"
|
#define REC_LOG_NAME "rec_log_lines.html"
|
||||||
#define DET_LOG_NAME "det_log_lines.html"
|
#define DET_LOG_NAME "det_log_lines.html"
|
||||||
|
@ -67,14 +63,11 @@ struct shared_t
|
||||||
string webTxt;
|
string webTxt;
|
||||||
string webFont;
|
string webFont;
|
||||||
string webRoot;
|
string webRoot;
|
||||||
mutex detMutex;
|
|
||||||
bool skipCmd;
|
bool skipCmd;
|
||||||
int procTime;
|
int procTime;
|
||||||
int schSec;
|
int schSec;
|
||||||
int frameGap;
|
|
||||||
int pixThresh;
|
int pixThresh;
|
||||||
int imgThresh;
|
int imgThresh;
|
||||||
int maxDays;
|
|
||||||
int maxEvents;
|
int maxEvents;
|
||||||
int maxLogSize;
|
int maxLogSize;
|
||||||
int retCode;
|
int retCode;
|
||||||
|
|
|
@ -118,8 +118,6 @@ bool moDetect(const string &buffFile, Mat &vidThumb, shared_t *share)
|
||||||
{
|
{
|
||||||
capture.retrieve(next);
|
capture.retrieve(next);
|
||||||
|
|
||||||
lock_guard<mutex> guard(share->detMutex);
|
|
||||||
|
|
||||||
if (!next.empty())
|
if (!next.empty())
|
||||||
{
|
{
|
||||||
if (imgDiff(prev, next, score, share))
|
if (imgDiff(prev, next, score, share))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user