@ekyc_qoobiss/qbs-ect-cmp 2.0.6 → 2.0.7

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.
@@ -1896,11 +1896,14 @@ class ML5 {
1896
1896
  });
1897
1897
  }
1898
1898
  loaded() {
1899
- console.log('ML5 LOADED!!!');
1899
+ if (state.debug)
1900
+ console.log('ML5 LOADED!!!');
1900
1901
  }
1901
1902
  gotResults(error, results) {
1902
- console.log(error);
1903
- console.log(results);
1903
+ if (state.debug)
1904
+ console.log(error);
1905
+ if (state.debug)
1906
+ console.log(results);
1904
1907
  }
1905
1908
  }
1906
1909
 
@@ -2241,15 +2244,12 @@ class FaceML5Detector {
2241
2244
  const faceBox = result[0].detection.box;
2242
2245
  const { top, left, bottom, right } = faceBox;
2243
2246
  const { imageHeight, imageWidth } = result[0].detection;
2244
- const topIndent = top * 100 / imageHeight;
2245
- const leftIndent = left * 100 / imageWidth;
2246
- const rightIndent = (imageWidth - right) * 100 / imageWidth;
2247
- const bottomIndent = (imageHeight - bottom) * 100 / imageHeight;
2247
+ const topIndent = (top * 100) / imageHeight;
2248
+ const leftIndent = (left * 100) / imageWidth;
2249
+ const rightIndent = ((imageWidth - right) * 100) / imageWidth;
2250
+ const bottomIndent = ((imageHeight - bottom) * 100) / imageHeight;
2248
2251
  // console.log('indent: '+topIndent+' | '+leftIndent+' | '+rightIndent+' | '+bottomIndent);
2249
- return !(topIndent < this.Y_OFFSET_FROM_FRAME ||
2250
- leftIndent < this.X_OFFSET_FROM_FRAME ||
2251
- rightIndent < this.X_OFFSET_FROM_FRAME ||
2252
- bottomIndent < this.Y_OFFSET_FROM_FRAME);
2252
+ return !(topIndent < this.Y_OFFSET_FROM_FRAME || leftIndent < this.X_OFFSET_FROM_FRAME || rightIndent < this.X_OFFSET_FROM_FRAME || bottomIndent < this.Y_OFFSET_FROM_FRAME);
2253
2253
  }
