-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomponent---src-pages-webcam-face-expression-recognition-tsx-7e7598daa571aa609afd.js
More file actions
620 lines (480 loc) · 26.6 KB
/
component---src-pages-webcam-face-expression-recognition-tsx-7e7598daa571aa609afd.js
File metadata and controls
620 lines (480 loc) · 26.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[13],{
/***/ 148:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _default; });
/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34);
/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var face_api_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(159);
/* harmony import */ var face_api_js_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(164);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _components_FaceDetection__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(189);
/* harmony import */ var _components_TrackFacesWithExpressions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(293);
/* harmony import */ var _components_WebcamVideoWithOverlay__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(295);
/* harmony import */ var _const__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(175);
/* harmony import */ var _Root__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(186);
var _default =
/*#__PURE__*/
function (_React$Component) {
_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default()(_default, _React$Component);
function _default() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = _default.prototype;
_proto.render = function render() {
var _this = this;
if (!(typeof window !== 'undefined' && window.document)) {
return null;
}
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_Root__WEBPACK_IMPORTED_MODULE_9__[/* Root */ "a"], null, react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_components_WebcamVideoWithOverlay__WEBPACK_IMPORTED_MODULE_7__[/* WebcamVideoWithOverlay */ "a"], {
onLoaded: function onLoaded(_ref) {
var input = _ref.video,
overlay = _ref.overlay;
return _this.setState({
input: input,
overlay: overlay
});
},
maxVideoWidth: 800
}), react__WEBPACK_IMPORTED_MODULE_4__["createElement"](face_api_js_react__WEBPACK_IMPORTED_MODULE_3__["LoadModels"], {
faceExpessionModelUrl: _const__WEBPACK_IMPORTED_MODULE_8__[/* MODELS_URI */ "h"]
}, function () {
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_components_FaceDetection__WEBPACK_IMPORTED_MODULE_5__[/* FaceDetection */ "a"], Object.assign({}, _this.state, {
initialFaceDetector: _const__WEBPACK_IMPORTED_MODULE_8__[/* FACE_DETECTORS */ "g"][0],
initialTinyFaceDetectorOptions: new face_api_js__WEBPACK_IMPORTED_MODULE_2__["TinyFaceDetectorOptions"]({
inputSize: 224
})
}), function (detectionOptions, withBoxes) {
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_components_TrackFacesWithExpressions__WEBPACK_IMPORTED_MODULE_6__[/* TrackFacesWithExpressions */ "a"], Object.assign({
detectionOptions: detectionOptions,
withBoxes: withBoxes
}, _this.state));
});
}));
};
return _default;
}(react__WEBPACK_IMPORTED_MODULE_4__["Component"]);
/***/ }),
/***/ 189:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FaceDetection; });
/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34);
/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _material_ui_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(163);
/* harmony import */ var face_api_js_react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(164);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _components_ModalLoader__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(188);
/* harmony import */ var _const__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(175);
/* harmony import */ var _facc_SelectFaceDetector__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(200);
/* harmony import */ var _styled_CenterContent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(184);
var FaceDetection =
/*#__PURE__*/
function (_React$Component) {
_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default()(FaceDetection, _React$Component);
function FaceDetection() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.state = {
withBoxes: true
};
return _this;
}
var _proto = FaceDetection.prototype;
_proto.render = function render() {
var _this2 = this;
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_facc_SelectFaceDetector__WEBPACK_IMPORTED_MODULE_7__[/* SelectFaceDetector */ "a"], {
initialFaceDetector: this.props.initialFaceDetector,
initialTinyFaceDetectorOptions: this.props.initialTinyFaceDetectorOptions
}, function (detectorName, detectionOptions, renderFaceDetectorSelection, renderFaceDetectorControls) {
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](face_api_js_react__WEBPACK_IMPORTED_MODULE_3__["LoadModels"], Object.assign({}, Object(_const__WEBPACK_IMPORTED_MODULE_6__[/* getFaceDetectionModelUri */ "i"])(detectorName, _const__WEBPACK_IMPORTED_MODULE_6__[/* MODELS_URI */ "h"]), {
faceLandmarkModelUrl: _const__WEBPACK_IMPORTED_MODULE_6__[/* MODELS_URI */ "h"],
renderBusyComponent: function renderBusyComponent() {
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_components_ModalLoader__WEBPACK_IMPORTED_MODULE_5__[/* ModalLoader */ "a"], {
title: "Loading " + detectorName + " Model"
});
}
}), function () {
return react__WEBPACK_IMPORTED_MODULE_4__["createElement"]("div", null, react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_styled_CenterContent__WEBPACK_IMPORTED_MODULE_8__[/* CenterContent */ "a"], null, renderFaceDetectorSelection(), react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_styled_CenterContent__WEBPACK_IMPORTED_MODULE_8__[/* CenterContent */ "a"], {
flexDirection: "column",
alignItems: "baseline"
}, _this2.props.renderCheckboxes ? _this2.props.renderCheckboxes() : null, react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_material_ui_core__WEBPACK_IMPORTED_MODULE_2__[/* FormControlLabel */ "i"], {
control: react__WEBPACK_IMPORTED_MODULE_4__["createElement"](_material_ui_core__WEBPACK_IMPORTED_MODULE_2__[/* Checkbox */ "b"], {
checked: !_this2.state.withBoxes,
onChange: function onChange() {
return _this2.setState({
withBoxes: !_this2.state.withBoxes
});
},
color: "primary"
}),
label: "Hide Bounding Boxes"
}))), renderFaceDetectorControls(), _this2.props.children ? _this2.props.children(detectionOptions, _this2.state.withBoxes) : null);
});
});
};
return FaceDetection;
}(react__WEBPACK_IMPORTED_MODULE_4__["Component"]);
/***/ }),
/***/ 199:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TrackFaces; });
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(170);
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(171);
/* harmony import */ var regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(172);
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _face_api_js_react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(164);
var TrackFaces =
/*#__PURE__*/
function (_React$Component) {
_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_3___default()(TrackFaces, _React$Component);
function TrackFaces() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.isActive = false;
_this.run =
/*#__PURE__*/
_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_2___default()(
/*#__PURE__*/
_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() {
var results;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (_this.isActive) {
_context.next = 2;
break;
}
return _context.abrupt("return");
case 2:
if (_this.props.input) {
_context.next = 4;
break;
}
return _context.abrupt("return", setTimeout(_this.run, 0));
case 4:
_context.next = 6;
return _this.props.runTask();
case 6:
results = _context.sent;
Object(_face_api_js_react__WEBPACK_IMPORTED_MODULE_5__["displayResults"])(_this.props.input, _this.props.overlay, results, _this.props.displayOptions);
setTimeout(_this.run, 0);
case 9:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _this;
}
var _proto = TrackFaces.prototype;
_proto.componentDidMount = function componentDidMount() {
this.isActive = true;
this.run();
};
_proto.componentWillUnmount = function componentWillUnmount() {
this.isActive = false;
};
_proto.render = function render() {
return null;
};
return TrackFaces;
}(react__WEBPACK_IMPORTED_MODULE_4__["Component"]);
/***/ }),
/***/ 229:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VideoWithOverlay; });
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(35);
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var face_api_js_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(164);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
var VideoWithOverlay =
/*#__PURE__*/
function (_React$Component) {
_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_1___default()(VideoWithOverlay, _React$Component);
function VideoWithOverlay(props) {
var _this;
_this = _React$Component.call(this, props) || this;
_this.isLoaded = false;
_this.onChange = _this.onChange.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_0___default()(_this));
_this.onVideoRef = _this.onVideoRef.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_0___default()(_this));
_this.onCanvasRef = _this.onCanvasRef.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_0___default()(_this));
_this.onPlay = _this.onPlay.bind(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_0___default()(_this));
return _this;
}
var _proto = VideoWithOverlay.prototype;
_proto.onChange = function onChange() {
var video = this.video,
overlay = this.overlay,
isLoaded = this.isLoaded;
if (video && overlay && isLoaded) {
var _this$video$getBoundi = this.video.getBoundingClientRect(),
width = _this$video$getBoundi.width,
height = _this$video$getBoundi.height;
this.overlay.width = width, this.overlay.height = height;
this.props.onLoaded({
video: new face_api_js_react__WEBPACK_IMPORTED_MODULE_2__["MediaElement"](video),
overlay: overlay
});
}
};
_proto.onVideoRef = function onVideoRef(el) {
this.video = el;
this.props.onVideoRef && this.props.onVideoRef();
this.onChange();
};
_proto.onCanvasRef = function onCanvasRef(el) {
this.overlay = el;
this.onChange();
};
_proto.onPlay = function onPlay() {
this.isLoaded = true;
this.onChange();
};
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var srcObject = nextProps.srcObject;
if (srcObject && this.props.srcObject !== srcObject) {
this.video.srcObject = srcObject;
}
};
_proto.shouldComponentUpdate = function shouldComponentUpdate() {
return false;
};
_proto.componentDidUpdate = function componentDidUpdate() {
this.onChange();
};
_proto.componentDidMount = function componentDidMount() {
this.onChange();
};
_proto.render = function render() {
return react__WEBPACK_IMPORTED_MODULE_3__["createElement"]("div", {
style: {
position: 'relative'
}
}, react__WEBPACK_IMPORTED_MODULE_3__["createElement"]("video", {
muted: true,
autoPlay: true,
style: {
width: '100%',
maxWidth: this.props.maxVideoWidth
},
ref: this.onVideoRef,
onPlay: this.onPlay,
src: this.props.src
}), react__WEBPACK_IMPORTED_MODULE_3__["createElement"]("canvas", {
style: {
position: 'absolute',
top: 0,
left: 0
},
ref: this.onCanvasRef
}));
};
return VideoWithOverlay;
}(react__WEBPACK_IMPORTED_MODULE_3__["Component"]);
/***/ }),
/***/ 293:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TrackFacesWithExpressions; });
/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34);
/* harmony import */ var core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_assign__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(170);
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(171);
/* harmony import */ var regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(172);
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var face_api_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(159);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _TrackFaces__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(199);
var TrackFacesWithExpressions =
/*#__PURE__*/
function (_React$Component) {
_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_4___default()(TrackFacesWithExpressions, _React$Component);
function TrackFacesWithExpressions() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = TrackFacesWithExpressions.prototype;
_proto.render = function render() {
var _this = this;
var withBoxes = this.props.withBoxes;
return react__WEBPACK_IMPORTED_MODULE_6__["createElement"](_TrackFaces__WEBPACK_IMPORTED_MODULE_7__[/* TrackFaces */ "a"], Object.assign({}, this.props, {
displayOptions: {
withBoxes: withBoxes,
withScore: false
},
runTask:
/*#__PURE__*/
_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_3___default()(
/*#__PURE__*/
_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.mark(function _callee() {
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", face_api_js__WEBPACK_IMPORTED_MODULE_5__["detectAllFaces"](_this.props.input.element, _this.props.detectionOptions).withFaceExpressions());
case 1:
case "end":
return _context.stop();
}
}
}, _callee);
}))
}));
};
return TrackFacesWithExpressions;
}(react__WEBPACK_IMPORTED_MODULE_6__["Component"]);
/***/ }),
/***/ 295:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return WebcamVideoWithOverlay; });
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(170);
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(296);
/* harmony import */ var core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(36);
/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(171);
/* harmony import */ var regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(172);
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7);
/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _VideoWithOverlay__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(229);
var WebcamVideoWithOverlay =
/*#__PURE__*/
function (_React$Component) {
_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5___default()(WebcamVideoWithOverlay, _React$Component);
function WebcamVideoWithOverlay() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.state = {};
_this.onVideoRef =
/*#__PURE__*/
_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_4___default()(
/*#__PURE__*/
_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() {
var srcObject;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
_context.next = 3;
return navigator.mediaDevices.getUserMedia({
video: {}
});
case 3:
srcObject = _context.sent;
_this.setState({
srcObject: srcObject
});
_context.next = 10;
break;
case 7:
_context.prev = 7;
_context.t0 = _context["catch"](0);
_this.setState({
error: _context.t0.toString()
});
case 10:
case "end":
return _context.stop();
}
}
}, _callee, null, [[0, 7]]);
}));
return _this;
}
var _proto = WebcamVideoWithOverlay.prototype;
_proto.render = function render() {
if (this.state.error) {
return react__WEBPACK_IMPORTED_MODULE_6__["createElement"]("div", {
style: {
background: 'red',
color: 'white'
}
}, react__WEBPACK_IMPORTED_MODULE_6__["createElement"]("h3", null, " Error occured while requesting webcam access: "), react__WEBPACK_IMPORTED_MODULE_6__["createElement"]("p", null, " ", this.state.error, " "));
}
return react__WEBPACK_IMPORTED_MODULE_6__["createElement"](_VideoWithOverlay__WEBPACK_IMPORTED_MODULE_7__[/* VideoWithOverlay */ "a"], {
srcObject: this.state.srcObject,
onLoaded: this.props.onLoaded,
maxVideoWidth: this.props.maxVideoWidth,
onVideoRef: this.onVideoRef
});
};
return WebcamVideoWithOverlay;
}(react__WEBPACK_IMPORTED_MODULE_6__["Component"]);
/***/ }),
/***/ 296:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
__webpack_require__(297);
var anObject = __webpack_require__(5);
var $flags = __webpack_require__(76);
var DESCRIPTORS = __webpack_require__(18);
var TO_STRING = 'toString';
var $toString = /./[TO_STRING];
var define = function (fn) {
__webpack_require__(14)(RegExp.prototype, TO_STRING, fn, true);
};
// 21.2.5.14 RegExp.prototype.toString()
if (__webpack_require__(19)(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {
define(function toString() {
var R = anObject(this);
return '/'.concat(R.source, '/',
'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
});
// FF44- RegExp#toString has a wrong name
} else if ($toString.name != TO_STRING) {
define(function toString() {
return $toString.call(this);
});
}
/***/ }),
/***/ 297:
/***/ (function(module, exports, __webpack_require__) {
// 21.2.5.3 get RegExp.prototype.flags()
if (__webpack_require__(18) && /./g.flags != 'g') __webpack_require__(25).f(RegExp.prototype, 'flags', {
configurable: true,
get: __webpack_require__(76)
});
/***/ })
}]);
//# sourceMappingURL=component---src-pages-webcam-face-expression-recognition-tsx-7e7598daa571aa609afd.js.map