-adjusted config defaults

Attempting to slow down motion detection again. This time it should
properly match the camera's fps.
This commit is contained in:
Maurice ONeal 2023-04-21 16:01:14 -04:00
parent b4ca30b0e1
commit 3f3cbcc75b
3 changed files with 11 additions and 7 deletions

View File

@ -175,9 +175,9 @@ string genDstFile(const string &dirOut, const char *fmt, const string &ext)
return cleanDir(dirOut) + string("/") + genTimeStr(fmt) + 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 &param, const string &line, string *value) void rdLine(const string &param, const string &line, string *value)
@ -252,7 +252,7 @@ bool rdConf(shared_t *share)
share->skipCmd = false; share->skipCmd = false;
share->postSecs = 60; share->postSecs = 60;
share->evMaxSecs = 10; share->evMaxSecs = 10;
share->frameGap = 5; share->frameGap = 10;
share->webRoot = "/var/www/html"; share->webRoot = "/var/www/html";
share->webBg = "#485564"; share->webBg = "#485564";
share->webTxt = "#dee5ee"; share->webTxt = "#dee5ee";

View File

@ -34,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.1.t2" #define APP_VER "2.1.t3"
#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"
@ -81,7 +81,7 @@ struct shared_t
string genVidNameFromLive(const string &tsPath); string genVidNameFromLive(const string &tsPath);
string genEventPath(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 genDstFile(const string &dirOut, const char *fmt, const string &ext);
string genTimeStr(const char *fmt); string genTimeStr(const char *fmt);
string cleanDir(const string &path); string cleanDir(const string &path);

View File

@ -42,7 +42,7 @@ void detectMoInStream(const string &streamFile, shared_t *share)
if (!share->curEvent.srcPaths.empty()) if (!share->curEvent.srcPaths.empty())
{ {
share->curEvent.evName = genEventName(); share->curEvent.evName = genEventName(share->maxScore);
share->recList.push_back(share->curEvent); 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); 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 prev;
Mat next; 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()) if (prev.empty())
{ {
capture.retrieve(prev); capture.retrieve(prev);