Remove spaces, ".", and "-" from ALPR
This commit is contained in:
@@ -450,6 +450,53 @@ namespace ANSCENTER {
|
||||
}
|
||||
}
|
||||
|
||||
// Skip-when-locked query — see header for full contract.
|
||||
//
|
||||
// Returns the locked plate text if the caller may skip OCR this frame for
|
||||
// (cameraId, trackId), or "" if the caller must run OCR. Increments the
|
||||
// re-verify counter on skip; resets it when the counter hits reverifyEvery
|
||||
// so the next frame falls through to a real OCR run.
|
||||
std::string ALPRChecker::tryReuseLockedText(const std::string& cameraId,
|
||||
int trackId,
|
||||
int reverifyEvery) {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
try {
|
||||
auto camIt = trackedPlatesById.find(cameraId);
|
||||
if (camIt == trackedPlatesById.end()) return "";
|
||||
auto& plates = camIt->second;
|
||||
auto it = plates.find(trackId);
|
||||
if (it == plates.end()) return "";
|
||||
|
||||
auto& tp = it->second;
|
||||
if (tp.lockedText.empty()) return ""; // not locked yet — caller must run OCR
|
||||
|
||||
// Locked. Decide whether to skip this frame's OCR or fall through
|
||||
// for a periodic re-verify. reverifyEvery <= 0 means "always skip"
|
||||
// (no re-verify), reverifyEvery == 1 means "always run OCR".
|
||||
if (reverifyEvery > 0 && tp.framesSinceVerify >= reverifyEvery) {
|
||||
tp.framesSinceVerify = 0;
|
||||
ANS_DBG("ALPR_TrackId",
|
||||
"cam=%s tid=%d REVERIFY (every=%d) — letting OCR through",
|
||||
cameraId.c_str(), trackId, reverifyEvery);
|
||||
return ""; // signal: caller should run OCR this frame
|
||||
}
|
||||
|
||||
++tp.framesSinceVerify;
|
||||
// Keep the entry alive — checkPlateByTrackId is what normally
|
||||
// resets framesSinceLastSeen, but on skipped frames it's never
|
||||
// called, and the prune pass would eventually delete this lock.
|
||||
tp.framesSinceLastSeen = 0;
|
||||
ANS_DBG("ALPR_TrackId",
|
||||
"cam=%s tid=%d SKIP-LOCKED text='%s' reverifyIn=%d",
|
||||
cameraId.c_str(), trackId, tp.lockedText.c_str(),
|
||||
reverifyEvery > 0 ? (reverifyEvery - tp.framesSinceVerify) : -1);
|
||||
return tp.lockedText;
|
||||
}
|
||||
catch (const std::exception&) {
|
||||
return ""; // any failure → fall back to running OCR
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
static void VerifyGlobalANSALPRLicense(const std::string& licenseKey) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user