idmission-web-sdk 2.1.87 → 2.1.88
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/sdk2.cjs.development.js +20 -11
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +20 -11
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +20 -11
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
234
234
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
-
var webSdkVersion = '2.1.
|
|
237
|
+
var webSdkVersion = '2.1.88';
|
|
238
238
|
|
|
239
239
|
function getPlatform() {
|
|
240
240
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -5588,7 +5588,6 @@ function makeDocumentDetectorPrediction(detector, frame) {
|
|
|
5588
5588
|
});
|
|
5589
5589
|
});
|
|
5590
5590
|
}
|
|
5591
|
-
var lastNBoxes = [];
|
|
5592
5591
|
var lastDetectionAt = 0;
|
|
5593
5592
|
var lastDetectionTime = 0;
|
|
5594
5593
|
function setLastDetectionAt(time) {
|
|
@@ -5596,6 +5595,18 @@ function setLastDetectionAt(time) {
|
|
|
5596
5595
|
lastDetectionAt = time;
|
|
5597
5596
|
}
|
|
5598
5597
|
var framesNeededSamples = [];
|
|
5598
|
+
function trackFramesNeeded(value) {
|
|
5599
|
+
framesNeededSamples.unshift(value);
|
|
5600
|
+
if (framesNeededSamples.length > 10) framesNeededSamples.length = 10;
|
|
5601
|
+
}
|
|
5602
|
+
var lastNBoxes = [];
|
|
5603
|
+
function trackBox(box, framesNeeded) {
|
|
5604
|
+
if (framesNeeded === void 0) {
|
|
5605
|
+
framesNeeded = 12;
|
|
5606
|
+
}
|
|
5607
|
+
lastNBoxes.unshift(box);
|
|
5608
|
+
if (lastNBoxes.length > framesNeeded) lastNBoxes.length = framesNeeded;
|
|
5609
|
+
}
|
|
5599
5610
|
var defaultDocumentDetectionBoundaries = {
|
|
5600
5611
|
top: 20,
|
|
5601
5612
|
bottom: 20,
|
|
@@ -5681,14 +5692,10 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5681
5692
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
5682
5693
|
if (detectionThresholdMet && documentInBounds && !documentTooClose) {
|
|
5683
5694
|
var threshold_1 = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
|
|
5684
|
-
|
|
5685
|
-
framesNeededSamples = framesNeededSamples.slice(0, 10);
|
|
5695
|
+
trackFramesNeeded(1000 / lastDetectionTime);
|
|
5686
5696
|
var framesNeeded = Math.ceil(average(framesNeededSamples));
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
var numFramesToConsider = Math.min(framesNeeded, 12);
|
|
5690
|
-
var framesToConsider = lastNBoxes.slice(0, numFramesToConsider);
|
|
5691
|
-
documentIsStable = lastNBoxes.length >= framesNeeded - 1 && !createPairs(framesToConsider).some(function (_a) {
|
|
5697
|
+
trackBox(bestDocument.box, framesNeeded);
|
|
5698
|
+
documentIsStable = lastNBoxes.length >= framesNeeded && !createPairs(lastNBoxes, 12).some(function (_a) {
|
|
5692
5699
|
var a = _a[0],
|
|
5693
5700
|
b = _a[1];
|
|
5694
5701
|
return calculateIoU(a, b) < threshold_1;
|
|
@@ -5730,9 +5737,10 @@ function applyNonMaxSuppression(detectedObjects) {
|
|
|
5730
5737
|
return !!obj;
|
|
5731
5738
|
});
|
|
5732
5739
|
}
|
|
5733
|
-
function createPairs(arr) {
|
|
5740
|
+
function createPairs(arr, maxPairs) {
|
|
5734
5741
|
var pairs = [];
|
|
5735
|
-
|
|
5742
|
+
var end = maxPairs ;
|
|
5743
|
+
for (var i = 0; i < end; i++) {
|
|
5736
5744
|
pairs.push([arr[i], arr[i + 1]]);
|
|
5737
5745
|
}
|
|
5738
5746
|
return pairs;
|
|
@@ -5753,6 +5761,7 @@ function calculateIoU(boxA, boxB) {
|
|
|
5753
5761
|
}
|
|
5754
5762
|
function average(arr) {
|
|
5755
5763
|
var len = arr.length;
|
|
5764
|
+
if (len === 0) return 0;
|
|
5756
5765
|
var sum = 0;
|
|
5757
5766
|
for (var i = 0; i < len; i++) sum += arr[i];
|
|
5758
5767
|
return sum / len;
|