diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..d53dc41b437db55daee61e0e27008c731a309a06 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +models/face_recognition_model-shard1 filter=lfs diff=lfs merge=lfs -text +models/face_recognition_model-shard2 filter=lfs diff=lfs merge=lfs -text +models/mtcnn_model-shard1 filter=lfs diff=lfs merge=lfs -text +models/ssd_mobilenetv1_model-shard1 filter=lfs diff=lfs merge=lfs -text +models/ssd_mobilenetv1_model-shard2 filter=lfs diff=lfs merge=lfs -text diff --git a/css/1.png b/css/1.png new file mode 100644 index 0000000000000000000000000000000000000000..97e1d22ac4c13c42ffd736f42f0ae310caae5cee Binary files /dev/null and b/css/1.png differ diff --git a/css/2.png b/css/2.png new file mode 100644 index 0000000000000000000000000000000000000000..9aa42cd89bd21f99be7e7badb5dd1f622f874ba9 Binary files /dev/null and b/css/2.png differ diff --git a/css/3.png b/css/3.png new file mode 100644 index 0000000000000000000000000000000000000000..89fe8053ecf2ee1e0f623f781571ade2c1bf1e8d Binary files /dev/null and b/css/3.png differ diff --git a/css/4.png b/css/4.png new file mode 100644 index 0000000000000000000000000000000000000000..029fc536ba43feae02af6db5e2e29c52d7a1f1c6 Binary files /dev/null and b/css/4.png differ diff --git a/css/emot.png b/css/emot.png new file mode 100644 index 0000000000000000000000000000000000000000..32951a1c482a37051fc168a5e62386d7e9034708 Binary files /dev/null and b/css/emot.png differ diff --git a/css/emot2.png b/css/emot2.png new file mode 100644 index 0000000000000000000000000000000000000000..31ba97a390d5caf88e10ca92c112abe08e07ebd4 Binary files /dev/null and b/css/emot2.png differ diff --git a/css/idade.png b/css/idade.png new file mode 100644 index 0000000000000000000000000000000000000000..88b700c3385878f8a94a1115941cb0b78a69956b Binary files /dev/null and b/css/idade.png differ diff --git a/css/idade2.png b/css/idade2.png new file mode 100644 index 0000000000000000000000000000000000000000..e606d3a0d65a6d3a7a2076911a5b13e057faf07f Binary files /dev/null and b/css/idade2.png differ diff --git a/css/jso.png b/css/jso.png new file mode 100644 index 0000000000000000000000000000000000000000..43d0b2688b48e49f83700e9b42130b78387f9043 Binary files /dev/null and b/css/jso.png differ diff --git a/css/jso1.png b/css/jso1.png new file mode 100644 index 0000000000000000000000000000000000000000..c948ebed3296cd781c8b2ca32def4f5f52e38347 Binary files /dev/null and b/css/jso1.png differ diff --git a/css/lan.png b/css/lan.png new file mode 100644 index 0000000000000000000000000000000000000000..87ae169f2bc5818ad2f2481337c3e477f44b084a Binary files /dev/null and b/css/lan.png differ diff --git a/css/lan1.png b/css/lan1.png new file mode 100644 index 0000000000000000000000000000000000000000..30a73cb598b757d5b746b6be60459cf7812ebcf0 Binary files /dev/null and b/css/lan1.png differ diff --git a/css/mon.png b/css/mon.png new file mode 100644 index 0000000000000000000000000000000000000000..6c51957d852e7771d3171411b27c9d42579a5b52 Binary files /dev/null and b/css/mon.png differ diff --git a/css/olhar.css b/css/olhar.css new file mode 100644 index 0000000000000000000000000000000000000000..754d45a4e08922116bf4187aa5729d25334bdf27 --- /dev/null +++ b/css/olhar.css @@ -0,0 +1,231 @@ +body { + margin: 0; + font-family: Arial, sans-serif; + } + + + + nav ul { + list-style: none; + margin: 0; + padding: 0; + display: flex; + } + + nav li { + margin-right: 10px; + } + + nav a { + color: #fff; + text-decoration: none; + } + + + .active { + font-weight: bold; + color: #e30000; + } + + form { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + + label, input[type="file"], input[type="checkbox"], input[type="submit"] { + width: 49%; + text-align: center; + margin: 10px 0; + } + #detectar-emocoes-results { + top: 190px; + left: 370px; + } + input[type="button"] { + display: none; + } + + .switch { + position: relative; + display: inline-block; + width: 60px; + height: 34px; + } + + .switch input { + opacity: 0; + width: 0; + height: 0; + } + + .slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #ccc; + -webkit-transition: .4s; + transition: .4s; + } + + .slider:before { + position: absolute; + content: ""; + height: 26px; + width: 26px; + left: 4px; + bottom: 4px; + background-color: white; + -webkit-transition: .4s; + transition: .4s; + } + + input:checked + .slider { + background-color: #2196F3; + } + + input:focus + .slider { + box-shadow: 0 0 1px #2196F3; + } + + input:checked + .slider:before { + -webkit-transform: translateX(26px); + -ms-transform: translateX(26px); + transform: translateX(26px); + } + + .slider.round { + border-radius: 34px; + } + + .slider.round:before { + border-radius: 50%; + } + + input[type="submit"] { + background-color: #4CAF50; /* Fundo verde */ + color: white; /* Cor da fonte branca */ + padding: 14px 20px; /* Espaçamento interno */ + border: none; /* Sem borda */ + border-radius: 4px; /* Arredondamento de borda */ + cursor: pointer; /* Cursor em forma de mão */ + font-size: 16px; /* Tamanho da fonte */ + width: 120px; + } + + input[type="submit"]:hover { + background-color: #3e8e41; /* Mudança de cor ao passar o mouse */ + } + + #start-camera-button.slider:before { + content: ""; + background-image: url('./sun.png'); + font-family: "Font Awesome 5 Free"; + font-weight: 900; + color: rgb(5, 2, 2); + text-align: center; + line-height: 26px; + font-size: 16px; + } + + #start-camera-button:checked + .slider:before { + background-image: url('./mon.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + #start-camera-button + .slider:before { + background-image: url('./sun.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + #extract-points-button:checked + .slider:before { + content: "\f1c0"; + font-family: "Font Awesome 5 Free"; + font-weight: 900; + color: white; + text-align: center; + line-height: 26px; + font-size: 16px; + } + #extract-points-button:checked + .slider:before { + background-image: url('./jso.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + #extract-points-button + .slider:before { + background-image: url('./jso1.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + .eye-button { + width: 50px; + height: 50px; + margin: 10px; + background: #5753535f; + color:white; + font-size: 22px; +} + +#camera-card, video, canvas { + + + width: 600px; + height: 350px; + position: absolute; + top: 10px; + box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); + background: #fff; + border-radius: 8px; + overflow: hidden; + z-index: 1000; +} +video { + width: 100%; + height: 100%; +} + +canvas { + width: 100%; + height: 100%; +} +#camera-card { + left: 200px; +} + +#canvas-botoes { + left: 200px; +} +#canvas-botoes { + width: 600px; + height: 350px; + position: fixed; + top: 60px; + box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1); + background: #ffffff4a; + border-radius: 8px; + overflow: hidden; + z-index: 1200; +} +#detectar-emocoes-form { + margin-top: 170px; +} +#landmarkCanvas { + background: none; + z-index: 1500; +} + +.btnGroup { + margin-top: 20px; +} + + +.selected { + background-color: lightblue; +} \ No newline at end of file diff --git a/css/pont1.png b/css/pont1.png new file mode 100644 index 0000000000000000000000000000000000000000..32d216f4a63bc0dd9c12c4592d4b1c2232ce74f7 Binary files /dev/null and b/css/pont1.png differ diff --git a/css/pont2.png b/css/pont2.png new file mode 100644 index 0000000000000000000000000000000000000000..80263067e7eec2e6d20b9823d19dc961ab3b1529 Binary files /dev/null and b/css/pont2.png differ diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000000000000000000000000000000000000..3d7bc71358ab404aa2c112f9522c0713894f9a7f --- /dev/null +++ b/css/style.css @@ -0,0 +1,276 @@ +body { + margin: 0; + font-family: Arial, sans-serif; + } + + header { + position: fixed; + top: 0; + left: 0; + right: 0; + background-color: #333; + color: #fff; + padding: 10px; + } + + nav ul { + list-style: none; + margin: 0; + padding: 0; + display: flex; + } + + nav li { + margin-right: 10px; + } + + nav a { + color: #fff; + text-decoration: none; + } + + main { + padding: 50px; + } + + section { + display: none; + margin-top: 50px; + } + + section.active { + display: block; + } + + .active { + font-weight: bold; + color: #e30000; + } + video { + position: fixed; + top: 210px; + left: 250px; + width: 240px; + height: 200px; + margin-right: 20px; + } + + canvas { + position: fixed; + top: 210px; + left: 250px; + width: 240px; + height: 200px; + margin-right: 20px; + } + form { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + } + + label, input[type="file"], input[type="checkbox"], input[type="submit"] { + width: 49%; + text-align: center; + margin: 10px 0; + } + #detectar-emocoes-results { + top: 190px; + left: 370px; + } + input[type="button"] { + display: none; + } + + .switch { + position: relative; + display: inline-block; + width: 60px; + height: 34px; + } + + .switch input { + opacity: 0; + width: 0; + height: 0; + } + + .slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #ccc; + -webkit-transition: .4s; + transition: .4s; + } + + .slider:before { + position: absolute; + content: ""; + height: 26px; + width: 26px; + left: 4px; + bottom: 4px; + background-color: white; + -webkit-transition: .4s; + transition: .4s; + } + + input:checked + .slider { + background-color: #2196F3; + } + + input:focus + .slider { + box-shadow: 0 0 1px #2196F3; + } + + input:checked + .slider:before { + -webkit-transform: translateX(26px); + -ms-transform: translateX(26px); + transform: translateX(26px); + } + + .slider.round { + border-radius: 34px; + } + + .slider.round:before { + border-radius: 50%; + } + + input[type="submit"] { + background-color: #4CAF50; /* Fundo verde */ + color: white; /* Cor da fonte branca */ + padding: 14px 20px; /* Espaçamento interno */ + border: none; /* Sem borda */ + border-radius: 4px; /* Arredondamento de borda */ + cursor: pointer; /* Cursor em forma de mão */ + font-size: 16px; /* Tamanho da fonte */ + width: 120px; + } + + input[type="submit"]:hover { + background-color: #3e8e41; /* Mudança de cor ao passar o mouse */ + } + + #start-camera-button.slider:before { + content: ""; + background-image: url('./sun.png'); + font-family: "Font Awesome 5 Free"; + font-weight: 900; + color: rgb(5, 2, 2); + text-align: center; + line-height: 26px; + font-size: 16px; + } + + #start-camera-button:checked + .slider:before { + background-image: url('./mon.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + #start-camera-button + .slider:before { + background-image: url('./sun.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + /* Emotions Icon */ + #detect-emotions-button:before { + content: ""; + background-image: url('./sun.png'); + font-family: "Font Awesome 5 Free"; + font-weight: 900; + color: white; + text-align: center; + line-height: 26px; + font-size: 16px; + height: 36px; + width: 36px; + } + #detect-emotions-button:checked + .slider:before { + background-image: url('./emot.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + #detect-emotions-button + .slider:before { + background-image: url('./emot2.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + /* Landmarks Icon */ + #detect-landmarks-button:checked + .slider:before { + content: "\f0c2"; + font-family: "Font Awesome 5 Free"; + font-weight: 900; + color: white; + text-align: center; + line-height: 26px; + font-size: 16px; + } + #detect-landmarks-button:checked + .slider:before { + background-image: url('./lan.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + #detect-landmarks-button + .slider:before { + background-image: url('./lan1.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + /* Age Icon */ + #detect-age-button:checked + .slider:before { + content: "\f235"; + font-family: "Font Awesome 5 Free"; + font-weight: 900; + color: white; + text-align: center; + line-height: 26px; + font-size: 16px; + } + #detect-age-button:checked + .slider:before { + background-image: url('./idade.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + #detect-age-button + .slider:before { + background-image: url('./idade2.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + /* Extract Points Icon */ + #extract-points-button:checked + .slider:before { + content: "\f1c0"; + font-family: "Font Awesome 5 Free"; + font-weight: 900; + color: white; + text-align: center; + line-height: 26px; + font-size: 16px; + } + #extract-points-button:checked + .slider:before { + background-image: url('./jso.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + + #extract-points-button + .slider:before { + background-image: url('./jso1.png'); + background-size: 26px 26px; /* altura e largura que você deseja */ + background-repeat: no-repeat; + } + .eye-button { + /* Estilize seus botões aqui */ + width: 50px; + height: 50px; + margin: 10px; + font-size: 24px; +} diff --git a/css/sun.png b/css/sun.png new file mode 100644 index 0000000000000000000000000000000000000000..288d45bf6ea2eb6fdd5ebe16b61240ff748fd7c2 Binary files /dev/null and b/css/sun.png differ diff --git a/css/treinamento.png b/css/treinamento.png new file mode 100644 index 0000000000000000000000000000000000000000..9204b25fc067f38298101eff6301340d2a66942c Binary files /dev/null and b/css/treinamento.png differ diff --git a/css/w3.css b/css/w3.css new file mode 100644 index 0000000000000000000000000000000000000000..a68ea9908c561f8211be89c172ac08f543c2c068 --- /dev/null +++ b/css/w3.css @@ -0,0 +1,235 @@ +/* W3.CSS 4.15 December 2020 by Jan Egil and Borge Refsnes */ +html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit} +/* Extract from normalize.css by Nicolas Gallagher and Jonathan Neal git.io/normalize */ +html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0} +article,aside,details,figcaption,figure,footer,header,main,menu,nav,section{display:block}summary{display:list-item} +audio,canvas,progress,video{display:inline-block}progress{vertical-align:baseline} +audio:not([controls]){display:none;height:0}[hidden],template{display:none} +a{background-color:transparent}a:active,a:hover{outline-width:0} +abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted} +b,strong{font-weight:bolder}dfn{font-style:italic}mark{background:#ff0;color:#000} +small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} +sub{bottom:-0.25em}sup{top:-0.5em}figure{margin:1em 40px}img{border-style:none} +code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}hr{box-sizing:content-box;height:0;overflow:visible} +button,input,select,textarea,optgroup{font:inherit;margin:0}optgroup{font-weight:bold} +button,input{overflow:visible}button,select{text-transform:none} +button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button} +button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0} +button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText} +fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:.35em .625em .75em} +legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto} +[type=checkbox],[type=radio]{padding:0} +[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto} +[type=search]{-webkit-appearance:textfield;outline-offset:-2px} +[type=search]::-webkit-search-decoration{-webkit-appearance:none} +::-webkit-file-upload-button{-webkit-appearance:button;font:inherit} +/* End extract */ +html,body{font-family:Verdana,sans-serif;font-size:15px;line-height:1.5}html{overflow-x:hidden} +h1{font-size:36px}h2{font-size:30px}h3{font-size:24px}h4{font-size:20px}h5{font-size:18px}h6{font-size:16px} +.w3-serif{font-family:serif}.w3-sans-serif{font-family:sans-serif}.w3-cursive{font-family:cursive}.w3-monospace{font-family:monospace} +h1,h2,h3,h4,h5,h6{font-family:"Segoe UI",Arial,sans-serif;font-weight:400;margin:10px 0}.w3-wide{letter-spacing:4px} +hr{border:0;border-top:1px solid #eee;margin:20px 0} +.w3-image{max-width:100%;height:auto}img{vertical-align:middle}a{color:inherit} +.w3-table,.w3-table-all{border-collapse:collapse;border-spacing:0;width:100%;display:table}.w3-table-all{border:1px solid #ccc} +.w3-bordered tr,.w3-table-all tr{border-bottom:1px solid #ddd}.w3-striped tbody tr:nth-child(even){background-color:#f1f1f1} +.w3-table-all tr:nth-child(odd){background-color:#fff}.w3-table-all tr:nth-child(even){background-color:#f1f1f1} +.w3-hoverable tbody tr:hover,.w3-ul.w3-hoverable li:hover{background-color:#ccc}.w3-centered tr th,.w3-centered tr td{text-align:center} +.w3-table td,.w3-table th,.w3-table-all td,.w3-table-all th{padding:8px 8px;display:table-cell;text-align:left;vertical-align:top} +.w3-table th:first-child,.w3-table td:first-child,.w3-table-all th:first-child,.w3-table-all td:first-child{padding-left:16px} +.w3-btn,.w3-button{border:none;display:inline-block;padding:8px 16px;vertical-align:middle;overflow:hidden;text-decoration:none;color:inherit;background-color:inherit;text-align:center;cursor:pointer;white-space:nowrap} +.w3-btn:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19)} +.w3-btn,.w3-button{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} +.w3-disabled,.w3-btn:disabled,.w3-button:disabled{cursor:not-allowed;opacity:0.3}.w3-disabled *,:disabled *{pointer-events:none} +.w3-btn.w3-disabled:hover,.w3-btn:disabled:hover{box-shadow:none} +.w3-badge,.w3-tag{background-color:#000;color:#fff;display:inline-block;padding-left:8px;padding-right:8px;text-align:center}.w3-badge{border-radius:50%} +.w3-ul{list-style-type:none;padding:0;margin:0}.w3-ul li{padding:8px 16px;border-bottom:1px solid #ddd}.w3-ul li:last-child{border-bottom:none} +.w3-tooltip,.w3-display-container{position:relative}.w3-tooltip .w3-text{display:none}.w3-tooltip:hover .w3-text{display:inline-block} +.w3-ripple:active{opacity:0.5}.w3-ripple{transition:opacity 0s} +.w3-input{padding:8px;display:block;border:none;border-bottom:1px solid #ccc;width:100%} +.w3-select{padding:9px 0;width:100%;border:none;border-bottom:1px solid #ccc} +.w3-dropdown-click,.w3-dropdown-hover{position:relative;display:inline-block;cursor:pointer} +.w3-dropdown-hover:hover .w3-dropdown-content{display:block} +.w3-dropdown-hover:first-child,.w3-dropdown-click:hover{background-color:#ccc;color:#000} +.w3-dropdown-hover:hover > .w3-button:first-child,.w3-dropdown-click:hover > .w3-button:first-child{background-color:#ccc;color:#000} +.w3-dropdown-content{cursor:auto;color:#000;background-color:#fff;display:none;position:absolute;min-width:160px;margin:0;padding:0;z-index:1} +.w3-check,.w3-radio{width:24px;height:24px;position:relative;top:6px} +.w3-sidebar{height:100%;width:200px;background-color:#fff;position:fixed!important;z-index:1;overflow:auto} +.w3-bar-block .w3-dropdown-hover,.w3-bar-block .w3-dropdown-click{width:100%} +.w3-bar-block .w3-dropdown-hover .w3-dropdown-content,.w3-bar-block .w3-dropdown-click .w3-dropdown-content{min-width:100%} +.w3-bar-block .w3-dropdown-hover .w3-button,.w3-bar-block .w3-dropdown-click .w3-button{width:100%;text-align:left;padding:8px 16px} +.w3-main,#main{transition:margin-left .4s} +.w3-modal{z-index:3;display:none;padding-top:100px;position:fixed;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4)} +.w3-modal-content{margin:auto;background-color:#fff;position:relative;padding:0;outline:0;width:600px} +.w3-bar{width:100%;overflow:hidden}.w3-center .w3-bar{display:inline-block;width:auto} +.w3-bar .w3-bar-item{padding:8px 16px;float:left;width:auto;border:none;display:block;outline:0} +.w3-bar .w3-dropdown-hover,.w3-bar .w3-dropdown-click{position:static;float:left} +.w3-bar .w3-button{white-space:normal} +.w3-bar-block .w3-bar-item{width:100%;display:block;padding:8px 16px;text-align:left;border:none;white-space:normal;float:none;outline:0} +.w3-bar-block.w3-center .w3-bar-item{text-align:center}.w3-block{display:block;width:100%} +.w3-responsive{display:block;overflow-x:auto} +.w3-container:after,.w3-container:before,.w3-panel:after,.w3-panel:before,.w3-row:after,.w3-row:before,.w3-row-padding:after,.w3-row-padding:before, +.w3-cell-row:before,.w3-cell-row:after,.w3-clear:after,.w3-clear:before,.w3-bar:before,.w3-bar:after{content:"";display:table;clear:both} +.w3-col,.w3-half,.w3-third,.w3-twothird,.w3-threequarter,.w3-quarter{float:left;width:100%} +.w3-col.s1{width:8.33333%}.w3-col.s2{width:16.66666%}.w3-col.s3{width:24.99999%}.w3-col.s4{width:33.33333%} +.w3-col.s5{width:41.66666%}.w3-col.s6{width:49.99999%}.w3-col.s7{width:58.33333%}.w3-col.s8{width:66.66666%} +.w3-col.s9{width:74.99999%}.w3-col.s10{width:83.33333%}.w3-col.s11{width:91.66666%}.w3-col.s12{width:99.99999%} +@media (min-width:601px){.w3-col.m1{width:8.33333%}.w3-col.m2{width:16.66666%}.w3-col.m3,.w3-quarter{width:19.99999%}.w3-col.m4,.w3-third{width:33.33333%} +.w3-col.m5{width:41.66666%}.w3-col.m6,.w3-half{width:49.99999%}.w3-col.m7{width:58.33333%}.w3-col.m8,.w3-twothird{width:66.66666%} +.w3-col.m9,.w3-threequarter{width:74.99999%}.w3-col.m10{width:83.33333%}.w3-col.m11{width:91.66666%}.w3-col.m12{width:99.99999%}} +@media (min-width:993px){.w3-col.l1{width:8.33333%}.w3-col.l2{width:16.66666%}.w3-col.l3{width:24.99999%}.w3-col.l4{width:33.33333%} +.w3-col.l5{width:41.66666%}.w3-col.l6{width:49.99999%}.w3-col.l7{width:58.33333%}.w3-col.l8{width:66.66666%} +.w3-col.l9{width:74.99999%}.w3-col.l10{width:83.33333%}.w3-col.l11{width:91.66666%}.w3-col.l12{width:99.99999%}} +.w3-rest{overflow:hidden}.w3-stretch{margin-left:-16px;margin-right:-16px} +.w3-content,.w3-auto{margin-left:auto;margin-right:auto}.w3-content{max-width:980px}.w3-auto{max-width:1140px} +.w3-cell-row{display:table;width:100%}.w3-cell{display:table-cell} +.w3-cell-top{vertical-align:top}.w3-cell-middle{vertical-align:middle}.w3-cell-bottom{vertical-align:bottom} +.w3-hide{display:none!important}.w3-show-block,.w3-show{display:block!important}.w3-show-inline-block{display:inline-block!important} +@media (max-width:1205px){.w3-auto{max-width:95%}} +@media (max-width:600px){.w3-modal-content{margin:0 10px;width:auto!important}.w3-modal{padding-top:30px} +.w3-dropdown-hover.w3-mobile .w3-dropdown-content,.w3-dropdown-click.w3-mobile .w3-dropdown-content{position:relative} +.w3-hide-small{display:none!important}.w3-mobile{display:block;width:100%!important}.w3-bar-item.w3-mobile,.w3-dropdown-hover.w3-mobile,.w3-dropdown-click.w3-mobile{text-align:center} +.w3-dropdown-hover.w3-mobile,.w3-dropdown-hover.w3-mobile .w3-btn,.w3-dropdown-hover.w3-mobile .w3-button,.w3-dropdown-click.w3-mobile,.w3-dropdown-click.w3-mobile .w3-btn,.w3-dropdown-click.w3-mobile .w3-button{width:100%}} +@media (max-width:768px){.w3-modal-content{width:500px}.w3-modal{padding-top:50px}} +@media (min-width:993px){.w3-modal-content{width:900px}.w3-hide-large{display:none!important}.w3-sidebar.w3-collapse{display:block!important}} +@media (max-width:992px) and (min-width:601px){.w3-hide-medium{display:none!important}} +@media (max-width:992px){.w3-sidebar.w3-collapse{display:none}.w3-main{margin-left:0!important;margin-right:0!important}.w3-auto{max-width:100%}} +.w3-top,.w3-bottom{position:fixed;width:100%;z-index:1}.w3-top{top:0}.w3-bottom{bottom:0} +.w3-overlay{position:fixed;display:none;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.5);z-index:2} +.w3-display-topleft{position:absolute;left:0;top:0}.w3-display-topright{position:absolute;right:0;top:0} +.w3-display-bottomleft{position:absolute;left:0;bottom:0}.w3-display-bottomright{position:absolute;right:0;bottom:0} +.w3-display-middle{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)} +.w3-display-left{position:absolute;top:50%;left:-33%;transform:translate(0%,-50%);-ms-transform:translate(-0%,-50%)} +.w3-display-right{position:absolute;top:50%;right:-33%;transform:translate(0%,-50%);-ms-transform:translate(0%,-50%)} +.w3-display-topmiddle{position:absolute;left:50%;top:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)} +.w3-display-bottommiddle{position:absolute;left:50%;bottom:0;transform:translate(-50%,0%);-ms-transform:translate(-50%,0%)} +.w3-display-container:hover .w3-display-hover{display:block}.w3-display-container:hover span.w3-display-hover{display:inline-block}.w3-display-hover{display:none} +.w3-display-position{position:absolute} +.w3-circle{border-radius:50%} +.w3-round-small{border-radius:2px}.w3-round,.w3-round-medium{border-radius:4px}.w3-round-large{border-radius:8px}.w3-round-xlarge{border-radius:16px}.w3-round-xxlarge{border-radius:32px} +.w3-row-padding,.w3-row-padding>.w3-half,.w3-row-padding>.w3-third,.w3-row-padding>.w3-twothird,.w3-row-padding>.w3-threequarter,.w3-row-padding>.w3-quarter,.w3-row-padding>.w3-col{padding:0 8px} +.w3-container,.w3-panel{padding:0.01em 16px}.w3-panel{margin-top:16px;margin-bottom:16px} +.w3-code,.w3-codespan{font-family:Consolas,"courier new";font-size:16px} +.w3-code{width:auto;background-color:#fff;padding:8px 12px;border-left:4px solid #4CAF50;word-wrap:break-word} +.w3-codespan{color:crimson;background-color:#f1f1f1;padding-left:4px;padding-right:4px;font-size:110%} +.w3-card,.w3-card-2{box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)} +.w3-card-4,.w3-hover-shadow:hover{box-shadow:0 4px 10px 0 rgba(0,0,0,0.2),0 4px 20px 0 rgba(0,0,0,0.19)} +.w3-spin{animation:w3-spin 2s infinite linear}@keyframes w3-spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}} +.w3-animate-fading{animation:fading 10s infinite}@keyframes fading{0%{opacity:0}50%{opacity:1}100%{opacity:0}} +.w3-animate-opacity{animation:opac 0.8s}@keyframes opac{from{opacity:0} to{opacity:1}} +.w3-animate-top{position:relative;animation:animatetop 0.4s}@keyframes animatetop{from{top:-300px;opacity:0} to{top:0;opacity:1}} +.w3-animate-left{position:relative;animation:animateleft 0.4s}@keyframes animateleft{from{left:-300px;opacity:0} to{left:0;opacity:1}} +.w3-animate-right{position:relative;animation:animateright 0.4s}@keyframes animateright{from{right:-300px;opacity:0} to{right:0;opacity:1}} +.w3-animate-bottom{position:relative;animation:animatebottom 0.4s}@keyframes animatebottom{from{bottom:-300px;opacity:0} to{bottom:0;opacity:1}} +.w3-animate-zoom {animation:animatezoom 0.6s}@keyframes animatezoom{from{transform:scale(0)} to{transform:scale(1)}} +.w3-animate-input{transition:width 0.4s ease-in-out}.w3-animate-input:focus{width:100%!important} +.w3-opacity,.w3-hover-opacity:hover{opacity:0.60}.w3-opacity-off,.w3-hover-opacity-off:hover{opacity:1} +.w3-opacity-max{opacity:0.25}.w3-opacity-min{opacity:0.75} +.w3-greyscale-max,.w3-grayscale-max,.w3-hover-greyscale:hover,.w3-hover-grayscale:hover{filter:grayscale(100%)} +.w3-greyscale,.w3-grayscale{filter:grayscale(75%)}.w3-greyscale-min,.w3-grayscale-min{filter:grayscale(50%)} +.w3-sepia{filter:sepia(75%)}.w3-sepia-max,.w3-hover-sepia:hover{filter:sepia(100%)}.w3-sepia-min{filter:sepia(50%)} +.w3-tiny{font-size:10px!important}.w3-small{font-size:12px!important}.w3-medium{font-size:15px!important}.w3-large{font-size:18px!important} +.w3-xlarge{font-size:24px!important}.w3-xxlarge{font-size:36px!important}.w3-xxxlarge{font-size:48px!important}.w3-jumbo{font-size:64px!important} +.w3-left-align{text-align:left!important}.w3-right-align{text-align:right!important}.w3-justify{text-align:justify!important}.w3-center{text-align:center!important} +.w3-border-0{border:0!important}.w3-border{border:1px solid #ccc!important} +.w3-border-top{border-top:1px solid #ccc!important}.w3-border-bottom{border-bottom:1px solid #ccc!important} +.w3-border-left{border-left:1px solid #ccc!important}.w3-border-right{border-right:1px solid #ccc!important} +.w3-topbar{border-top:6px solid #ccc!important}.w3-bottombar{border-bottom:6px solid #ccc!important} +.w3-leftbar{border-left:6px solid #ccc!important}.w3-rightbar{border-right:6px solid #ccc!important} +.w3-section,.w3-code{margin-top:16px!important;margin-bottom:16px!important} +.w3-margin{margin:16px!important}.w3-margin-top{margin-top:16px!important}.w3-margin-bottom{margin-bottom:16px!important} +.w3-margin-left{margin-left:16px!important}.w3-margin-right{margin-right:16px!important} +.w3-padding-small{padding:4px 8px!important}.w3-padding{padding:8px 16px!important}.w3-padding-large{padding:12px 24px!important} +.w3-padding-16{padding-top:16px!important;padding-bottom:16px!important}.w3-padding-24{padding-top:24px!important;padding-bottom:24px!important} +.w3-padding-32{padding-top:32px!important;padding-bottom:32px!important}.w3-padding-48{padding-top:48px!important;padding-bottom:48px!important} +.w3-padding-64{padding-top:64px!important;padding-bottom:64px!important} +.w3-padding-top-64{padding-top:64px!important}.w3-padding-top-48{padding-top:48px!important} +.w3-padding-top-32{padding-top:32px!important}.w3-padding-top-24{padding-top:24px!important} +.w3-left{float:left!important}.w3-right{float:right!important} +.w3-button:hover{color:#000!important;background-color:#ccc!important} +.w3-transparent,.w3-hover-none:hover{background-color:transparent!important} +.w3-hover-none:hover{box-shadow:none!important} +/* Colors */ +.w3-amber,.w3-hover-amber:hover{color:#000!important;background-color:#ffc107!important} +.w3-aqua,.w3-hover-aqua:hover{color:#000!important;background-color:#00ffff!important} +.w3-blue,.w3-hover-blue:hover{color:#fff!important;background-color:#2196F3!important} +.w3-light-blue,.w3-hover-light-blue:hover{color:#000!important;background-color:#87CEEB!important} +.w3-brown,.w3-hover-brown:hover{color:#fff!important;background-color:#795548!important} +.w3-cyan,.w3-hover-cyan:hover{color:#000!important;background-color:#00bcd4!important} +.w3-blue-grey,.w3-hover-blue-grey:hover,.w3-blue-gray,.w3-hover-blue-gray:hover{color:#fff!important;background-color:#607d8b!important} +.w3-green,.w3-hover-green:hover{color:#fff!important;background-color:#4CAF50!important} +.w3-light-green,.w3-hover-light-green:hover{color:#000!important;background-color:#8bc34a!important} +.w3-indigo,.w3-hover-indigo:hover{color:#fff!important;background-color:#3f51b5!important} +.w3-khaki,.w3-hover-khaki:hover{color:#000!important;background-color:#f0e68c!important} +.w3-lime,.w3-hover-lime:hover{color:#000!important;background-color:#cddc39!important} +.w3-orange,.w3-hover-orange:hover{color:#000!important;background-color:#ff9800!important} +.w3-deep-orange,.w3-hover-deep-orange:hover{color:#fff!important;background-color:#ff5722!important} +.w3-pink,.w3-hover-pink:hover{color:#fff!important;background-color:#e91e63!important} +.w3-purple,.w3-hover-purple:hover{color:#fff!important;background-color:#9c27b0!important} +.w3-deep-purple,.w3-hover-deep-purple:hover{color:#fff!important;background-color:#673ab7!important} +.w3-red,.w3-hover-red:hover{color:#fff!important;background-color:#f44336!important} +.w3-sand,.w3-hover-sand:hover{color:#000!important;background-color:#fdf5e6!important} +.w3-teal,.w3-hover-teal:hover{color:#fff!important;background-color:#009688!important} +.w3-yellow,.w3-hover-yellow:hover{color:#000!important;background-color:#ffeb3b!important} +.w3-white,.w3-hover-white:hover{color:#000!important;background-color:#fff!important} +.w3-black,.w3-hover-black:hover{color:#fff!important;background-color:#000!important} +.w3-grey,.w3-hover-grey:hover,.w3-gray,.w3-hover-gray:hover{color:#000!important;background-color:#9e9e9e!important} +.w3-light-grey,.w3-hover-light-grey:hover,.w3-light-gray,.w3-hover-light-gray:hover{color:#000!important;background-color:#f1f1f1!important} +.w3-dark-grey,.w3-hover-dark-grey:hover,.w3-dark-gray,.w3-hover-dark-gray:hover{color:#fff!important;background-color:#616161!important} +.w3-pale-red,.w3-hover-pale-red:hover{color:#000!important;background-color:#ffdddd!important} +.w3-pale-green,.w3-hover-pale-green:hover{color:#000!important;background-color:#ddffdd!important} +.w3-pale-yellow,.w3-hover-pale-yellow:hover{color:#000!important;background-color:#ffffcc!important} +.w3-pale-blue,.w3-hover-pale-blue:hover{color:#000!important;background-color:#ddffff!important} +.w3-text-amber,.w3-hover-text-amber:hover{color:#ffc107!important} +.w3-text-aqua,.w3-hover-text-aqua:hover{color:#00ffff!important} +.w3-text-blue,.w3-hover-text-blue:hover{color:#2196F3!important} +.w3-text-light-blue,.w3-hover-text-light-blue:hover{color:#87CEEB!important} +.w3-text-brown,.w3-hover-text-brown:hover{color:#795548!important} +.w3-text-cyan,.w3-hover-text-cyan:hover{color:#00bcd4!important} +.w3-text-blue-grey,.w3-hover-text-blue-grey:hover,.w3-text-blue-gray,.w3-hover-text-blue-gray:hover{color:#607d8b!important} +.w3-text-green,.w3-hover-text-green:hover{color:#4CAF50!important} +.w3-text-light-green,.w3-hover-text-light-green:hover{color:#8bc34a!important} +.w3-text-indigo,.w3-hover-text-indigo:hover{color:#3f51b5!important} +.w3-text-khaki,.w3-hover-text-khaki:hover{color:#b4aa50!important} +.w3-text-lime,.w3-hover-text-lime:hover{color:#cddc39!important} +.w3-text-orange,.w3-hover-text-orange:hover{color:#ff9800!important} +.w3-text-deep-orange,.w3-hover-text-deep-orange:hover{color:#ff5722!important} +.w3-text-pink,.w3-hover-text-pink:hover{color:#e91e63!important} +.w3-text-purple,.w3-hover-text-purple:hover{color:#9c27b0!important} +.w3-text-deep-purple,.w3-hover-text-deep-purple:hover{color:#673ab7!important} +.w3-text-red,.w3-hover-text-red:hover{color:#f44336!important} +.w3-text-sand,.w3-hover-text-sand:hover{color:#fdf5e6!important} +.w3-text-teal,.w3-hover-text-teal:hover{color:#009688!important} +.w3-text-yellow,.w3-hover-text-yellow:hover{color:#d2be0e!important} +.w3-text-white,.w3-hover-text-white:hover{color:#fff!important} +.w3-text-black,.w3-hover-text-black:hover{color:#000!important} +.w3-text-grey,.w3-hover-text-grey:hover,.w3-text-gray,.w3-hover-text-gray:hover{color:#757575!important} +.w3-text-light-grey,.w3-hover-text-light-grey:hover,.w3-text-light-gray,.w3-hover-text-light-gray:hover{color:#f1f1f1!important} +.w3-text-dark-grey,.w3-hover-text-dark-grey:hover,.w3-text-dark-gray,.w3-hover-text-dark-gray:hover{color:#3a3a3a!important} +.w3-border-amber,.w3-hover-border-amber:hover{border-color:#ffc107!important} +.w3-border-aqua,.w3-hover-border-aqua:hover{border-color:#00ffff!important} +.w3-border-blue,.w3-hover-border-blue:hover{border-color:#2196F3!important} +.w3-border-light-blue,.w3-hover-border-light-blue:hover{border-color:#87CEEB!important} +.w3-border-brown,.w3-hover-border-brown:hover{border-color:#795548!important} +.w3-border-cyan,.w3-hover-border-cyan:hover{border-color:#00bcd4!important} +.w3-border-blue-grey,.w3-hover-border-blue-grey:hover,.w3-border-blue-gray,.w3-hover-border-blue-gray:hover{border-color:#607d8b!important} +.w3-border-green,.w3-hover-border-green:hover{border-color:#4CAF50!important} +.w3-border-light-green,.w3-hover-border-light-green:hover{border-color:#8bc34a!important} +.w3-border-indigo,.w3-hover-border-indigo:hover{border-color:#3f51b5!important} +.w3-border-khaki,.w3-hover-border-khaki:hover{border-color:#f0e68c!important} +.w3-border-lime,.w3-hover-border-lime:hover{border-color:#cddc39!important} +.w3-border-orange,.w3-hover-border-orange:hover{border-color:#ff9800!important} +.w3-border-deep-orange,.w3-hover-border-deep-orange:hover{border-color:#ff5722!important} +.w3-border-pink,.w3-hover-border-pink:hover{border-color:#e91e63!important} +.w3-border-purple,.w3-hover-border-purple:hover{border-color:#9c27b0!important} +.w3-border-deep-purple,.w3-hover-border-deep-purple:hover{border-color:#673ab7!important} +.w3-border-red,.w3-hover-border-red:hover{border-color:#f44336!important} +.w3-border-sand,.w3-hover-border-sand:hover{border-color:#fdf5e6!important} +.w3-border-teal,.w3-hover-border-teal:hover{border-color:#009688!important} +.w3-border-yellow,.w3-hover-border-yellow:hover{border-color:#ffeb3b!important} +.w3-border-white,.w3-hover-border-white:hover{border-color:#fff!important} +.w3-border-black,.w3-hover-border-black:hover{border-color:#000!important} +.w3-border-grey,.w3-hover-border-grey:hover,.w3-border-gray,.w3-hover-border-gray:hover{border-color:#9e9e9e!important} +.w3-border-light-grey,.w3-hover-border-light-grey:hover,.w3-border-light-gray,.w3-hover-border-light-gray:hover{border-color:#f1f1f1!important} +.w3-border-dark-grey,.w3-hover-border-dark-grey:hover,.w3-border-dark-gray,.w3-hover-border-dark-gray:hover{border-color:#616161!important} +.w3-border-pale-red,.w3-hover-border-pale-red:hover{border-color:#ffe7e7!important}.w3-border-pale-green,.w3-hover-border-pale-green:hover{border-color:#e7ffe7!important} +.w3-border-pale-yellow,.w3-hover-border-pale-yellow:hover{border-color:#ffffcc!important}.w3-border-pale-blue,.w3-hover-border-pale-blue:hover{border-color:#e7ffff!important} \ No newline at end of file diff --git a/img/avatar1.png b/img/avatar1.png new file mode 100644 index 0000000000000000000000000000000000000000..427f224df90bac4b06ac2640d2f9a266461f98e0 Binary files /dev/null and b/img/avatar1.png differ diff --git a/img/avatar2.png b/img/avatar2.png new file mode 100644 index 0000000000000000000000000000000000000000..212b67196c3a431baae85712cd7a20be2a25cfcd Binary files /dev/null and b/img/avatar2.png differ diff --git a/img/glass.png b/img/glass.png new file mode 100644 index 0000000000000000000000000000000000000000..bf9b2ee72f0bce49a0db4cfd23925a20889f7842 Binary files /dev/null and b/img/glass.png differ diff --git a/img/mask.png b/img/mask.png new file mode 100644 index 0000000000000000000000000000000000000000..617fa4c44f1dfcb4863b756b2feb1aafdcc89939 Binary files /dev/null and b/img/mask.png differ diff --git a/img/steveoni.JPG b/img/steveoni.JPG new file mode 100644 index 0000000000000000000000000000000000000000..bf9b2ee72f0bce49a0db4cfd23925a20889f7842 Binary files /dev/null and b/img/steveoni.JPG differ diff --git a/index.html b/index.html index b0c4b3666032a737f3903db53e6a8a9272483e28..427dc37e82bff6661008f656d29203ec2c532ed9 100644 --- a/index.html +++ b/index.html @@ -1,19 +1,133 @@ - - -
- - -You can modify this app directly by editing index.html in the Files and versions tab.
-- Also don't forget to check the - Spaces documentation. -
-${result.age.toFixed(0)} anos
`; + resultsidade.appendChild(card); + } else { + console.error("Nenhuma idade detectada."); + } + }); + }, 500) + } else { + clearInterval(detectAgeInterval); + } + }); + + let extractPointsInterval; + extractPointsButton.addEventListener("change", async (event) => { + if (event.target.checked) { + extractPointsInterval = setInterval(async () => { + canvas = document.getElementById("landmarkCanvas"); + displaySize = { width: video.width, height: video.height}; + faceapi.matchDimensions(canvas,displaySize); + detections = await faceapi.detectAllFaces(video, new faceapi.TinyFaceDetectorOptions()).withFaceLandmarks(); + resizedDetections = faceapi.resizeResults(detections, displaySize); + resultsContainer.appendChild(video); + resultsContainer.appendChild(canvas); + function getBoxFromPoints(points) { + const box = { bottom: -Infinity, left: Infinity, right: -Infinity, top: Infinity, + get center() {return { x: this.left + this.width / 2, y: this.top + this.height / 2, }; + }, + get height() { return this.bottom - this.top; }, + get width() { return this.right - this.left; }, + }; + for (const point of points) { + box.left = Math.min(box.left, point.x); + box.right = Math.max(box.right, point.x); + box.bottom = Math.max(box.bottom, point.y); + box.top = Math.min(box.top, point.y); + } + return box; + } + + + +let tempoDeSelecao = 2000; +let tempoInicial; +let botaoSelecionado = null; +function calcularPontoDeOlhar(face) { + const olhoEsquerdo = face.landmarks.positions.slice(36, 42); + const olhoDireito = face.landmarks.positions.slice(42, 48); + + // Calculando os pontos centrais para cada olho + const centroEsquerdo = calcularCentro(olhoEsquerdo); + const centroDireito = calcularCentro(olhoDireito); + + // Calculando um ponto médio entre os centros dos dois olhos + const pontoFocal = { + x: (centroEsquerdo.x + centroDireito.x) / 2, + y: (centroEsquerdo.y + centroDireito.y) / 2 + }; + + return pontoFocal; +} + +function calcularCentro(pontos) { + const totalPontos = pontos.length; + const centro = pontos.reduce((soma, ponto) => { + soma.x += ponto._x; + soma.y += ponto._y; + return soma; + }, {x: 0, y: 0}); + + centro.x /= totalPontos; + centro.y /= totalPontos; + return centro; +} +function verificarBotaoSobOlhar(pontoFocal) { + const botoes = document.querySelectorAll('.eye-button'); + for(const botao of botoes) { + const rect = botao.getBoundingClientRect(); + console.log(rect.left) + console.log(pontoFocal.x) + if ( + pontoFocal.x >= rect.left && pontoFocal.x <= rect.right && + pontoFocal.y >= rect.top && pontoFocal.y <= rect.bottom + + ) { + console.log(pontoFocal) + return botao; // Retornará o botão que está sob o olhar + } + } + return null; // Retornará null se nenhum botão estiver sob o olhar +} + + function olhoEstaSobreBotao(pontoFocal, botao) { + return pontoFocal._x > botao.x && pontoFocal._x < botao.x + botao.width && pontoFocal._y > botao.y && pontoFocal._y < botao.y + botao.height; + } + + + document.querySelectorAll('.eye-button').forEach(botao => { + botao.addEventListener('mouseenter', () => { + tempoInicial = new Date().getTime(); + }); + botao.addEventListener('mouseleave', () => { + tempoInicial = null; + }); + }); + + setInterval(() => { + if(tempoInicial && new Date().getTime() - tempoInicial > tempoDeSelecao) { + console.log('Botão selecionado!'); + tempoInicial = null; + // Adicione a lógica para lidar com a seleção do botão aqui + } + }, 100); + + for (const face of resizedDetections) { + //const pontoFocal = calcularPontoDeOlhar(face); + + const features = { + mandibula: face.landmarks.positions.slice(0, 17), + sobrancelhaesquerda: face.landmarks.positions.slice(17, 22), + sobrancelhaDireita: face.landmarks.positions.slice(22, 27), + Pontenasal: face.landmarks.positions.slice(27, 31), + nariz: face.landmarks.positions.slice(31, 36), + olhoEsquerdo: face.landmarks.positions.slice(36, 42), + olhoDireito: face.landmarks.positions.slice(42, 48), + labioExterno: face.landmarks.positions.slice(48, 60), + labiointerno: face.landmarks.positions.slice(60), + }; + const pre = document.createElement("pre"); + pre.innerText = JSON.stringify(features, null, 2); + pontos.innerHTML = ""; + pontos.appendChild(pre); + + for (const eye of [features.olhoEsquerdo, features.olhoDireito]) { + const eyeBox = getBoxFromPoints(eye); + const fontSize = 20; + const context = canvas.getContext("2d"); + context.lineWidth = 2; + context.fillStyle = "#FF0000"; + context.beginPath(); + context.fillStyle = "rgba(20,30,22,0.5)"; + context.strokeRect(eyeBox.center.x-10, eyeBox.center.y-10, 30, 20, 30 ); + context.arc(eyeBox.center.x, eyeBox.center.y, 4, 0, 2 * Math.PI); + context.fillStyle = "rgba(255, 255, 255, 0)"; + context.fill(); + context.closePath(); + let pontoFocal = { + x: (eyeBox.center.x ) / 2, + y: (eyeBox.center.y ) / 2 + }; + const botaoSobOlhar = verificarBotaoSobOlhar(pontoFocal); + console.log(botaoSobOlhar) + if (botaoSobOlhar) { + if (botaoSelecionado !== botaoSobOlhar) { + botaoSelecionado = botaoSobOlhar; + tempoInicial = new Date().getTime(); + } else if (new Date().getTime() - tempoInicial > tempoDeSelecao) { + console.log('Botão selecionado:', botaoSelecionado.id); + // Adicione a lógica para lidar com a seleção do botão aqui... + } + } else { + botaoSelecionado = null; + tempoInicial = null; + } + } + } +}, 500) +} else { + clearInterval(extractPointsInterval); +} +}); diff --git a/js/face-api.js b/js/face-api.js new file mode 100644 index 0000000000000000000000000000000000000000..d91ea9504b708f45b679d8f226a432dc62d375a5 --- /dev/null +++ b/js/face-api.js @@ -0,0 +1,6528 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.faceapi = global.faceapi || {})); +}(this, function (exports) { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + + function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + } + + function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + /** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + */ + var t=function(e,n){return (t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e;}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);})(e,n)};function e(e,n){function r(){this.constructor=e;}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r);}var n=function(){return (n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n1?C*(u-1)+A*N:.5*(C+R)*(u-1);if(T<0||T>u-1)for(var D=0;D 1?C*(u-1)+A*N:.5*(C+R)*(u-1);if(T<0||T>u-1)for(var D=0;D=r/o)throw new Error("Invalid indices: "+v+" does not index into "+n);for(var x=0;x=r/o)throw new Error(\"Invalid indices: \"+v+\" does not index into \"+n);for(var x=0;x