2254
2254
  async checkFacePose(results) {
2255
2255
  let face = new FaceLandmarks(results[0], this.width, this.height);
@@ -2258,17 +2258,18 @@ class FaceML5Detector {
2258
2258
  if (this.frontFace == null) {
2259
2259
  this.frontFace = face;
2260
2260
  // await this.drawFrame('green');
2261
- console.log('face ok');
2261
+ if (state.debug)
2262
+ console.log('face ok');
2262
2263
  }
2263
2264
  else if (this.frontFace != null && this.presentedFacePose == null) {
2264
2265
  let ff = this.frontFace;
2265
- if (face.nose.y < ff.nose.y - (ff.eyesDistance() * 0.4))
2266
+ if (face.nose.y < ff.nose.y - ff.eyesDistance() * 0.4)
2266
2267
  this.presentedFacePose = FacePose.LookUp;
2267
- if (face.nose.y > ff.nose.y + (ff.eyesDistance() * 0.4))
2268
+ if (face.nose.y > ff.nose.y + ff.eyesDistance() * 0.4)
2268
2269
  this.presentedFacePose = FacePose.LookDown;
2269
- if (face.nose.x > ff.nose.x + (ff.eyesDistance() * 0.5))
2270
+ if (face.nose.x > ff.nose.x + ff.eyesDistance() * 0.5)
2270
2271
  this.presentedFacePose = FacePose.LookLeft;
2271
- if (face.nose.x < ff.nose.x - (ff.eyesDistance() * 0.5))
2272
+ if (face.nose.x < ff.nose.x - ff.eyesDistance() * 0.5)
2272
2273
  this.presentedFacePose = FacePose.LookRight;
2273
2274
  /*
2274
2275
  if (
@@ -26,10 +26,13 @@ export class ML5 {
26
26
  });
27
27
  }
28
28
  loaded() {
29
- console.log('ML5 LOADED!!!');
29
+ if (store.debug)
30
+ console.log('ML5 LOADED!!!');
30
31
  }
31
32
  gotResults(error, results) {
32
- console.log(error);
33
- console.log(results);
33
+ if (store.debug)
34
+ console.log(error);
35
+ if (store.debug)
36
+ console.log(results);
34
37
  }
35
38
  }
@@ -7,6 +7,7 @@ import face_white_svg from '../../assets/canvas-masks/face_white.svg';
7
7
  // @ts-ignore
8
8
  import face_green_svg from '../../assets/canvas-masks/face_green.svg';
9
9
  import { GlobalValues } from '../../helpers/textValues';
10
+ import store from '../../helpers/store';
10
11
  export class FaceML5Detector {
11
12
  static getInstance(stream, isMobile) {
12
13
  if (!FaceML5Detector.instance) {
@@ -146,15 +147,12 @@ export class FaceML5Detector {
146
147
  const faceBox = result[0].detection.box;
147
148
  const { top, left, bottom, right } = faceBox;
148
149
  const { imageHeight, imageWidth } = result[0].detection;
149
- const topIndent = top * 100 / imageHeight;
150
- const leftIndent = left * 100 / imageWidth;
151
- const rightIndent = (imageWidth - right) * 100 / imageWidth;
152
- const bottomIndent = (imageHeight - bottom) * 100 / imageHeight;
150
+ const topIndent = (top * 100) / imageHeight;
151
+ const leftIndent = (left * 100) / imageWidth;
152
+ const rightIndent = ((imageWidth - right) * 100) / imageWidth;
153
+ const bottomIndent = ((imageHeight - bottom) * 100) / imageHeight;
153
154
  // console.log('indent: '+topIndent+' | '+leftIndent+' | '+rightIndent+' | '+bottomIndent);
154
- return !(topIndent < this.Y_OFFSET_FROM_FRAME ||
155
- leftIndent < this.X_OFFSET_FROM_FRAME ||
156
- rightIndent < this.X_OFFSET_FROM_FRAME ||
157
- bottomIndent < this.Y_OFFSET_FROM_FRAME);
155
+ return !(topIndent < this.Y_OFFSET_FROM_FRAME || leftIndent < this.X_OFFSET_FROM_FRAME || rightIndent < this.X_OFFSET_FROM_FRAME || bottomIndent < this.Y_OFFSET_FROM_FRAME);
158
156
  }
159
157
  async checkFacePose(results) {
160
158
  let face = new FaceLandmarks(results[0], this.width, this.height);
@@ -163,17 +161,18 @@ export class FaceML5Detector {
163
161
  if (this.frontFace == null) {
164
162
  this.frontFace = face;
165
163
  // await this.drawFrame('green');
166
- console.log('face ok');
164
+ if (store.debug)
165
+ console.log('face ok');
167
166
  }
168
167
  else if (this.frontFace != null && this.presentedFacePose == null) {
169
168
  let ff = this.frontFace;
170
- if (face.nose.y < ff.nose.y - (ff.eyesDistance() * 0.4))
169
+ if (face.nose.y < ff.nose.y - ff.eyesDistance() * 0.4)
171
170
  this.presentedFacePose = FacePose.LookUp;
172
- if (face.nose.y > ff.nose.y + (ff.eyesDistance() * 0.4))
171
+ if (face.nose.y > ff.nose.y + ff.eyesDistance() * 0.4)
173
172
  this.presentedFacePose = FacePose.LookDown;
174
- if (face.nose.x > ff.nose.x + (ff.eyesDistance() * 0.5))
173
+ if (face.nose.x > ff.nose.x + ff.eyesDistance() * 0.5)
175
174
  this.presentedFacePose = FacePose.LookLeft;
176
- if (face.nose.x < ff.nose.x - (ff.eyesDistance() * 0.5))
175
+ if (face.nose.x < ff.nose.x - ff.eyesDistance() * 0.5)
177
176
  this.presentedFacePose = FacePose.LookRight;
178
177
  /*
179
178
  if (
@@ -1892,11 +1892,14 @@ class ML5 {
1892
1892
  });
1893
1893
  }
1894
1894
  loaded() {
1895
- console.log('ML5 LOADED!!!');
1895
+ if (state.debug)
1896
+ console.log('ML5 LOADED!!!');
1896
1897
  }
1897
1898
  gotResults(error, results) {
1898
- console.log(error);
1899
- console.log(results);
1899
+ if (state.debug)
1900
+ console.log(error);
1901
+ if (state.debug)
1902
+ console.log(results);
1900
1903
  }
1901
1904
  }
1902
1905
 
@@ -2237,15 +2240,12 @@ class FaceML5Detector {
2237
2240
  const faceBox = result[0].detection.box;
2238
2241
  const { top, left, bottom, right } = faceBox;
2239
2242
  const { imageHeight, imageWidth } = result[0].detection;
2240
- const topIndent = top * 100 / imageHeight;
2241
- const leftIndent = left * 100 / imageWidth;
2242
- const rightIndent = (imageWidth - right) * 100 / imageWidth;
2243
- const bottomIndent = (imageHeight - bottom) * 100 / imageHeight;
2243
+ const topIndent = (top * 100) / imageHeight;
2244
+ const leftIndent = (left * 100) / imageWidth;
2245
+ const rightIndent = ((imageWidth - right) * 100) / imageWidth;
2246
+ const bottomIndent = ((imageHeight - bottom) * 100) / imageHeight;
2244
2247
  // console.log('indent: '+topIndent+' | '+leftIndent+' | '+rightIndent+' | '+bottomIndent);
2245
- return !(topIndent < this.Y_OFFSET_FROM_FRAME ||
2246
- leftIndent < this.X_OFFSET_FROM_FRAME ||
2247
- rightIndent < this.X_OFFSET_FROM_FRAME ||
2248
- bottomIndent < this.Y_OFFSET_FROM_FRAME);
2248
+ return !(topIndent < this.Y_OFFSET_FROM_FRAME || leftIndent < this.X_OFFSET_FROM_FRAME || rightIndent < this.X_OFFSET_FROM_FRAME || bottomIndent < this.Y_OFFSET_FROM_FRAME);
2249
2249
  }
2250
2250
  async checkFacePose(results) {
2251
2251
  let face = new FaceLandmarks(results[0], this.width, this.height);
@@ -2254,17 +2254,18 @@ class FaceML5Detector {
2254
2254
  if (this.frontFace == null) {
2255
2255
  this.frontFace = face;
2256
2256
  // await this.drawFrame('green');
2257
- console.log('face ok');
2257
+ if (state.debug)
2258
+ console.log('face ok');
2258
2259
  }
2259
2260
  else if (this.frontFace != null && this.presentedFacePose == null) {
2260
2261
  let ff = this.frontFace;
2261
- if (face.nose.y < ff.nose.y - (ff.eyesDistance() * 0.4))
2262
+ if (face.nose.y < ff.nose.y - ff.eyesDistance() * 0.4)
2262
2263
  this.presentedFacePose = FacePose.LookUp;
2263
- if (face.nose.y > ff.nose.y + (ff.eyesDistance() * 0.4))
2264
+ if (face.nose.y > ff.nose.y + ff.eyesDistance() * 0.4)
2264
2265
  this.presentedFacePose = FacePose.LookDown;
2265
- if (face.nose.x > ff.nose.x + (ff.eyesDistance() * 0.5))
2266
+ if (face.nose.x > ff.nose.x + ff.eyesDistance() * 0.5)
2266
2267
  this.presentedFacePose = FacePose.LookLeft;
2267
- if (face.nose.x < ff.nose.x - (ff.eyesDistance() * 0.5))
2268
+ if (face.nose.x < ff.nose.x - ff.eyesDistance() * 0.5)
2268
2269
  this.presentedFacePose = FacePose.LookRight;
2269
2270
  /*
2270
2271
  if (