UNPKG

mashape-animetrics-face-api

Version:
262 lines (145 loc) 7.05 kB
# mashape-animetrics-face-api Packge for integrate Masape Animetrics Face Recognition ## Installation ##### Download Download the [latest release](https://github.com/mdasmendel/mashape-animetrics-face-api/releases) ##### Clone the repo ```bash $ git clone https://github.com/mdasmendel/mashape-animetrics-face-api.git ``` ##### Install with [npm](https://www.npmjs.com) ```bash $ npm install mashape-animetrics-face-api ``` ## Usage ```js // Basic usage const mashapeAnimetricsApi = require('mashape-animetrics-face-api'); let client = mashapeAnimetricsApi.client({ "animetricsKey": "xxxxxxxxxxxxxxxxx", "mashapeKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" });  ... co(function *(){ ... let detect = yield mashapeCilent.detect.fromUrl('photo url here');//detect image from url let enroll = yield detect.enroll('gallery id here', 'subject id here','face id (default 0)');//enroll image from current detect let gallery = yield mashapeCilent.gallery('gallery id').getSubjects();//get subjects id enroll = yield mashapeCilent.gallery('gallery id').enroll('image obj', 'face obj', 'subject id');//enroll image in current group ... }) .catch(onError)  ... ``` ## Documentation Follow this [link](https://mdasmendel.github.io/mashape-animetrics-face-api) for access docs ## Methods <!-- Generated by documentation.js. Update this documentation by updating the source code. --> ### Client mashape-animetrics-face-api module #### gallery Get one gallery by id **Parameters** - `id` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The gallery id Returns **[Gallery](#gallery)** Instance of EnrollClient class #### galleries Get all client galleries Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Gallery](#gallery)>** Instance of EnrollClient class ### Detect mashape-animetrics-face-api module #### getImage Get image data Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** The image object #### getFaces Get faces list Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The list of faces #### getFacesCount Get faces count Returns **Integer** The count of faces #### hasFaces Check if the image has faces found Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** #### getFace Get face by index **Parameters** - `index` **Integer?= ** Face index Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** #### enroll Enrol one face from image **Parameters** - `galleryId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Gallery id - `subjectId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Subject id - `index` **Integer?= e** Face index Returns **[Enroll](#enroll)** #### recognize Recognize image from detect **Parameters** - `galleryId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Gallery id - `index` **Integer** Face index Returns **[Recognize](#recognize)** ### DetectClient mashape-animetrics-face-api module #### fromUrl Get detector from url **Parameters** - `url` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Image url - `selector` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Selectors for find filter, default: FULL, ex: 'FACE, EYES, FULL' Returns **[Detect](#detect)** Instance of detect class ### Enroll mashape-animetrics-face-api module ### EnrollClient mashape-animetrics-face-api module #### \_enroll Enroll in the group **Parameters** - `galleryId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Gallery id to enroll - `subjectId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Subject id Returns **[Enroll](#enroll)** ### Gallery mashape-animetrics-face-api module #### getSubjects Get subjects from gallery Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** #### enroll Enroll in this gallery **Parameters** - `image` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Image data - `face` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Face data - `subjectId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Face index Returns **[Enroll](#enroll)** #### recognize Recognize face in this group **Parameters** - `image` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Image object - mast contain image_id - `face` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** FAce object - mast contain face data Returns **[Recognize](#recognize)** ### GalleryClient mashape-animetrics-face-api module #### get Get one subjects from gallery **Parameters** - `id` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Gallery id Returns **[Gallery](#gallery)** #### list Get list subjects from gallery Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Gallery](#gallery)>** ### Recognize mashape-animetrics-face-api module #### get Get candidates list Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** #### get Get top candidates Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** ### RecognizeClient mashape-animetrics-face-api module #### execute Recognize face **Parameters** - `galleryId` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Gallery Id - `image` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Image object - mast contain image_id - `face` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** FAce object - mast contain face data Returns **[Recognize](#recognize)** ## Copyright and license Copyright Dascal Mihai, 2017. Licensed under [the MIT License](https://github.com/mdasmendel/mashape-animetrics-face-api/blob/master/LICENSE)