veryfi-lens-wasm 2.6.0-beta.2 → 2.6.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/checkImages.js +4 -1
- package/package.json +1 -1
- package/veryfi-lens.js +33 -21
|
@@ -133,9 +133,12 @@ export const createCheckImages = (container, options = {}) => {
|
|
|
133
133
|
const frontImageElement = createImageElement(frontImg, 'Front of check', isPortrait, forceLandscape);
|
|
134
134
|
const backImageElement = createImageElement(backImg, 'Back of check', isPortrait, forceLandscape);
|
|
135
135
|
|
|
136
|
-
// Hide crop image reference
|
|
136
|
+
// Hide crop image reference and its preview overlay
|
|
137
137
|
if (cropImgRef) {
|
|
138
138
|
cropImgRef.style.display = 'none';
|
|
139
|
+
if (cropImgRef.previewImg) {
|
|
140
|
+
cropImgRef.previewImg.style.display = 'none';
|
|
141
|
+
}
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
// Clear container and append new images
|
package/package.json
CHANGED
package/veryfi-lens.js
CHANGED
|
@@ -2122,10 +2122,12 @@ const VeryfiLens = (function () {
|
|
|
2122
2122
|
stopLens();
|
|
2123
2123
|
|
|
2124
2124
|
let documentLcdResult = null;
|
|
2125
|
-
if (state.lcdDetectionForDocuments && wasmWrapper && wasmWrapper.isDocumentLCDDetectorReady() && state.
|
|
2125
|
+
if (state.lcdDetectionForDocuments && wasmWrapper && wasmWrapper.isDocumentLCDDetectorReady() && state.cropImgRef) {
|
|
2126
2126
|
state.debug_mode && console.log("[AutoCapture] Running LCD detection...");
|
|
2127
2127
|
try {
|
|
2128
|
-
|
|
2128
|
+
const croppedBitmap = await createImageBitmap(state.cropImgRef);
|
|
2129
|
+
documentLcdResult = wasmWrapper.detectDocumentLCD(croppedBitmap);
|
|
2130
|
+
croppedBitmap.close();
|
|
2129
2131
|
state.debug_mode && console.log("[AutoCapture] LCD result:", documentLcdResult);
|
|
2130
2132
|
} catch (error) {
|
|
2131
2133
|
console.error("[AutoCapture] Error running LCD detection:", error);
|
|
@@ -2234,12 +2236,14 @@ const VeryfiLens = (function () {
|
|
|
2234
2236
|
|
|
2235
2237
|
// Process the document
|
|
2236
2238
|
if (state.lensFlavor !== 'checks') {
|
|
2237
|
-
// Run LCD detection on the
|
|
2239
|
+
// Run LCD detection on the cropped document image
|
|
2238
2240
|
let documentLcdResult = null;
|
|
2239
|
-
if (state.lcdDetectionForDocuments && wasmWrapper && wasmWrapper.isDocumentLCDDetectorReady() && state.
|
|
2240
|
-
state.debug_mode && console.log("Running LCD detection on document
|
|
2241
|
+
if (state.lcdDetectionForDocuments && wasmWrapper && wasmWrapper.isDocumentLCDDetectorReady() && state.cropImgRef) {
|
|
2242
|
+
state.debug_mode && console.log("Running LCD detection on document...");
|
|
2241
2243
|
try {
|
|
2242
|
-
|
|
2244
|
+
const croppedBitmap = await createImageBitmap(state.cropImgRef);
|
|
2245
|
+
documentLcdResult = wasmWrapper.detectDocumentLCD(croppedBitmap);
|
|
2246
|
+
croppedBitmap.close();
|
|
2243
2247
|
state.debug_mode && console.log("Document LCD result:", documentLcdResult);
|
|
2244
2248
|
} catch (error) {
|
|
2245
2249
|
console.error("Error running LCD detection on document:", error);
|
|
@@ -2356,12 +2360,14 @@ const VeryfiLens = (function () {
|
|
|
2356
2360
|
return;
|
|
2357
2361
|
}
|
|
2358
2362
|
|
|
2359
|
-
// Run LCD detection on the
|
|
2363
|
+
// Run LCD detection on the cropped check image
|
|
2360
2364
|
state.frontLcdResult = null;
|
|
2361
|
-
if (state.lcdDetectionForChecks && wasmWrapper && wasmWrapper.isDocumentLCDDetectorReady() && state.
|
|
2362
|
-
state.debug_mode && console.log("Running LCD detection on front check
|
|
2365
|
+
if (state.lcdDetectionForChecks && wasmWrapper && wasmWrapper.isDocumentLCDDetectorReady() && state.cropImgRef) {
|
|
2366
|
+
state.debug_mode && console.log("Running LCD detection on front check...");
|
|
2363
2367
|
try {
|
|
2364
|
-
|
|
2368
|
+
const croppedBitmap = await createImageBitmap(state.cropImgRef);
|
|
2369
|
+
state.frontLcdResult = wasmWrapper.detectDocumentLCD(croppedBitmap);
|
|
2370
|
+
croppedBitmap.close();
|
|
2365
2371
|
state.debug_mode && console.log("Front check LCD result:", state.frontLcdResult);
|
|
2366
2372
|
// Set LCD status based on detection result using configurable threshold
|
|
2367
2373
|
state.lcdStatus = state.frontLcdResult.is_lcd || (state.frontLcdResult.lcdProb !== undefined && state.frontLcdResult.lcdProb > state.lcdThreshold);
|
|
@@ -2371,12 +2377,14 @@ const VeryfiLens = (function () {
|
|
|
2371
2377
|
}
|
|
2372
2378
|
}
|
|
2373
2379
|
|
|
2374
|
-
// Run front/back detection on the
|
|
2380
|
+
// Run front/back detection on the cropped check image
|
|
2375
2381
|
state.frontFrontBackResult = null;
|
|
2376
|
-
if (state.frontBackDetectionForChecks && wasmWrapper && wasmWrapper.isFrontBackDetectorReady() && state.
|
|
2382
|
+
if (state.frontBackDetectionForChecks && wasmWrapper && wasmWrapper.isFrontBackDetectorReady() && state.cropImgRef) {
|
|
2377
2383
|
state.debug_mode && console.log("[FrontBack] Running front/back detection on front check...");
|
|
2378
2384
|
try {
|
|
2379
|
-
|
|
2385
|
+
const croppedBitmap = await createImageBitmap(state.cropImgRef);
|
|
2386
|
+
state.frontFrontBackResult = wasmWrapper.detectFrontBack(croppedBitmap);
|
|
2387
|
+
croppedBitmap.close();
|
|
2380
2388
|
state.frontBackStatus = state.frontFrontBackResult;
|
|
2381
2389
|
state.debug_mode && console.log("[FrontBack] Front check result:", state.frontFrontBackResult);
|
|
2382
2390
|
} catch (error) {
|
|
@@ -2582,12 +2590,14 @@ const VeryfiLens = (function () {
|
|
|
2582
2590
|
return;
|
|
2583
2591
|
}
|
|
2584
2592
|
|
|
2585
|
-
// Run LCD detection on the
|
|
2593
|
+
// Run LCD detection on the cropped check image
|
|
2586
2594
|
let backLcdResult = null;
|
|
2587
|
-
if (state.lcdDetectionForChecks && wasmWrapper && wasmWrapper.isDocumentLCDDetectorReady() && state.
|
|
2588
|
-
state.debug_mode && console.log("Running LCD detection on back check
|
|
2595
|
+
if (state.lcdDetectionForChecks && wasmWrapper && wasmWrapper.isDocumentLCDDetectorReady() && state.cropImgRef) {
|
|
2596
|
+
state.debug_mode && console.log("Running LCD detection on back check...");
|
|
2589
2597
|
try {
|
|
2590
|
-
|
|
2598
|
+
const croppedBitmap = await createImageBitmap(state.cropImgRef);
|
|
2599
|
+
backLcdResult = wasmWrapper.detectDocumentLCD(croppedBitmap);
|
|
2600
|
+
croppedBitmap.close();
|
|
2591
2601
|
state.debug_mode && console.log("Back check LCD result:", backLcdResult);
|
|
2592
2602
|
// Set LCD status based on detection result using configurable threshold
|
|
2593
2603
|
state.lcdStatus = backLcdResult.is_lcd || (backLcdResult.lcd_prob !== undefined && backLcdResult.lcd_prob > state.lcdThreshold);
|
|
@@ -2597,16 +2607,18 @@ const VeryfiLens = (function () {
|
|
|
2597
2607
|
}
|
|
2598
2608
|
}
|
|
2599
2609
|
|
|
2600
|
-
// Run front/back detection on the
|
|
2610
|
+
// Run front/back detection on the cropped check image
|
|
2601
2611
|
let backFrontBackResult = null;
|
|
2602
2612
|
console.log("[FrontBack] Back check - enabled:", state.frontBackDetectionForChecks,
|
|
2603
2613
|
"wasmWrapper:", !!wasmWrapper,
|
|
2604
2614
|
"detectorReady:", wasmWrapper?.isFrontBackDetectorReady?.(),
|
|
2605
|
-
"
|
|
2606
|
-
if (state.frontBackDetectionForChecks && wasmWrapper && wasmWrapper.isFrontBackDetectorReady() && state.
|
|
2615
|
+
"cropImgRef:", !!state.cropImgRef);
|
|
2616
|
+
if (state.frontBackDetectionForChecks && wasmWrapper && wasmWrapper.isFrontBackDetectorReady() && state.cropImgRef) {
|
|
2607
2617
|
console.log("[FrontBack] Running front/back detection on back check...");
|
|
2608
2618
|
try {
|
|
2609
|
-
|
|
2619
|
+
const croppedBitmap = await createImageBitmap(state.cropImgRef);
|
|
2620
|
+
backFrontBackResult = wasmWrapper.detectFrontBack(croppedBitmap);
|
|
2621
|
+
croppedBitmap.close();
|
|
2610
2622
|
state.frontBackStatus = backFrontBackResult;
|
|
2611
2623
|
console.log("[FrontBack] Back check result:", backFrontBackResult);
|
|
2612
2624
|
} catch (error) {
|