Face Recognition with Node.js

Face Recognition with Node.js 

t’s pretty simple to have a basic face recognition in Node.js using the Face.com API.

Pre-Requirements :
0. You will need apikey and api-secret from face.com. You can obtain them by clicking here.

1. I am using a package called restler to handle REST requests.

npm install restler

Here is the code:

var sys = require('sys'),
     api = require('restler');

var api_key = '....';
    api_secret = '...'
    image_url = 'http://farm6.static.flickr.com/5127/5284942130_ab25c2dafd_b.jpg'; 

api.get('http://api.face.com/faces/detect.json?api_key='+api_key+'&api_secret='+api_secret+'&urls='+image_url).on('complete', function(data) {
  sys.puts("the object gender is: "+ data.photos[0].tags[0].attributes.gender.value + ". I am  "+data.photos[0].tags[0].attributes.gender.confidence+" % sure");
  sys.puts("The object is smiling: "+ data.photos[0].tags[0].attributes.smiling.value + ". I am  "+data.photos[0].tags[0].attributes.smiling.confidence+" % sure");
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s