@ekyc_qoobiss/qbs-ect-cmp 4.7.23 → 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 +81 -76
- package/dist/cjs/agreement-info_23.cjs.entry.js.map +1 -1
- package/dist/collection/components/common/id-auto-capture/id-auto-capture.js +80 -75
- package/dist/collection/components/common/id-auto-capture/id-auto-capture.js.map +1 -1
- package/dist/esm/agreement-info_23.entry.js +81 -76
- package/dist/esm/agreement-info_23.entry.js.map +1 -1
- package/dist/qbs-ect-cmp/{p-7c03c427.entry.js → p-536691cf.entry.js} +3 -3
- 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-7c03c427.entry.js.map +0 -1
|
@@ -592,87 +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
|
-
const video = this.videoElement;
|
|
596
|
-
const processingCanvas = this.processingCanvasElement;
|
|
597
|
-
const context = processingCanvas.getContext('2d');
|
|
598
|
-
processingCanvas.width = video.videoWidth;
|
|
599
|
-
processingCanvas.height = video.videoHeight;
|
|
600
|
-
context.drawImage(video, 0, 0, processingCanvas.width, processingCanvas.height);
|
|
601
|
-
const imageData = context.getImageData(0, 0, processingCanvas.width, processingCanvas.height);
|
|
602
|
-
// --- OpenCV.js processing starts here ---
|
|
603
|
-
let src = new cv.Mat(processingCanvas.height, processingCanvas.width, cv.CV_8UC4);
|
|
604
|
-
src.data.set(imageData.data);
|
|
605
|
-
let gray = new cv.Mat();
|
|
606
|
-
let blurred = new cv.Mat();
|
|
607
|
-
let edges = new cv.Mat();
|
|
608
|
-
let contours = new cv.MatVector();
|
|
609
|
-
let hierarchy = new cv.Mat();
|
|
610
595
|
try {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
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
|
+
}
|
|
633
636
|
}
|
|
634
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;
|
|
635
648
|
}
|
|
636
|
-
|
|
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);
|
|
637
660
|
}
|
|
638
|
-
contour.delete();
|
|
639
661
|
}
|
|
640
|
-
|
|
641
|
-
console.
|
|
642
|
-
this.
|
|
662
|
+
catch (error) {
|
|
663
|
+
console.error('OpenCV processing error:', error);
|
|
664
|
+
this.isDetecting = false; // Stop detection on error
|
|
643
665
|
if (this.animationFrameId !== null) {
|
|
644
|
-
cancelAnimationFrame(this.animationFrameId);
|
|
666
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
645
667
|
this.animationFrameId = null;
|
|
646
668
|
}
|
|
647
|
-
const timer = setInterval(() => {
|
|
648
|
-
this.countdown--;
|
|
649
|
-
if (this.countdown <= 0) {
|
|
650
|
-
clearInterval(timer);
|
|
651
|
-
this.capture();
|
|
652
|
-
this.stopRecording();
|
|
653
|
-
this.isDetecting = false;
|
|
654
|
-
console.log('Picture taken. You can now stop recording.');
|
|
655
|
-
this.countdown = 0; // Ensure countdown is 0
|
|
656
|
-
}
|
|
657
|
-
}, 1000);
|
|
658
669
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
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();
|
|
666
678
|
}
|
|
667
679
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
src.delete();
|
|
671
|
-
gray.delete();
|
|
672
|
-
blurred.delete();
|
|
673
|
-
edges.delete();
|
|
674
|
-
contours.delete();
|
|
675
|
-
hierarchy.delete();
|
|
680
|
+
catch (error) {
|
|
681
|
+
console.error('Error processing video frame with OpenCV:', error);
|
|
676
682
|
}
|
|
677
683
|
// --- OpenCV.js processing ends here ---
|
|
678
684
|
}
|
|
@@ -734,10 +740,6 @@ const IdAutoCapture = class {
|
|
|
734
740
|
this.loadOpenCVScript();
|
|
735
741
|
// Listen for the custom event dispatched by global.ts (ensures global.ts sets up window.Module)
|
|
736
742
|
document.addEventListener('opencv:ready', this.handleOpencvReady);
|
|
737
|
-
// Initial check in case opencv.js loads very fast and event was already dispatched
|
|
738
|
-
if (typeof cv !== 'undefined' && cv.Mat) {
|
|
739
|
-
this.handleOpencvReady();
|
|
740
|
-
}
|
|
741
743
|
}
|
|
742
744
|
disconnectedCallback() {
|
|
743
745
|
if (this.mediaStream) {
|
|
@@ -758,7 +760,7 @@ const IdAutoCapture = class {
|
|
|
758
760
|
}
|
|
759
761
|
}
|
|
760
762
|
loadOpenCVScript() {
|
|
761
|
-
if (!
|
|
763
|
+
if (!document.querySelector('script[src="https://docs.opencv.org/4.x/opencv.js"]')) {
|
|
762
764
|
// Only load if not already loaded
|
|
763
765
|
this.opencvScriptElement = document.createElement('script');
|
|
764
766
|
this.opencvScriptElement.type = 'text/javascript';
|
|
@@ -767,6 +769,9 @@ const IdAutoCapture = class {
|
|
|
767
769
|
document.body.appendChild(this.opencvScriptElement); // Append to body or head
|
|
768
770
|
console.log('Dynamically loaded opencv.js');
|
|
769
771
|
}
|
|
772
|
+
else {
|
|
773
|
+
console.log('OpenCV.js script already present in the DOM.');
|
|
774
|
+
}
|
|
770
775
|
}
|
|
771
776
|
// Method to get user media (camera stream)
|
|
772
777
|
async getMedia() {
|
|
@@ -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
|
|