@ekyc_qoobiss/qbs-ect-cmp 4.7.24 → 4.7.25
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/dist/cjs/agreement-info_23.cjs.entry.js +77 -72
- package/dist/cjs/agreement-info_23.cjs.entry.js.map +1 -1
- package/dist/collection/components/common/id-auto-capture/id-auto-capture.js +76 -71
- package/dist/collection/components/common/id-auto-capture/id-auto-capture.js.map +1 -1
- package/dist/esm/agreement-info_23.entry.js +77 -72
- package/dist/esm/agreement-info_23.entry.js.map +1 -1
- package/dist/qbs-ect-cmp/{p-a284f87f.entry.js → p-536691cf.entry.js} +2 -2
- package/dist/qbs-ect-cmp/p-536691cf.entry.js.map +1 -0
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/package.json +1 -1
- package/dist/qbs-ect-cmp/p-a284f87f.entry.js.map +0 -1
|
@@ -592,88 +592,93 @@ const IdAutoCapture = class {
|
|
|
592
592
|
// Method for continuous video frame processing with OpenCV
|
|
593
593
|
this.processVideoFrame = () => {
|
|
594
594
|
if (this.videoElement && this.processingCanvasElement && this.opencvReady && this.isDetecting) {
|
|
595
|
-
console.log('Processing frame. cv.Mat is a constructor:', typeof cv.Mat === 'function');
|
|
596
|
-
const video = this.videoElement;
|
|
597
|
-
const processingCanvas = this.processingCanvasElement;
|
|
598
|
-
const context = processingCanvas.getContext('2d');
|
|
599
|
-
processingCanvas.width = video.videoWidth;
|
|
600
|
-
processingCanvas.height = video.videoHeight;
|
|
601
|
-
context.drawImage(video, 0, 0, processingCanvas.width, processingCanvas.height);
|
|
602
|
-
const imageData = context.getImageData(0, 0, processingCanvas.width, processingCanvas.height);
|
|
603
|
-
// --- OpenCV.js processing starts here ---
|
|
604
|
-
let src = new cv.Mat(processingCanvas.height, processingCanvas.width, cv.CV_8UC4);
|
|
605
|
-
src.data.set(imageData.data);
|
|
606
|
-
let gray = new cv.Mat();
|
|
607
|
-
let blurred = new cv.Mat();
|
|
608
|
-
let edges = new cv.Mat();
|
|
609
|
-
let contours = new cv.MatVector();
|
|
610
|
-
let hierarchy = new cv.Mat();
|
|
611
595
|
try {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
596
|
+
console.log('Processing frame. cv.Mat is a constructor:', typeof cv.Mat === 'function');
|
|
597
|
+
const video = this.videoElement;
|
|
598
|
+
const processingCanvas = this.processingCanvasElement;
|
|
599
|
+
const context = processingCanvas.getContext('2d');
|
|
600
|
+
processingCanvas.width = video.videoWidth;
|
|
601
|
+
processingCanvas.height = video.videoHeight;
|
|
602
|
+
context.drawImage(video, 0, 0, processingCanvas.width, processingCanvas.height);
|
|
603
|
+
const imageData = context.getImageData(0, 0, processingCanvas.width, processingCanvas.height);
|
|
604
|
+
// --- OpenCV.js processing starts here ---
|
|
605
|
+
let src = new cv.Mat(processingCanvas.height, processingCanvas.width, cv.CV_8UC4);
|
|
606
|
+
src.data.set(imageData.data);
|
|
607
|
+
let gray = new cv.Mat();
|
|
608
|
+
let blurred = new cv.Mat();
|
|
609
|
+
let edges = new cv.Mat();
|
|
610
|
+
let contours = new cv.MatVector();
|
|
611
|
+
let hierarchy = new cv.Mat();
|
|
612
|
+
try {
|
|
613
|
+
cv.cvtColor(src, gray, cv.COLOR_RGBA2GRAY, 0);
|
|
614
|
+
cv.GaussianBlur(gray, blurred, new cv.Size(5, 5), 0, 0, cv.BORDER_DEFAULT);
|
|
615
|
+
cv.Canny(blurred, edges, 75, 200, 3, false);
|
|
616
|
+
cv.findContours(edges, contours, hierarchy, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE);
|
|
617
|
+
let idDetected = false;
|
|
618
|
+
let maxArea = 0;
|
|
619
|
+
//let bestRect = null;
|
|
620
|
+
for (let i = 0; i < contours.size(); ++i) {
|
|
621
|
+
let contour = contours.get(i);
|
|
622
|
+
let area = cv.contourArea(contour);
|
|
623
|
+
if (area > 1000 && area > maxArea) {
|
|
624
|
+
let peri = cv.arcLength(contour, true);
|
|
625
|
+
let approx = new cv.Mat();
|
|
626
|
+
cv.approxPolyDP(contour, approx, 0.02 * peri, true);
|
|
627
|
+
if (approx.rows === 4) {
|
|
628
|
+
let rect = cv.boundingRect(approx);
|
|
629
|
+
const aspectRatio = rect.width / rect.height;
|
|
630
|
+
if (aspectRatio > 1.4 && aspectRatio < 1.8) {
|
|
631
|
+
if (rect.width > video.videoWidth * 0.3 && rect.height > video.videoHeight * 0.3) {
|
|
632
|
+
idDetected = true;
|
|
633
|
+
maxArea = area;
|
|
634
|
+
//bestRect = rect;
|
|
635
|
+
}
|
|
634
636
|
}
|
|
635
637
|
}
|
|
638
|
+
approx.delete();
|
|
639
|
+
}
|
|
640
|
+
contour.delete();
|
|
641
|
+
}
|
|
642
|
+
if (idDetected) {
|
|
643
|
+
console.log('ID document detected! Starting countdown...');
|
|
644
|
+
this.countdown = 3;
|
|
645
|
+
if (this.animationFrameId !== null) {
|
|
646
|
+
cancelAnimationFrame(this.animationFrameId); // Stop continuous frame processing
|
|
647
|
+
this.animationFrameId = null;
|
|
636
648
|
}
|
|
637
|
-
|
|
649
|
+
const timer = setInterval(() => {
|
|
650
|
+
this.countdown--;
|
|
651
|
+
if (this.countdown <= 0) {
|
|
652
|
+
clearInterval(timer);
|
|
653
|
+
this.capture();
|
|
654
|
+
this.stopRecording();
|
|
655
|
+
this.isDetecting = false;
|
|
656
|
+
console.log('Picture taken. You can now stop recording.');
|
|
657
|
+
this.countdown = 0; // Ensure countdown is 0
|
|
658
|
+
}
|
|
659
|
+
}, 1000);
|
|
638
660
|
}
|
|
639
|
-
contour.delete();
|
|
640
661
|
}
|
|
641
|
-
|
|
642
|
-
console.
|
|
643
|
-
this.
|
|
662
|
+
catch (error) {
|
|
663
|
+
console.error('OpenCV processing error:', error);
|
|
664
|
+
this.isDetecting = false; // Stop detection on error
|
|
644
665
|
if (this.animationFrameId !== null) {
|
|
645
|
-
cancelAnimationFrame(this.animationFrameId);
|
|
666
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
646
667
|
this.animationFrameId = null;
|
|
647
668
|
}
|
|
648
|
-
const timer = setInterval(() => {
|
|
649
|
-
this.countdown--;
|
|
650
|
-
if (this.countdown <= 0) {
|
|
651
|
-
clearInterval(timer);
|
|
652
|
-
this.capture();
|
|
653
|
-
this.stopRecording();
|
|
654
|
-
this.isDetecting = false;
|
|
655
|
-
console.log('Picture taken. You can now stop recording.');
|
|
656
|
-
this.countdown = 0; // Ensure countdown is 0
|
|
657
|
-
}
|
|
658
|
-
}, 1000);
|
|
659
669
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
670
|
+
finally {
|
|
671
|
+
// Crucial: Release memory allocated by OpenCV Mat objects
|
|
672
|
+
src.delete();
|
|
673
|
+
gray.delete();
|
|
674
|
+
blurred.delete();
|
|
675
|
+
edges.delete();
|
|
676
|
+
contours.delete();
|
|
677
|
+
hierarchy.delete();
|
|
667
678
|
}
|
|
668
679
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
src.delete();
|
|
672
|
-
gray.delete();
|
|
673
|
-
blurred.delete();
|
|
674
|
-
edges.delete();
|
|
675
|
-
contours.delete();
|
|
676
|
-
hierarchy.delete();
|
|
680
|
+
catch (error) {
|
|
681
|
+
console.error('Error processing video frame with OpenCV:', error);
|
|
677
682
|
}
|
|
678
683
|
// --- OpenCV.js processing ends here ---
|
|
679
684
|
}
|
|
@@ -791,7 +796,7 @@ const IdAutoCapture = class {
|
|
|
791
796
|
if (TranslationUtils.state.device.isDesktop) {
|
|
792
797
|
cameraVideoClass = 'cameraVideoSelfieDesk';
|
|
793
798
|
}
|
|
794
|
-
return (index.h("div", { key: '
|
|
799
|
+
return (index.h("div", { key: 'deb2d35a50823fa5c222c6049a4119a371194870', class: "container flex center" }, index.h("div", { key: '449a0fef911f14d3611a1d7e83ed1bfc02c0553f', class: "px-2 w-100" }, index.h("h1", { key: '8d9f8b3684e58ba57f4ec0467efa0d9af62c5a98', class: this.titleStyle, innerHTML: this.titleMesage }), index.h("div", { key: '701aeecc148bdd00ef9cd38b165f0628adfe827c', hidden: this.verified }, index.h("div", { key: 'cbe89cf4ddc15c46b595929ecaf4fb8cc20136b5', class: "w-100 h-100 rounded" }, index.h("div", { key: '78f52a0a77c3dd8218115253bbcb79ee0a9a6d4b', class: "camera rounded" }, index.h("video", { key: '6ee76764205ce855fedd7b8c86be4394b2cad7bb', id: "video", loop: true, autoplay: true, playsinline: true, muted: true, class: cameraVideoClass, ref: el => (this.videoElement = el) }), index.h("canvas", { key: '5574b79a997d3ca06afa99faa61cb9bace755e91', id: "output", ref: el => (this.canvasElement = el), style: { display: 'none' } }), index.h("canvas", { key: 'e25df7ef70206d5544adade008cd612f1fee550a', id: "processingCanvasElement", ref: el => (this.processingCanvasElement = el), style: { display: 'none' } }), index.h("div", { key: '8ac6db08f2d1e44d04f2827f29e08787b853812e', class: "id-guide-rectangle" }), this.isCapturing && index.h("div", { key: '900ddcc0d2bf371d7ad4e593eaf0e9b60b6d2810', class: "capture-flash-overlay" }), this.countdown > 0 && (index.h("div", { key: 'd5f05c1b3dcbd02977462c6b9d816c2835698c2f', class: "absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center" }, index.h("span", { key: '7b85d36f1b609360c8214a29e220f6f80effffca', class: "text-white text-9xl font-bold animate-bounce" }, this.countdown)))))), index.h("div", { key: '9b653ebb92ce731ddb235d85db4a7fa99aaa4c64', class: "footer text-center" }, index.h("img", { key: 'f085d8f1698e66448cf749ec4cc45b496fbd55a1', src: Cameras.logoOntraceSvg })))));
|
|
795
800
|
}
|
|
796
801
|
get el() { return index.getElement(this); }
|
|
797
802
|
};
|
|
@@ -856,7 +861,7 @@ const IdSelection = class {
|
|
|
856
861
|
};
|
|
857
862
|
IdSelection.style = idSelectionCss;
|
|
858
863
|
|
|
859
|
-
const version$1 = "4.7.
|
|
864
|
+
const version$1 = "4.7.25";
|
|
860
865
|
var packageJson = {
|
|
861
866
|
version: version$1};
|
|
862
867
|
|