node-rekognition
AWS Rekognition library
Installation
npm install node-rekognition
Use
Instantiation
const Rekognition = // Set your AWS credentialsconst AWSParameters = "accessKeyId": "XXX" "secretAccessKey": "XXX" "region": "XXX" "bucket": "XXX" "ACL": "XXX" // optional const rekognition = AWSParameters
The ACL is optional and its possible values are: "private", "public-read", "public-read-write", "authenticated-read", "aws-exec-read", "bucket-owner-read", "bucket-owner-full-control" More info
Upload images to S3
Some methods from AWS Rekognition need one or more images uploaded to AWS S3 bucket
/** * Upload image or images array to S3 bucket into specified folder * * @param * @param */const s3Images = await rekognition
detectLabels
/** * Detects instances of real-world labels within an image * * @param * @param */const imageLabels = await rekognition
detectFaces
/** * Detects faces within an image * * @param */const imageFaces = await rekognition
compareFaces
/** * Compares a face in the source input image with each face detected in the target input image * * @param * @param * @param */const faceMatches = await rekognition
detectModerationLabels
/** * Detects explicit or suggestive adult content in image * * @param * @param */const moderationLabels = await rekognition
createCollection
/** * Creates a collection * * @param */const collection = await rekognition
deleteCollection
/** * Deletes a collection * * @param */const collection = await rekognition
indexFaces
/** * Detects faces in the input image and adds them to the specified collection * * @param * @param */const facesIndexed = await rekognition
listFaces
/** * List the metadata for faces indexed in the specified collection * * @param */const faces = await rekognition
searchFaces
/** * Searches in the collection for matching faces of faceId * * @param * @param * @param */const faceMatches = await rekognition
searchFacesByImage
/** * First detects the largest face in the image (indexes it), and then searches the specified collection for matching faces. * * @param * @param * @param */const faceMatches = await rekognition
Test
First of all, you must create a parameters.json file and set your AWS parameters. You have an example file parametrs.json.example
- cp parameters.json.example parameters.json
- vim parameters.json
Then:
- npm install
- npm test
Changelog
Releases are documented in the NEWS file
Requirements
node >= 7.10.0
Contributing
You are welcome contribute via pull requests.
More info about AWS Rekognition
http://docs.aws.amazon.com/rekognition/latest/dg/API_Operations.html http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Rekognition.html