Adjust video frame capture dimensions and button size for improved OCR alignment. Update related comments and increment version code to 4.72.792 to reflect these changes.
This commit is contained in:
@ -488,46 +488,25 @@
|
||||
});
|
||||
}
|
||||
|
||||
// MSIN-4401 — Un numero de dossard = tous les chiffres lus dans le cadre
|
||||
// (ex. OCR "5 2 1" ou "521" → "521"). Un chiffre seul = "5".
|
||||
function extractBibNumber(raw) {
|
||||
var matches = String(raw || '').match(/\d+/g);
|
||||
if (!matches || !matches.length) {
|
||||
var digits = String(raw || '').replace(/\D/g, '');
|
||||
if (digits.length < 1 || digits.length > BIB_MAX_LEN) {
|
||||
return '';
|
||||
}
|
||||
if (matches.length === 1) {
|
||||
var one = matches[0];
|
||||
return (one.length >= 1 && one.length <= BIB_MAX_LEN) ? one : '';
|
||||
}
|
||||
// OCR decoupe souvent un dossard manuscrit en chiffres isoles ("5" "2" "1").
|
||||
var allSingles = true;
|
||||
var i;
|
||||
for (i = 0; i < matches.length; i++) {
|
||||
if (matches[i].length !== 1) {
|
||||
allSingles = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allSingles) {
|
||||
var joined = matches.join('');
|
||||
return (joined.length <= BIB_MAX_LEN) ? joined : '';
|
||||
}
|
||||
// Sinon : le groupe le plus long s'il domine clairement (evite 2 dossards).
|
||||
var sorted = matches.slice().sort(function (a, b) { return b.length - a.length; });
|
||||
if (sorted[0].length <= BIB_MAX_LEN && sorted[0].length > sorted[1].length) {
|
||||
return sorted[0];
|
||||
}
|
||||
return '';
|
||||
return digits;
|
||||
}
|
||||
|
||||
// MSIN-4401 — Crop central du flux video (comme avant le polish UI).
|
||||
// Zone un peu large pour un numero manuscrit entier dans le viseur.
|
||||
// Crop central du flux video — region du cadre blanc (~55% x 30%).
|
||||
function captureCenterFrame(videoEl) {
|
||||
if (!videoEl || !videoEl.videoWidth) {
|
||||
return null;
|
||||
}
|
||||
var w = videoEl.videoWidth;
|
||||
var h = videoEl.videoHeight;
|
||||
var cropW = Math.round(w * 0.7);
|
||||
var cropH = Math.round(h * 0.4);
|
||||
var cropW = Math.round(w * 0.55);
|
||||
var cropH = Math.round(h * 0.3);
|
||||
var sx = Math.round((w - cropW) / 2);
|
||||
var sy = Math.round((h - cropH) / 2);
|
||||
var canvas = document.createElement('canvas');
|
||||
|
||||
Reference in New Issue
Block a user