idmission-web-sdk 1.0.172 → 1.0.174
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 +31 -15
- 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 +31 -15
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +31 -15
- 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
|
@@ -48,7 +48,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
48
48
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
49
49
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
50
50
|
|
|
51
|
-
var webSdkVersion = '1.0.
|
|
51
|
+
var webSdkVersion = '1.0.174';
|
|
52
52
|
|
|
53
53
|
function getPlatform() {
|
|
54
54
|
if (typeof window === 'undefined') return;
|
|
@@ -8938,7 +8938,7 @@ function makePredictions(frame, lastPredictionCanvas, thresholds, logPredictions
|
|
|
8938
8938
|
documentTooClose = false;
|
|
8939
8939
|
if (bestDocumentOrPassport) {
|
|
8940
8940
|
_s = [bestDocumentOrPassport.bbox[2], bestDocumentOrPassport.bbox[3]], docWidth = _s[0], docHeight = _s[1];
|
|
8941
|
-
documentTooClose = docWidth > 0.
|
|
8941
|
+
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
8942
8942
|
}
|
|
8943
8943
|
focusPrediction = null, focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
8944
8944
|
if (!(detectionThresholdMet && documentInBounds && !documentTooClose)) return [3 /*break*/, 3];
|
|
@@ -9063,20 +9063,36 @@ function makeFocusPrediction(imageData, bbox, logPredictions) {
|
|
|
9063
9063
|
logPredictions = false;
|
|
9064
9064
|
}
|
|
9065
9065
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
9066
|
-
var startedAt, tfImg,
|
|
9067
|
-
return tslib.__generator(this, function (
|
|
9068
|
-
switch (
|
|
9066
|
+
var startedAt, tfImg, cropped, _a, fw, fh, _b, bw, bh, rotated, ctx, tfResize, tfInt32, tf4d_, _c, _d, _e, _f, tf4d, predictions, focusPrediction, predictionTime;
|
|
9067
|
+
return tslib.__generator(this, function (_g) {
|
|
9068
|
+
switch (_g.label) {
|
|
9069
9069
|
case 0:
|
|
9070
9070
|
if (!focusModel) {
|
|
9071
9071
|
throw new Error('focus model is not loaded');
|
|
9072
9072
|
}
|
|
9073
9073
|
startedAt = new Date();
|
|
9074
|
-
|
|
9074
|
+
_g.label = 1;
|
|
9075
9075
|
case 1:
|
|
9076
|
-
|
|
9076
|
+
_g.trys.push([1, 5,, 6]);
|
|
9077
9077
|
tfImg = void 0;
|
|
9078
9078
|
if (bbox) {
|
|
9079
|
-
|
|
9079
|
+
cropped = cropToBoundingBox(imageData, bbox);
|
|
9080
|
+
_a = getFrameDimensions(imageData), fw = _a[0], fh = _a[1];
|
|
9081
|
+
_b = [bbox[2] * fw, bbox[3] * fh], bw = _b[0], bh = _b[1];
|
|
9082
|
+
if (bh > bw) {
|
|
9083
|
+
rotated = document.createElement('canvas');
|
|
9084
|
+
ctx = rotated.getContext('2d');
|
|
9085
|
+
if (ctx) {
|
|
9086
|
+
rotated.width = bh;
|
|
9087
|
+
rotated.height = bw;
|
|
9088
|
+
ctx.clearRect(0, 0, rotated.width, rotated.height);
|
|
9089
|
+
ctx.translate(rotated.height / 2, rotated.width / 2);
|
|
9090
|
+
ctx.rotate(1.5708); // 90 deg in radians
|
|
9091
|
+
ctx.drawImage(cropped, -rotated.width / 2, -rotated.height / 2);
|
|
9092
|
+
cropped = rotated;
|
|
9093
|
+
}
|
|
9094
|
+
}
|
|
9095
|
+
tfImg = tf__namespace.browser.fromPixels(cropped);
|
|
9080
9096
|
} else {
|
|
9081
9097
|
tfImg = tf__namespace.browser.fromPixels(imageData);
|
|
9082
9098
|
}
|
|
@@ -9084,28 +9100,28 @@ function makeFocusPrediction(imageData, bbox, logPredictions) {
|
|
|
9084
9100
|
tfImg.dispose();
|
|
9085
9101
|
tfInt32 = tf__namespace.cast(tfResize, 'float32');
|
|
9086
9102
|
tfResize.dispose();
|
|
9087
|
-
|
|
9088
|
-
|
|
9103
|
+
_d = (_c = tf__namespace).tensor4d;
|
|
9104
|
+
_f = (_e = Array).from;
|
|
9089
9105
|
return [4 /*yield*/, tfInt32.data()];
|
|
9090
9106
|
case 2:
|
|
9091
|
-
tf4d_ =
|
|
9107
|
+
tf4d_ = _d.apply(_c, [_f.apply(_e, [_g.sent()]), [1, 448, 448, 3]]);
|
|
9092
9108
|
tfInt32.dispose();
|
|
9093
9109
|
tf4d = tf__namespace.cast(tf4d_, 'float32');
|
|
9094
9110
|
tf4d_.dispose();
|
|
9095
9111
|
if (logPredictions) console.time('focus prediction');
|
|
9096
9112
|
return [4 /*yield*/, focusModel.predict(tf4d)];
|
|
9097
9113
|
case 3:
|
|
9098
|
-
predictions =
|
|
9114
|
+
predictions = _g.sent();
|
|
9099
9115
|
tf4d.dispose();
|
|
9100
9116
|
return [4 /*yield*/, predictions.array()];
|
|
9101
9117
|
case 4:
|
|
9102
|
-
focusPrediction =
|
|
9118
|
+
focusPrediction = _g.sent()[0];
|
|
9103
9119
|
if (logPredictions) console.timeEnd('focus prediction');
|
|
9104
9120
|
tf__namespace.dispose(predictions);
|
|
9105
9121
|
predictionTime = new Date().getTime() - startedAt.getTime();
|
|
9106
9122
|
return [2 /*return*/, [focusPrediction, predictionTime]];
|
|
9107
9123
|
case 5:
|
|
9108
|
-
|
|
9124
|
+
_g.sent();
|
|
9109
9125
|
return [2 /*return*/, [[0, 0], 0]];
|
|
9110
9126
|
case 6:
|
|
9111
9127
|
return [2 /*return*/];
|
|
@@ -14765,7 +14781,7 @@ var defaultTheme = {
|
|
|
14765
14781
|
borderWidth: 4,
|
|
14766
14782
|
desktopPadding: 50,
|
|
14767
14783
|
mobilePadding: 0,
|
|
14768
|
-
imagePadding:
|
|
14784
|
+
imagePadding: 25
|
|
14769
14785
|
}
|
|
14770
14786
|
},
|
|
14771
14787
|
selfieCapture: {
|