mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
improve interface
This commit is contained in:
parent
d54e8dcfac
commit
f510f71b4e
@ -27,7 +27,7 @@ Or to build the repo:
|
||||
|
||||
|
||||
cv.readImage("./examples/test.jpg", function(err, im){
|
||||
im.faceDetect("./examples/haarcascade_frontalface_alt.xml", {}, function(err, faces){
|
||||
im.detectObject("./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);
|
||||
@ -82,7 +82,7 @@ There is a shortcut method for
|
||||
detection. This can be used for face detection etc.
|
||||
|
||||
|
||||
|
||||
mat.detectObject(haar_cascade_xml, opts, function(err, matches){})
|
||||
|
||||
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ The matrix is one of opencv's most core datatypes.
|
||||
|
||||
var matrix = cv.Matrix.prototype;
|
||||
|
||||
matrix.faceDetect = function(classifier, opts, cb){
|
||||
var face_cascade = new cv.CascadeClassifier("./examples/haarcascade_frontalface_alt.xml");
|
||||
matrix.detectObject = function(classifier, opts, cb){
|
||||
var face_cascade = new cv.CascadeClassifier(classifier);
|
||||
face_cascade.detectMultiScale(this, cb);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ var cv = require('./lib/opencv')
|
||||
|
||||
|
||||
cv.readImage("./examples/mona.jpg", function(err, im){
|
||||
im.faceDetect("./examples/haarcascade_frontalface_alt.xml", {}, function(err, faces){
|
||||
im.detectObject("./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);
|
||||
|
||||
@ -121,14 +121,14 @@ vows.describe('Smoke Tests OpenCV').addBatch({
|
||||
|
||||
}
|
||||
|
||||
, "faceDetect": {
|
||||
, "detectObject": {
|
||||
|
||||
topic : function(){
|
||||
var cv = require('../lib/opencv')
|
||||
, cb = this.callback
|
||||
|
||||
cv.readImage("./examples/mona.jpg", function(err, im){
|
||||
im.faceDetect("./examples/haarcascade_frontalface_alt.xml", {}, cb)
|
||||
im.detectObject("./examples/haarcascade_frontalface_alt.xml", {}, cb)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user