├── server ├── .gitignore ├── package.json └── index.js ├── assets ├── glasses.png └── harlequinmask.png ├── LICENSE ├── README.md └── public └── index.html /server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | package-lock.json -------------------------------------------------------------------------------- /assets/glasses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicodeveloper/face-detection/HEAD/assets/glasses.png -------------------------------------------------------------------------------- /assets/harlequinmask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unicodeveloper/face-detection/HEAD/assets/harlequinmask.png -------------------------------------------------------------------------------- /server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "faceoverlay", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "body-parser": "^1.18.1", 13 | "cloudinary": "^1.9.0", 14 | "connect-multiparty": "^2.0.0", 15 | "cors": "^2.8.4", 16 | "express": "^4.15.4" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /server/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const multipart = require('connect-multiparty'); 4 | const bodyParser = require('body-parser'); 5 | const cloudinary = require('cloudinary'); 6 | const cors = require('cors'); 7 | 8 | app.use(cors()); 9 | app.use(bodyParser.urlencoded({ extended: false })); 10 | app.use(bodyParser.json()); 11 | 12 | cloudinary.config({ 13 | cloud_name: 'xxxxxxx', 14 | api_key: 'xxxxxxx', 15 | api_secret: 'xxxxxxx' 16 | }); 17 | 18 | // Multiparty middleware 19 | const multipartMiddleware = multipart(); 20 | 21 | app.post('/upload', multipartMiddleware, function(req, res) { 22 | 23 | cloudinary.uploader.upload(req.files.image.path, function(result) { 24 | res.json(result); 25 | }, 26 | { 27 | transformation: [ 28 | {width: 700, radius: "max", crop: "scale"}, 29 | { flags: "region_relative", gravity: "adv_eyes", overlay: req.body.item, width: "1.7"} 30 | ] 31 | }); 32 | 33 | }); 34 | 35 | 36 | app.listen(3333); 37 | console.log('Listening on localhost:3333'); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Prosper Otemuyiwa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Face Overlay App 3 |
4 | 5 | 👨 👩 An app to detect facial attributes (with focus on the eyes), on a human and append a pair of glasses or harlequin mask. 6 | 7 |
9 |
10 |
17 | Glasses
18 |
21 | Harlequin Mask
22 |