mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
update face detect and readme
This commit is contained in:
parent
3644d3ed8d
commit
56ff74152b
21
README.md
21
README.md
@ -26,18 +26,16 @@ Or to build the repo:
|
||||
### Face Detection
|
||||
|
||||
|
||||
var im = new cv.Image("./examples/mona.jpg")
|
||||
, face_cascade = new cv.CascadeClassifier("./examples/haarcascade_frontalface_alt.xml")
|
||||
var im = cv.readImage("./examples/test.jpg")
|
||||
|
||||
var faces = face_cascade.detectMultiScale(im, function(err, faces){
|
||||
|
||||
im.faceDetect("./examples/haarcascade_frontalface_alt.xml", {}, function(err, faces){
|
||||
for (var i=0;i<faces.length; i++){
|
||||
var x = faces[i]
|
||||
im.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2);
|
||||
}
|
||||
im.save('./out.jpg');
|
||||
|
||||
}, 1.1, 2, [30, 30]);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -46,15 +44,4 @@ Or to build the repo:
|
||||
## WIP
|
||||
|
||||
This is a WIP. I've never written C++ before so the code may be _interesting_ - if
|
||||
I'm doing stuff wrong please feel free to correct me.
|
||||
|
||||
## Links (WIP these are resources that I'm working from)
|
||||
|
||||
- http://syskall.com/how-to-write-your-own-native-nodejs-extension
|
||||
- https://github.com/pquerna/node-extension-examples/blob/master/helloworld_eio/helloworld_eio.cc
|
||||
- http://code.google.com/p/waf/
|
||||
- http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html
|
||||
- http://opencv.willowgarage.com/documentation/cpp/core_basic_structures.html#point
|
||||
- http://bespin.cz/~ondras/html/classv8_1_1NumberObject.html
|
||||
- http://bespin.cz/~ondras/html/index.html
|
||||
- http://v8cgi.googlecode.com/svn-history/r963/trunk/src/macros.h
|
||||
I'm doing stuff wrong please feel free to correct me.
|
||||
@ -11,32 +11,16 @@ module.exports = opencv;
|
||||
The matrix is one of opencv's most core datatypes.
|
||||
|
||||
*/
|
||||
opencv.Matrix.prototype.__proto__ = EventEmitter.prototype;
|
||||
|
||||
|
||||
|
||||
matrix = opencv.Matrix.prototype;
|
||||
matrix.__proto__ = EventEmitter.prototype;
|
||||
|
||||
matrix.faceDetect = function(classifier, opts, cb){
|
||||
var face_cascade = new opencv.CascadeClassifier("./examples/haarcascade_frontalface_alt.xml");
|
||||
face_cascade.detectMultiScale(this, cb);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
# Image #
|
||||
|
||||
OpenCV has got rid of, so maybe we just use Matrix class
|
||||
and augment in js:
|
||||
|
||||
new cv.Image()
|
||||
|
||||
does
|
||||
|
||||
cv.imageRead() // returns Matrix
|
||||
|
||||
|
||||
and
|
||||
|
||||
Matrix.save()
|
||||
|
||||
does
|
||||
|
||||
cv.imwrite
|
||||
|
||||
*/
|
||||
@ -7,14 +7,12 @@ console.log(cv.version)
|
||||
|
||||
|
||||
var im = cv.readImage("./examples/t2.jpg")
|
||||
, face_cascade = new cv.CascadeClassifier("./examples/haarcascade_frontalface_alt.xml")
|
||||
|
||||
var faces = face_cascade.detectMultiScale(im, function(err, faces){
|
||||
im.faceDetect("./examples/haarcascade_frontalface_alt.xml", {}, function(err, faces){
|
||||
for (var i=0;i<faces.length; i++){
|
||||
var x = faces[i]
|
||||
im.ellipse(x.x + x.width/2, x.y + x.height/2, x.width/2, x.height/2);
|
||||
}
|
||||
im.save('./out.jpg');
|
||||
|
||||
|
||||
});
|
||||
@ -20,6 +20,10 @@ vows.describe('Smoke Tests OpenCV').addBatch({
|
||||
, '.Point imports': function(topic){
|
||||
assert.ok(!!topic.Point)
|
||||
}
|
||||
|
||||
, '.Matrix imports': function(topic){
|
||||
assert.ok(!!topic.Matrix)
|
||||
}
|
||||
}
|
||||
|
||||
, "Point" : {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user