sightmachine/simplecv-js — pull request #51 by chaithuzz2 (2013-07-25 17:33:29+00:00)
Title: Added getFaces() method 

We have a face detection now for simplecv-js.

to use it in console you can use the following code.

# The following lines have already been called
# for you:
# Camera = new require('models/Camera')
# CVImage = require('models/Image')
# Display = require('models/Display')

display = new Display(".livePreview")
size = display.resolution()

console.log size

# Safe way to stream the camera data.
# Loop doesn't run when the page isn't
# visible.
Camera.beginStream((i)=>
i = i.resize size[0], size[1]
dl = i.addDrawingLayer()
dl.noFill()
comp = i.getFaces()
for face in comp
dl.rect(face.x, face.y, face.width, face.height)
i.show display
)