{"id":319069,"date":"2021-03-04T21:00:37","date_gmt":"2021-03-04T21:00:37","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=319069"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=319069","title":{"rendered":"\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0446 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c TensorFlow.js. \u0427\u0430\u0441\u0442\u044c 4"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8d5\/596\/9e8\/8d55969e8464938586e61cdc760fb127.jpg\" width=\"780\" height=\"541\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 4 \u0447\u0430\u0441\u0442\u0438 (\u0432\u044b \u0436\u0435 \u043f\u0440\u043e\u0447\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/544846\/\">\u043f\u0435\u0440\u0432\u0443\u044e<\/a>, <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/544850\/\">\u0432\u0442\u043e\u0440\u0443\u044e<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/545332\/\">\u0442\u0440\u0435\u0442\u044c\u044e<\/a>, \u0434\u0430?) \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u0438 \u2013 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0434\u043b\u044f \u043b\u0438\u0446\u0430 \u0432 \u0441\u0442\u0438\u043b\u0435 Snapchat, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0443\u0437\u043d\u0430\u043b\u0438 \u043e\u0431 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0438 \u043b\u0438\u0446 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 3D-\u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c ThreeJS. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 3D-\u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 \u0432\u0438\u0434\u0435\u043e \u0441 \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u043b\u0435\u0447\u044c\u0441\u044f \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<hr>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0435\u043c\u043e\u0432\u0435\u0440\u0441\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 WebGL. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c <a href=\"https:\/\/www.codeproject.com\/KB\/AI\/5293494\/AIFaceFilters.zip\"><u>\u043a\u043e\u0434 \u0438 \u0444\u0430\u0439\u043b\u044b<\/u><\/a> \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 JavaScript \u0438 HTML \u0438 \u0438\u043c\u0435\u0435\u0442\u0435 \u0445\u043e\u0442\u044f \u0431\u044b \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445. <\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 3D-\u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ThreeJS<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043a\u043e\u0434\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438. \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 3D-\u0441\u0446\u0435\u043d\u044b \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0442\u043d\u043e.<\/p>\n<p><a href=\"https:\/\/threejs.org\/\">ThreeJS<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 3D-\u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0447\u043a\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 \u043d\u0430\u0448\u0438\u0445 \u043b\u0438\u0446.<\/p>\n<p>\u0412 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c ThreeJS \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 GLTF \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/three@0.123.0\/build\/three.min.js\"&gt;&lt;\/script&gt; &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/three@0.123.0\/examples\/js\/loaders\/GLTFLoader.js\"&gt;&lt;\/script&gt;<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u043d\u0435 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u044b \u043d\u0430 \u0441\u0446\u0435\u043d\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043b\u043e\u0436\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0442\u043d\u043e (canvas) \u0438 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0447\u043a\u0438 \u043d\u0430 \u043d\u0451\u043c. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c CSS-\u043a\u043e\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u043d\u0430\u0434 \u0442\u0435\u0433\u043e\u043c <code>body<\/code>, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0442\u043d\u043e (output) \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043f\u043e\u043b\u043e\u0442\u043d\u043e \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f (overlay).<\/p>\n<pre><code class=\"javascript\">&lt;style&gt;     .canvas-container {         position: relative;         width: auto;         height: auto;     }     .canvas-container canvas {         position: absolute;         left: 0;         width: auto;         height: auto;     } &lt;\/style&gt; &lt;body&gt;     &lt;div class=\"canvas-container\"&gt;         &lt;canvas id=\"output\"&gt;&lt;\/canvas&gt;         &lt;canvas id=\"overlay\"&gt;&lt;\/canvas&gt;     &lt;\/div&gt;     ... &lt;\/body&gt;<\/code><\/pre>\n<p>\u0414\u043b\u044f 3D-\u0441\u0446\u0435\u043d\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 3D-\u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432 GLTF:<\/p>\n<pre><code class=\"javascript\">&lt;style&gt;     .canvas-container {         position: relative;         width: auto;         height: auto;     }     .canvas-container canvas {         position: absolute;         left: 0;         width: auto;         height: auto;     } &lt;\/style&gt; &lt;body&gt;     &lt;div class=\"canvas-container\"&gt;         &lt;canvas id=\"output\"&gt;&lt;\/canvas&gt;         &lt;canvas id=\"overlay\"&gt;&lt;\/canvas&gt;     &lt;\/div&gt;     ... &lt;\/body&gt;<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430 async, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u043e\u043b\u043e\u0442\u043d\u0430 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0441 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u043f\u043e\u043b\u043e\u0442\u043d\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">(async () =&gt; {     ...      let canvas = document.getElementById( \"output\" );     canvas.width = video.width;     canvas.height = video.height;      let overlay = document.getElementById( \"overlay\" );     overlay.width = video.width;     overlay.height = video.height;      ... })();<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 renderer, scene \u0438 camera. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u0439 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u0439 \u043a\u0430\u043c\u0435\u0440\u044b, \u0432\u0430\u043c \u043d\u0435 \u043d\u0430\u0434\u043e \u0432\u043e\u043b\u043d\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043a\u0430\u043c\u0435\u0440\u0443 \u0441\u0446\u0435\u043d\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430 \u0432\u0438\u0434\u0435\u043e \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"javascript\">(async () =&gt; {     ...      \/\/ Load Face Landmarks Detection     model = await faceLandmarksDetection.load(         faceLandmarksDetection.SupportedPackages.mediapipeFacemesh     );      renderer = new THREE.WebGLRenderer({         canvas: document.getElementById( \"overlay\" ),         alpha: true     });      camera = new THREE.PerspectiveCamera( 45, 1, 0.1, 2000 );     camera.position.x = videoWidth \/ 2;     camera.position.y = -videoHeight \/ 2;     camera.position.z = -( videoHeight \/ 2 ) \/ Math.tan( 45 \/ 2 ); \/\/ distance to z should be tan( fov \/ 2 )      scene = new THREE.Scene();     scene.add( new THREE.AmbientLight( 0xcccccc, 0.4 ) );     camera.add( new THREE.PointLight( 0xffffff, 0.8 ) );     scene.add( camera );      camera.lookAt( { x: videoWidth \/ 2, y: -videoHeight \/ 2, z: 0, isVector3: true } );      ... })();<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>trackFace<\/code> \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0446\u0435\u043d\u044b \u043f\u043e\u0432\u0435\u0440\u0445 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446\u0430:<\/p>\n<pre><code class=\"javascript\">async function trackFace() {     const video = document.querySelector( \"video\" );     output.drawImage(         video,         0, 0, video.width, video.height,         0, 0, video.width, video.height     );     renderer.render( scene, camera );      const faces = await model.estimateFaces( {         input: video,         returnTensors: false,         flipHorizontal: false,     });      ... }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0431\u0443\u0441\u0430 \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043b\u0438\u0446\u0435 \u2013 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 3D-\u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0447\u043a\u043e\u0432. \u041c\u044b \u043d\u0430\u0448\u043b\u0438 \u043f\u0430\u0440\u0443<a href=\"https:\/\/sketchfab.com\/3d-models\/heart-glasses-ef812c7e7dc14f6b8783ccb516b3495c\"> \u043e\u0447\u043a\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0441\u0435\u0440\u0434\u0446\u0430 \u043e\u0442 Maximkuzlin \u043d\u0430 SketchFab<\/a>. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0446\u0435\u043d\u0443 \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>trackFace<\/code>:<\/p>\n<h2>\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0447\u043a\u043e\u0432 \u043d\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u043b\u0438\u0446\u0435<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u2013 \u043d\u0430\u0434\u0435\u043d\u0435\u043c \u043d\u0430\u0448\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0447\u043a\u0438.<\/p>\n<p>\u041f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446 TensorFlow, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 <code>MidwayBetweenEyes<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b X \u0438 Y \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u044d\u043a\u0440\u0430\u043d\u0443, \u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Z \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u043a\u0440\u0430\u043d\u0443 \u0433\u043b\u0443\u0431\u0438\u043d\u044b. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0447\u043a\u043e\u0432 \u043d\u0430 \u043d\u0430\u0448\u0438\u0445 \u0433\u043b\u0430\u0437\u0430\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439.<\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 Y \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0441\u044c Y \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043d\u0438\u0437, \u043d\u043e \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0432\u0435\u0440\u0445. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0447\u0442\u0435\u043c \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b Z \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043b\u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u043a\u0430\u043c\u0435\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u0441\u0446\u0435\u043d\u0435.<\/p>\n<pre><code class=\"javascript\">glasses.position.x = face.annotations.midwayBetweenEyes[ 0 ][ 0 ]; glasses.position.y = -face.annotations.midwayBetweenEyes[ 0 ][ 1 ]; glasses.position.z = -camera.position.z + face.annotations.midwayBetweenEyes[ 0 ][ 2 ];<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u043e\u0447\u043a\u043e\u0432. \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u043b\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043c\u0430\u043a\u0443\u0448\u043a\u0443 \u043d\u0430\u0448\u0435\u0439 \u0433\u043e\u043b\u043e\u0432\u044b, \u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0433\u043b\u0430\u0437\u0430\u043c\u0438.<\/p>\n<p>\u041e\u0446\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>midwayBetweenEyes<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u043e\u0447\u043a\u043e\u0432, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043b\u044f \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043d\u043e\u0441\u0430. \u0417\u0430\u0442\u0435\u043c \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">glasses.up.x = face.annotations.midwayBetweenEyes[ 0 ][ 0 ] - face.annotations.noseBottom[ 0 ][ 0 ]; glasses.up.y = -( face.annotations.midwayBetweenEyes[ 0 ][ 1 ] - face.annotations.noseBottom[ 0 ][ 1 ] ); glasses.up.z = face.annotations.midwayBetweenEyes[ 0 ][ 2 ] - face.annotations.noseBottom[ 0 ][ 2 ]; const length = Math.sqrt( glasses.up.x ** 2 + glasses.up.y ** 2 + glasses.up.z ** 2 ); glasses.up.x \/= length; glasses.up.y \/= length; glasses.up.z \/= length;<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0433\u043e\u043b\u043e\u0432\u044b, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0433\u043b\u0430\u0437\u0430\u043c\u0438:<\/p>\n<pre><code class=\"javascript\">const eyeDist = Math.sqrt(     ( face.annotations.leftEyeUpper1[ 3 ][ 0 ] - face.annotations.rightEyeUpper1[ 3 ][ 0 ] ) ** 2 +     ( face.annotations.leftEyeUpper1[ 3 ][ 1 ] - face.annotations.rightEyeUpper1[ 3 ][ 1 ] ) ** 2 +     ( face.annotations.leftEyeUpper1[ 3 ][ 2 ] - face.annotations.rightEyeUpper1[ 3 ][ 2 ] ) ** 2 );<\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c \u043e\u0447\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>eyeDist<\/code> \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043e\u0447\u043a\u0438 \u043f\u043e \u043e\u0441\u0438 Z, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0443\u0433\u043e\u043b \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb \u0438 \u043e\u0441\u044c\u044e Y. \u0418 \u0432\u0443\u0430\u043b\u044f!<\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/60a\/e5d\/948\/60ae5d94884dfae4716dacdc7b255b8e.png\" width=\"1000\" height=\"280\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0432\u043c\u0435\u0441\u0442\u0435:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u043e\u0441\u0442\u044b\u043d\u044f \u0441 \u043a\u043e\u0434\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"xml\">&lt;html&gt;     &lt;head&gt;         &lt;title&gt;Creating a Snapchat-Style Virtual Glasses Face Filter&lt;\/title&gt;         &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/@tensorflow\/tfjs@2.4.0\/dist\/tf.min.js\"&gt;&lt;\/script&gt;         &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/@tensorflow-models\/face-landmarks-detection@0.0.1\/dist\/face-landmarks-detection.js\"&gt;&lt;\/script&gt;         &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/three@0.123.0\/build\/three.min.js\"&gt;&lt;\/script&gt;         &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/three@0.123.0\/examples\/js\/loaders\/GLTFLoader.js\"&gt;&lt;\/script&gt;     &lt;\/head&gt;     &lt;style&gt;         .canvas-container {             position: relative;             width: auto;             height: auto;         }         .canvas-container canvas {             position: absolute;             left: 0;             width: auto;             height: auto;         }     &lt;\/style&gt;     &lt;body&gt;         &lt;div class=\"canvas-container\"&gt;             &lt;canvas id=\"output\"&gt;&lt;\/canvas&gt;             &lt;canvas id=\"overlay\"&gt;&lt;\/canvas&gt;         &lt;\/div&gt;         &lt;video id=\"webcam\" playsinline style=\"             visibility: hidden;             width: auto;             height: auto;             \"&gt;         &lt;\/video&gt;         &lt;h1 id=\"status\"&gt;Loading...&lt;\/h1&gt;         &lt;script&gt;         function setText( text ) {             document.getElementById( \"status\" ).innerText = text;         }          function drawLine( ctx, x1, y1, x2, y2 ) {             ctx.beginPath();             ctx.moveTo( x1, y1 );             ctx.lineTo( x2, y2 );             ctx.stroke();         }          async function setupWebcam() {             return new Promise( ( resolve, reject ) =&gt; {                 const webcamElement = document.getElementById( \"webcam\" );                 const navigatorAny = navigator;                 navigator.getUserMedia = navigator.getUserMedia ||                 navigatorAny.webkitGetUserMedia || navigatorAny.mozGetUserMedia ||                 navigatorAny.msGetUserMedia;                 if( navigator.getUserMedia ) {                     navigator.getUserMedia( { video: true },                         stream =&gt; {                             webcamElement.srcObject = stream;                             webcamElement.addEventListener( \"loadeddata\", resolve, false );                         },                     error =&gt; reject());                 }                 else {                     reject();                 }             });         }          let output = null;         let model = null;         let renderer = null;         let scene = null;         let camera = null;         let glasses = null;          function loadModel( file ) {             return new Promise( ( res, rej ) =&gt; {                 const loader = new THREE.GLTFLoader();                 loader.load( file, function ( gltf ) {                     res( gltf.scene );                 }, undefined, function ( error ) {                     rej( error );                 } );             });         }          async function trackFace() {             const video = document.querySelector( \"video\" );             output.drawImage(                 video,                 0, 0, video.width, video.height,                 0, 0, video.width, video.height             );             renderer.render( scene, camera );              const faces = await model.estimateFaces( {                 input: video,                 returnTensors: false,                 flipHorizontal: false,             });              faces.forEach( face =&gt; {                 \/\/ Draw the bounding box                 const x1 = face.boundingBox.topLeft[ 0 ];                 const y1 = face.boundingBox.topLeft[ 1 ];                 const x2 = face.boundingBox.bottomRight[ 0 ];                 const y2 = face.boundingBox.bottomRight[ 1 ];                 const bWidth = x2 - x1;                 const bHeight = y2 - y1;                 drawLine( output, x1, y1, x2, y1 );                 drawLine( output, x2, y1, x2, y2 );                 drawLine( output, x1, y2, x2, y2 );                 drawLine( output, x1, y1, x1, y2 );                  glasses.position.x = face.annotations.midwayBetweenEyes[ 0 ][ 0 ];                 glasses.position.y = -face.annotations.midwayBetweenEyes[ 0 ][ 1 ];                 glasses.position.z = -camera.position.z + face.annotations.midwayBetweenEyes[ 0 ][ 2 ];                  \/\/ Calculate an Up-Vector using the eyes position and the bottom of the nose                 glasses.up.x = face.annotations.midwayBetweenEyes[ 0 ][ 0 ] - face.annotations.noseBottom[ 0 ][ 0 ];                 glasses.up.y = -( face.annotations.midwayBetweenEyes[ 0 ][ 1 ] - face.annotations.noseBottom[ 0 ][ 1 ] );                 glasses.up.z = face.annotations.midwayBetweenEyes[ 0 ][ 2 ] - face.annotations.noseBottom[ 0 ][ 2 ];                 const length = Math.sqrt( glasses.up.x ** 2 + glasses.up.y ** 2 + glasses.up.z ** 2 );                 glasses.up.x \/= length;                 glasses.up.y \/= length;                 glasses.up.z \/= length;                  \/\/ Scale to the size of the head                 const eyeDist = Math.sqrt(                     ( face.annotations.leftEyeUpper1[ 3 ][ 0 ] - face.annotations.rightEyeUpper1[ 3 ][ 0 ] ) ** 2 +                     ( face.annotations.leftEyeUpper1[ 3 ][ 1 ] - face.annotations.rightEyeUpper1[ 3 ][ 1 ] ) ** 2 +                     ( face.annotations.leftEyeUpper1[ 3 ][ 2 ] - face.annotations.rightEyeUpper1[ 3 ][ 2 ] ) ** 2                 );                 glasses.scale.x = eyeDist \/ 6;                 glasses.scale.y = eyeDist \/ 6;                 glasses.scale.z = eyeDist \/ 6;                  glasses.rotation.y = Math.PI;                 glasses.rotation.z = Math.PI \/ 2 - Math.acos( glasses.up.x );             });              requestAnimationFrame( trackFace );         }          (async () =&gt; {             await setupWebcam();             const video = document.getElementById( \"webcam\" );             video.play();             let videoWidth = video.videoWidth;             let videoHeight = video.videoHeight;             video.width = videoWidth;             video.height = videoHeight;              let canvas = document.getElementById( \"output\" );             canvas.width = video.width;             canvas.height = video.height;              let overlay = document.getElementById( \"overlay\" );             overlay.width = video.width;             overlay.height = video.height;              output = canvas.getContext( \"2d\" );             output.translate( canvas.width, 0 );             output.scale( -1, 1 ); \/\/ Mirror cam             output.fillStyle = \"#fdffb6\";             output.strokeStyle = \"#fdffb6\";             output.lineWidth = 2;              \/\/ Load Face Landmarks Detection             model = await faceLandmarksDetection.load(                 faceLandmarksDetection.SupportedPackages.mediapipeFacemesh             );              renderer = new THREE.WebGLRenderer({                 canvas: document.getElementById( \"overlay\" ),                 alpha: true             });              camera = new THREE.PerspectiveCamera( 45, 1, 0.1, 2000 );             camera.position.x = videoWidth \/ 2;             camera.position.y = -videoHeight \/ 2;             camera.position.z = -( videoHeight \/ 2 ) \/ Math.tan( 45 \/ 2 ); \/\/ distance to z should be tan( fov \/ 2 )              scene = new THREE.Scene();             scene.add( new THREE.AmbientLight( 0xcccccc, 0.4 ) );             camera.add( new THREE.PointLight( 0xffffff, 0.8 ) );             scene.add( camera );              camera.lookAt( { x: videoWidth \/ 2, y: -videoHeight \/ 2, z: 0, isVector3: true } );              \/\/ Glasses from https:\/\/sketchfab.com\/3d-models\/heart-glasses-ef812c7e7dc14f6b8783ccb516b3495c             glasses = await loadModel( \"web\/3d\/heart_glasses.gltf\" );             scene.add( glasses );              setText( \"Loaded!\" );              trackFace();         })();         &lt;\/script&gt;     &lt;\/body&gt; &lt;\/html&gt;<\/code><\/pre>\n<\/div>\n<\/details>\n<h3>\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435? \u0427\u0442\u043e \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u044d\u043c\u043e\u0446\u0438\u0439 \u043d\u0430 \u043b\u0438\u0446\u0435?<\/h3>\n<p>\u041f\u043e\u0432\u0435\u0440\u0438\u0442\u0435 \u043b\u0438, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435? \u0414\u043e\u0431\u0430\u0432\u0438\u0432 3D-\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043c\u044b \u0441\u043e\u0442\u0432\u043e\u0440\u0438\u043b\u0438 \u0432\u043e\u043b\u0448\u0435\u0431\u0441\u0442\u0432\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u0430\u043c\u0435\u0440\u044b \u043f\u0440\u044f\u043c\u043e \u0432 \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c: \u00ab\u041d\u043e \u043e\u0447\u043a\u0438 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0441\u0435\u0440\u0434\u0446\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438\u2026\u00bb \u0418 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0434\u0430! \u0410 \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0448\u043b\u044f\u043f\u0443\u2026 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u043c?<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435  \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0443\u044e \u0448\u043b\u044f\u043f\u0443 (\u043a\u0430\u043a \u0432 \u0425\u043e\u0433\u0432\u0430\u0440\u0442\u0441\u0435!) \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u044d\u043c\u043e\u0446\u0438\u0439 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0441\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c, \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 TensorFlow.js! <strong>\u0414\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0438 \u0437\u0430\u0432\u0442\u0440\u0430, \u0432 \u044d\u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f.<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/544846\/\">\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0446 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0427\u0430\u0441\u0442\u044c 1<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/544850\/\">\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0446 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0427\u0430\u0441\u0442\u044c 2<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/545332\/\">\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u0446 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0427\u0430\u0441\u0442\u044c 3<\/a><\/p>\n<\/li>\n<\/ul>\n<figure class=\"float\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5ba\/890\/ab4\/5ba890ab43a4903dd93e7fb7aaacdab3.png\" width=\"212\" height=\"221\"><figcaption><\/figcaption><\/figure>\n<p><a href=\"https:\/\/skillfactory.ru\/courses\/?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_ALLCOURSES&amp;utm_term=regular&amp;utm_content=040321\">\u0423\u0437\u043d\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438<\/a>, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c Level Up \u043f\u043e \u043d\u0430\u0432\u044b\u043a\u0430\u043c \u0438 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0435 \u0438\u043b\u0438 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044e \u0441 \u043d\u0443\u043b\u044f, \u043f\u0440\u043e\u0439\u0434\u044f \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u044b SkillFactory \u0441\u043e \u0441\u043a\u0438\u0434\u043a\u043e\u0439 40% \u0438 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u043e\u043c&nbsp;<strong>HABR<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u0441\u0442 \u0435\u0449\u0435 +10% \u0441\u043a\u0438\u0434\u043a\u0438 \u043d\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435.<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_DSPR&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataanalystpro?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_DAPR&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataengineer?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_DEA&amp;utm_term=regular&amp;utm_content=040321\">\u041a\u0443\u0440\u0441 \u043f\u043e Data Engineering <\/a>     <\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u0438 \u0438 \u043a\u0443\u0440\u0441\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>\u041f\u0420\u041e\u0424\u0415\u0421\u0421\u0418\u0418<\/strong>      <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_JAVA&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_QAJA&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430 JAVA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/frontend?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_FR&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cybersecurity?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_HACKER&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u042d\u0442\u0438\u0447\u043d\u044b\u0439 \u0445\u0430\u043a\u0435\u0440<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cplus?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_CPLUS&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/game-dev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_GAMEDEV&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430 Unity<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_WEBDEV&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/iosdev?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_IOSDEV&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441 \u043d\u0443\u043b\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/android?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_ANDR&amp;utm_term=regular&amp;utm_content=040321\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441 \u043d\u0443\u043b\u044f<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041a\u0423\u0420\u0421\u042b<\/strong>      <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-programma-machine-learning-online?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_ML&amp;utm_term=regular&amp;utm_content=040321\">\u041a\u0443\u0440\u0441 \u043f\u043e Machine Learning<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math_and_ml?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_MATML&amp;utm_term=regular&amp;utm_content=040321\">\u041a\u0443\u0440\u0441 &#171;\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438 Machine Learning \u0434\u043b\u044f Data Science&#187;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-and-dl?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_MLDL&amp;utm_term=regular&amp;utm_content=040321\">\u041a\u0443\u0440\u0441 &#171;Machine Learning \u0438 Deep Learning&#187;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_PWS&amp;utm_term=regular&amp;utm_content=040321\">\u041a\u0443\u0440\u0441 &#171;Python \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438&#187;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/algo?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_algo&amp;utm_term=regular&amp;utm_content=040321\">\u041a\u0443\u0440\u0441 &#171;\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445&#187;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/analytics?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_SDA&amp;utm_term=regular&amp;utm_content=040321\">\u041a\u0443\u0440\u0441 \u043f\u043e \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/devops?utm_source=infopartners&amp;utm_medium=habr&amp;utm_campaign=habr_DEVOPS&amp;utm_term=regular&amp;utm_content=040321\">\u041a\u0443\u0440\u0441 \u043f\u043e DevOps<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/545334\/\"> https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/545334\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 4 \u0447\u0430\u0441\u0442\u0438 (\u0432\u044b \u0436\u0435 \u043f\u0440\u043e\u0447\u043b\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/544846\/\">\u043f\u0435\u0440\u0432\u0443\u044e<\/a>, <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/544850\/\">\u0432\u0442\u043e\u0440\u0443\u044e<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/545332\/\">\u0442\u0440\u0435\u0442\u044c\u044e<\/a>, \u0434\u0430?) \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u0438 \u2013 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0434\u043b\u044f \u043b\u0438\u0446\u0430 \u0432 \u0441\u0442\u0438\u043b\u0435 Snapchat, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0443\u0437\u043d\u0430\u043b\u0438 \u043e\u0431 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0438 \u043b\u0438\u0446 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 3D-\u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c ThreeJS. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 3D-\u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 \u0432\u0438\u0434\u0435\u043e \u0441 \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u043b\u0435\u0447\u044c\u0441\u044f \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<hr>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u0435\u043c\u043e\u0432\u0435\u0440\u0441\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 WebGL. \u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c <a href=\"https:\/\/www.codeproject.com\/KB\/AI\/5293494\/AIFaceFilters.zip\"><u>\u043a\u043e\u0434 \u0438 \u0444\u0430\u0439\u043b\u044b<\/u><\/a> \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 JavaScript \u0438 HTML \u0438 \u0438\u043c\u0435\u0435\u0442\u0435 \u0445\u043e\u0442\u044f \u0431\u044b \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445. <\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 3D-\u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ThreeJS<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043a\u043e\u0434\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438. \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 3D-\u0441\u0446\u0435\u043d\u044b \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0442\u043d\u043e.<\/p>\n<p><a href=\"https:\/\/threejs.org\/\">ThreeJS<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 3D-\u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0447\u043a\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 \u043d\u0430\u0448\u0438\u0445 \u043b\u0438\u0446.<\/p>\n<p>\u0412 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c ThreeJS \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 GLTF \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code class=\"javascript\">&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/three@0.123.0\/build\/three.min.js\"&gt;&lt;\/script&gt; &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/three@0.123.0\/examples\/js\/loaders\/GLTFLoader.js\"&gt;&lt;\/script&gt;<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0438 \u043d\u0435 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0443 \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u044b \u043d\u0430 \u0441\u0446\u0435\u043d\u0443, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043b\u043e\u0436\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0442\u043d\u043e (canvas) \u0438 \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0447\u043a\u0438 \u043d\u0430 \u043d\u0451\u043c. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c CSS-\u043a\u043e\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u043d\u0430\u0434 \u0442\u0435\u0433\u043e\u043c <code>body<\/code>, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0442\u043d\u043e (output) \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043f\u043e\u043b\u043e\u0442\u043d\u043e \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f (overlay).<\/p>\n<pre><code class=\"javascript\">&lt;style&gt;     .canvas-container {         position: relative;         width: auto;         height: auto;     }     .canvas-container canvas {         position: absolute;         left: 0;         width: auto;         height: auto;     } &lt;\/style&gt; &lt;body&gt;     &lt;div class=\"canvas-container\"&gt;         &lt;canvas id=\"output\"&gt;&lt;\/canvas&gt;         &lt;canvas id=\"overlay\"&gt;&lt;\/canvas&gt;     &lt;\/div&gt;     ... &lt;\/body&gt;<\/code><\/pre>\n<p>\u0414\u043b\u044f 3D-\u0441\u0446\u0435\u043d\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 3D-\u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432 GLTF:<\/p>\n<pre><code class=\"javascript\">&lt;style&gt;     .canvas-container {         position: relative;         width: auto;         height: auto;     }     .canvas-container canvas {         position: absolute;         left: 0;         width: auto;         height: auto;     } &lt;\/style&gt; &lt;body&gt;     &lt;div class=\"canvas-container\"&gt;         &lt;canvas id=\"output\"&gt;&lt;\/canvas&gt;         &lt;canvas id=\"overlay\"&gt;&lt;\/canvas&gt;     &lt;\/div&gt;     ... &lt;\/body&gt;<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430 async, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u043e\u043b\u043e\u0442\u043d\u0430 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0441 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u043f\u043e\u043b\u043e\u0442\u043d\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">(async () =&gt; {     ...      let canvas = document.getElementById( \"output\" );     canvas.width = video.width;     canvas.height = video.height;      let overlay = document.getElementById( \"overlay\" );     overlay.width = video.width;     overlay.height = video.height;      ... })();<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 renderer, scene \u0438 camera. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u0439 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u043e\u0439 \u043a\u0430\u043c\u0435\u0440\u044b, \u0432\u0430\u043c \u043d\u0435 \u043d\u0430\u0434\u043e \u0432\u043e\u043b\u043d\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043a\u0430\u043c\u0435\u0440\u0443 \u0441\u0446\u0435\u043d\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430 \u0432\u0438\u0434\u0435\u043e \u0432\u0435\u0431-\u043a\u0430\u043c\u0435\u0440\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"javascript\">(async () =&gt; {     ...      \/\/ Load Face Landmarks Detection     model = await faceLandmarksDetection.load(         faceLandmarksDetection.SupportedPackages.mediapipeFacemesh     );      renderer = new THREE.WebGLRenderer({         canvas: document.getElementById( \"overlay\" ),         alpha: true     });      camera = new THREE.PerspectiveCamera( 45, 1, 0.1, 2000 );     camera.position.x = videoWidth \/ 2;     camera.position.y = -videoHeight \/ 2;     camera.position.z = -( videoHeight \/ 2 ) \/ Math.tan( 45 \/ 2 ); \/\/ distance to z should be tan( fov \/ 2 )      scene = new THREE.Scene();     scene.add( new THREE.AmbientLight( 0xcccccc, 0.4 ) );     camera.add( new THREE.PointLight( 0xffffff, 0.8 ) );     scene.add( camera );      camera.lookAt( { x: videoWidth \/ 2, y: -videoHeight \/ 2, z: 0, isVector3: true } );      ... })();<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>trackFace<\/code> \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0446\u0435\u043d\u044b \u043f\u043e\u0432\u0435\u0440\u0445 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446\u0430:<\/p>\n<pre><code class=\"javascript\">async function trackFace() {     const video = document.querySelector( \"video\" );     output.drawImage(         video,         0, 0, video.width, video.height,         0, 0, video.width, video.height     );     renderer.render( scene, camera );      const faces = await model.estimateFaces( {         input: video,         returnTensors: false,         flipHorizontal: false,     });      ... }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0431\u0443\u0441\u0430 \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043b\u0438\u0446\u0435 \u2013 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 3D-\u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0447\u043a\u043e\u0432. \u041c\u044b \u043d\u0430\u0448\u043b\u0438 \u043f\u0430\u0440\u0443<a href=\"https:\/\/sketchfab.com\/3d-models\/heart-glasses-ef812c7e7dc14f6b8783ccb516b3495c\"> \u043e\u0447\u043a\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0435 \u0441\u0435\u0440\u0434\u0446\u0430 \u043e\u0442 Maximkuzlin \u043d\u0430 SketchFab<\/a>. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0446\u0435\u043d\u0443 \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>trackFace<\/code>:<\/p>\n<h2>\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0447\u043a\u043e\u0432 \u043d\u0430 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u043b\u0438\u0446\u0435<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u2013 \u043d\u0430\u0434\u0435\u043d\u0435\u043c \u043d\u0430\u0448\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0447\u043a\u0438.<\/p>\n<p>\u041f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043b\u0438\u0446 TensorFlow, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 <code>MidwayBetweenEyes<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b X \u0438 Y \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u044d\u043a\u0440\u0430\u043d\u0443, \u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 Z \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u043a\u0440\u0430\u043d\u0443 \u0433\u043b\u0443\u0431\u0438\u043d\u044b. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0447\u043a\u043e\u0432 \u043d\u0430 \u043d\u0430\u0448\u0438\u0445 \u0433\u043b\u0430\u0437\u0430\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439.<\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 Y \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0441\u044c Y \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0432\u043d\u0438\u0437, \u043d\u043e \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0432\u0435\u0440\u0445. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0447\u0442\u0435\u043c \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b Z \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043b\u0438 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u043a\u0430\u043c\u0435\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u0441\u0446\u0435\u043d\u0435.<\/p>\n<pre><code class=\"javascript\">glasses.position.x = face.annotations.midwayBetweenEyes[ 0 ][ 0 ]; glasses.position.y = -face.annotations.midwayBetweenEyes[ 0 ][ 1 ]; glasses.position.z = -camera.position.z + face.annotations.midwayBetweenEyes[ 0 ][ 2 ];<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u043e\u0447\u043a\u043e\u0432. \u042d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u043b\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043c\u0430\u043a\u0443\u0448\u043a\u0443 \u043d\u0430\u0448\u0435\u0439 \u0433\u043e\u043b\u043e\u0432\u044b, \u0438 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0433\u043b\u0430\u0437\u0430\u043c\u0438.<\/p>\n<p>\u041e\u0446\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>midwayBetweenEyes<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u043e\u0447\u043a\u043e\u0432, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043b\u044f \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043d\u043e\u0441\u0430. \u0417\u0430\u0442\u0435\u043c \u043d\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">glasses.up.x = face.annotations.midwayBetweenEyes[ 0 ][ 0 ] - face.annotations.noseBottom[ 0 ][ 0 ]; glasses.up.y = -( face.annotations.midwayBetweenEyes[ 0 ][ 1 ] - face.annotations.noseBottom[ 0 ][ 1 ] ); glasses.up.z = face.annotations.midwayBetweenEyes[ 0 ][ 2 ] - face.annotations.noseBottom[ 0 ][ 2 ]; const length = Math.sqrt( glasses.up.x ** 2 + glasses.up.y ** 2 + glasses.up.z ** 2 ); glasses.up.x \/= length; glasses.up.y \/= length; glasses.up.z \/= length;<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0433\u043e\u043b\u043e\u0432\u044b, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0433\u043b\u0430\u0437\u0430\u043c\u0438:<\/p>\n<pre><code class=\"javascript\">const eyeDist = Math.sqrt(     ( face.annotations.leftEyeUpper1[ 3 ][ 0 ] - face.annotations.rightEyeUpper1[ 3 ][ 0 ] ) ** 2 +     ( face.annotations.leftEyeUpper1[ 3 ][ 1 ] - face.annotations.rightEyeUpper1[ 3 ][ 1 ] ) ** 2 +     ( face.annotations.leftEyeUpper1[ 3 ][ 2 ] - face.annotations.rightEyeUpper1[ 3 ][ 2 ] ) ** 2 );<\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u044b \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c \u043e\u0447\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>eyeDist<\/code> \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u043e\u0447\u043a\u0438 \u043f\u043e \u043e\u0441\u0438 Z, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0443\u0433\u043e\u043b \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c \u00ab\u0432\u0432\u0435\u0440\u0445\u00bb \u0438 \u043e\u0441\u044c\u044e Y. \u0418 \u0432\u0443\u0430\u043b\u044f!<\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0432\u043c\u0435\u0441\u0442\u0435:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u043e\u0441\u0442\u044b\u043d\u044f \u0441 \u043a\u043e\u0434\u043e\u043c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"xml\">&lt;html&gt;     &lt;head&gt;         &lt;title&gt;Creating a Snapchat-Style Virtual Glasses Face Filter&lt;\/title&gt;         &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/@tensorflow\/tfjs@2.4.0\/dist\/tf.min.js\"&gt;&lt;\/script&gt;         &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/@tensorflow-models\/face-landmarks-detection@0.0.1\/dist\/face-landmarks-detection.js\"&gt;&lt;\/script&gt;         &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/three@0.123.0\/build\/three.min.js\"&gt;&lt;\/script&gt;         &lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/three@0.123.0\/examples\/js\/loaders\/GLTFLoader.js\"&gt;&lt;\/script&gt;     &lt;\/head&gt;     &lt;style&gt;         .canvas-container {             position: relative;             width: auto;             height: auto;         }         .canvas-container canvas {             position: absolute;             left: 0;             width: auto;             height: auto;         }     &lt;\/style&gt;     &lt;body&gt;         &lt;div class=\"canvas-container\"&gt;             &lt;canvas id=\"output\"&gt;&lt;\/canvas&gt;             &lt;canvas id=\"overlay\"&gt;&lt;\/canvas&gt;         &lt;\/div&gt;         &lt;video id=\"webcam\" playsinline style=\"             visibility: hidden;             width: auto;             height: auto;             \"&gt;         &lt;\/video&gt;         &lt;h1 id=\"status\"&gt;Loading...&lt;\/h1&gt;         &lt;script&gt;         function setText( text ) {             document.getElementById( \"status\" ).innerText = text;         }          function drawLine( ctx, x1, y1, x2, y2 ) {             ctx.beginPath();             ctx.moveTo( x1, y1 );             ctx.lineTo( x2, y2 );             ctx.stroke();         }          async function setupWebcam() {             return new Promise( ( resolve, reject ) =&gt; {                 const webcamElement = document.getElementById( \"webcam\" );                 const navigatorAny = navigator;                 navigator.getUserMedia = navigator.getUserMedia ||                 navigatorAny.webkitGetUserMedia || navigatorAny.mozGetUserMedia ||                 navigatorAny.msGetUserMedia;                 if( navigator.getUserMedia ) {                     navigator.getUserMedia( { video: true },                         stream =&gt; {                             webcamElement.srcObject = stream;                             webcamElement.addEventListener( \"loadeddata\", resolve, false );                         },                     error =&gt; reject());                 }                 else {                     reject();                 }          <\/code><\/pre>\n<\/div>\n<\/details>\n<\/hr>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-319069","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/319069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=319069"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/319069\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=319069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=319069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=319069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}