Question

I would like to know if someone know how to recognize a face using just JavaScript. I've heard of OpenCV and relatives but I want to process the face recognition at the client side (web app).

Any ideas?

Was it helpful?

Solution

If you are looking to recognize where a face is in an image, as opposed to matching faces across multiple images, there is actually a library that does this in conjunction with HTML canvass.

There is a demo on the developers site here. You can also download the source on github.

In my test's the performance was decent - but not blazing.

OTHER TIPS

Currently there is no pure JavaScript library performing face recognition. Real time face detection however is possible using one of the following libraries:

  • For face and face element detection as well as object detection in general, you could use js-objectdetect or tracking.js which include ports of the OpenCV object detector based on Haar-like features. Also consult this performance comparison chart for ten popular JavaScript face detection libraries.

    Face detection demo

  • The very first face detection algorithm on the web found in ccv also deserves a mention. Its SURF classifier is fast but not very reliable.

  • The headtrackr library used for face tracking might also be of interest since it implements the camshift algorithm found in OpenCV. Also have a look at clmtrackr of the same author.

If you are after advanced features like Facial Recognition (Not detection only, as in it can recognize whose face it is, Eye position, gender, age, mood etc) then try this library.

Updated: https://www.kairos.com/face-recognition-api

Javascript library for precise tracking of facial features via Constrained Local Models

https://github.com/auduno/clmtrackr

Hey you can use this Face Recognition API + photobooth.js sample that I just posted - http://mashape.tumblr.com/post/45712257463/face-recognition-using-javascript-and-mashape

The response from the API gives you face element coordinates, smile detection, and face recognition based on a library of pictures you have uploaded:

{
“status”: “success”,
“images”: [
    “http://lambdal.com/tiger.jpg”
],
“photos”: [
    {
        “url”: “http://lambdal.com/tiger.jpg”,
        “width”: 600,
        “tags”: [
            {
                “eye_left”: {
                    “y”: 116,
                    “x”: 357
                },
                “confidence”: 0.978945010372561,
                “center”: {
                    “y”: 130,
                    “x”: 339
                },
                “mouth_right”: {
                    “y”: 178,
                    “x”: 366
                },
                “mouth_left”: {
                    “y”: 178,
                    “x”: 310
                },
                “height”: 140,
                “width”: 140,
                “mouth_center”: {
                    “y”: 178,
                    “x”: 338
                },
                “nose”: {
                    “y”: 147,
                    “x”: 336
                },
                “eye_right”: {
                    “y”: 115,
                    “x”: 314
                },
                “tid”: “31337”,
                “attributes”: [
                    {
                        “smile_rating”: 0.7,
                        “smiling”: true,
                        “confidence”: 0.7
                    },
                    {
                        “gender”: “male”,
                        “confidence”: 0.5982579729635792
                    }
                ],
                “uids”: [
                    {
                        “confidence”: 0.742,
                        “prediction”: “chris1”,
                        “uid”: “chris1@apitraveler”
                    },
                    {
                        “confidence”: 0.161,
                        “prediction”: “hazel”,
                        “uid”: “hazel@apitraveler”
                    },
                    {
                        “confidence”: 0.065,
                        “prediction”: “dylan”,
                        “uid”: “dylan@apitraveler”
                    }
                ]
            }
        ],
        “height”: 585
    }
]

}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top