Remove spaces, ".", and "-" from ALPR
This commit is contained in:
@@ -47,6 +47,14 @@ namespace ANSCENTER
|
||||
std::string lockedText;
|
||||
int lockCount = 0;
|
||||
int framesSinceLastSeen = 0;
|
||||
// Frames since the last full OCR was used to verify the lock. When
|
||||
// skip-when-locked is active in ANSALPR_OCR::RunInference, this
|
||||
// counter increments on every frame whose OCR was skipped; once it
|
||||
// reaches the re-verify period, the next frame falls through to a
|
||||
// real OCR run (resetting the counter) so a stale or wrong lock
|
||||
// can self-correct via majority-vote re-lock. Zero when not in
|
||||
// use (e.g. raw OCR pass-through, pipeline mode).
|
||||
int framesSinceVerify = 0;
|
||||
};
|
||||
// cameraId → (trackId → tracked plate)
|
||||
std::unordered_map<std::string, std::unordered_map<int, TrackedPlateById>> trackedPlatesById;
|
||||
@@ -61,6 +69,26 @@ namespace ANSCENTER
|
||||
[[nodiscard]] std::string checkPlate(const std::string& cameraId, const std::string& detectedPlate, const cv::Rect& plateBox);
|
||||
// Hybrid API: trackId as primary identity, Levenshtein fallback for lost tracks
|
||||
[[nodiscard]] std::string checkPlateByTrackId(const std::string& cameraId, const std::string& detectedPlate, int trackId);
|
||||
|
||||
// Skip-when-locked query: returns the locked plate text for (cameraId, trackId)
|
||||
// if the caller may safely SKIP running OCR this frame, or an empty string if
|
||||
// the caller must run OCR and feed the result back through checkPlateByTrackId.
|
||||
//
|
||||
// Behaviour:
|
||||
// * Track not found, or found but not locked yet → returns "".
|
||||
// * Locked, and < `reverifyEvery` frames since the last full OCR for this
|
||||
// track → returns the locked text and increments the per-track
|
||||
// re-verify counter. Caller skips the recognizer entirely.
|
||||
// * Locked, and ≥ `reverifyEvery` frames since the last full OCR →
|
||||
// returns "" and resets the counter, so the caller runs OCR this frame
|
||||
// and the regular voting/re-lock logic in checkPlateByTrackId can
|
||||
// self-correct a wrong lock or notice a vehicle swap on the same trackId.
|
||||
//
|
||||
// Side-effect: also resets framesSinceLastSeen so the periodic prune pass
|
||||
// in checkPlateByTrackId does not retire a track just because we skipped
|
||||
// OCR on it. Without this the locked plate would silently disappear from
|
||||
// the registry after a few hundred skipped frames.
|
||||
[[nodiscard]] std::string tryReuseLockedText(const std::string& cameraId, int trackId, int reverifyEvery = 30);
|
||||
};
|
||||
|
||||
class ANSLPR_API ANSALPR {
|
||||
|
||||
Reference in New Issue
Block a user