diff --git a/src/common.cpp b/src/common.cpp index 1a530a6..e5cfece 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -175,9 +175,9 @@ string genDstFile(const string &dirOut, const char *fmt, const string &ext) return cleanDir(dirOut) + string("/") + genTimeStr(fmt) + ext; } -string genEventName() +string genEventName(int score) { - return genTimeStr("%Y-%j-%H-%M"); + return genTimeStr(string("%Y-%j-%H-%M-%S--" + to_string(score)).c_str()); } void rdLine(const string ¶m, const string &line, string *value) @@ -252,7 +252,7 @@ bool rdConf(shared_t *share) share->skipCmd = false; share->postSecs = 60; share->evMaxSecs = 10; - share->frameGap = 5; + share->frameGap = 10; share->webRoot = "/var/www/html"; share->webBg = "#485564"; share->webTxt = "#dee5ee"; diff --git a/src/common.h b/src/common.h index f9a8eb1..d0dbd9b 100644 --- a/src/common.h +++ b/src/common.h @@ -34,7 +34,7 @@ using namespace std; using namespace std::filesystem; using namespace std::chrono; -#define APP_VER "2.1.t2" +#define APP_VER "2.1.t3" #define APP_NAME "Motion Watch" #define REC_LOG_NAME "rec_log_lines.html" #define DET_LOG_NAME "det_log_lines.html" @@ -81,7 +81,7 @@ struct shared_t string genVidNameFromLive(const string &tsPath); string genEventPath(const string &tsPath); -string genEventName(); +string genEventName(int score); string genDstFile(const string &dirOut, const char *fmt, const string &ext); string genTimeStr(const char *fmt); string cleanDir(const string &path); diff --git a/src/mo_detect.cpp b/src/mo_detect.cpp index 1a51833..43d4907 100644 --- a/src/mo_detect.cpp +++ b/src/mo_detect.cpp @@ -42,7 +42,7 @@ void detectMoInStream(const string &streamFile, shared_t *share) if (!share->curEvent.srcPaths.empty()) { - share->curEvent.evName = genEventName(); + share->curEvent.evName = genEventName(share->maxScore); share->recList.push_back(share->curEvent); detLog("motion detected in " + to_string(share->curEvent.srcPaths.size()) + " file(s) in " + to_string(share->evMaxSecs) + " secs", share); @@ -124,8 +124,12 @@ bool moDetect(const string &buffFile, shared_t *share) Mat prev; Mat next; - for (auto gap = 0; capture.grab(); ++gap) + int fps = capture.get(cv::CAP_PROP_FPS); + + for (auto gap = 0, frm = fps; capture.grab(); ++gap, ++frm) { + if (frm == fps) sleep(1); frm = 1; + if (prev.empty()) { capture.retrieve(prev);