mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
wip
This commit is contained in:
parent
d7873e2b4e
commit
b0b036ff34
@ -1,19 +1,21 @@
|
||||
var EventEmitter = require('events').EventEmitter
|
||||
, Buffers = require('buffers')
|
||||
|
||||
var opencv = require('./bindings')
|
||||
|
||||
module.exports = opencv;
|
||||
var bindings = require('./bindings')
|
||||
|
||||
var cv = module.exports = {};
|
||||
|
||||
cv.__proto__ = bindings;
|
||||
console.log(cv)
|
||||
/*
|
||||
|
||||
# Matrix #
|
||||
The matrix is one of opencv's most core datatypes.
|
||||
|
||||
*/
|
||||
var matrix = opencv.Matrix.prototype;
|
||||
|
||||
matrix.__proto__ = EventEmitter.prototype;
|
||||
|
||||
var matrix = cv.Matrix.prototype;
|
||||
|
||||
matrix.faceDetect = function(classifier, opts, cb){
|
||||
var face_cascade = new opencv.CascadeClassifier("./examples/haarcascade_frontalface_alt.xml");
|
||||
@ -24,4 +26,25 @@ matrix.faceDetect = function(classifier, opts, cb){
|
||||
|
||||
# Image #
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
cv.ImageStream = function(){
|
||||
this.data = Buffers([])
|
||||
}
|
||||
|
||||
var imagestream = cv.ImageStream.prototype;
|
||||
imagestream.__proto__ = EventEmitter.prototype;
|
||||
|
||||
imagestream.on('data', function(buf){
|
||||
this.data.push(buf)
|
||||
console.log("!!!<>");
|
||||
})
|
||||
|
||||
imagestream.on('end', function(){
|
||||
var buf = this.data.toBuffer();
|
||||
//var im = opencv.readImage(buf);
|
||||
console.log(this.data.length, buf.length);
|
||||
//this.emit('onload', im);
|
||||
})
|
||||
|
||||
|
||||
@ -5,6 +5,11 @@
|
||||
, "dependencies": {
|
||||
}
|
||||
, "version" : "0.0.2"
|
||||
|
||||
, "dependencies": {
|
||||
"buffers" : "0.1.1"
|
||||
}
|
||||
|
||||
, "devDependencies": {
|
||||
"vows": "*"
|
||||
}
|
||||
|
||||
@ -186,4 +186,28 @@ vows.describe('Smoke Tests OpenCV').addBatch({
|
||||
|
||||
}
|
||||
|
||||
|
||||
, "ImageStream" : {
|
||||
topic : require('../lib/opencv')
|
||||
|
||||
, "pipe" : {
|
||||
topic : function(cv){
|
||||
console.log("!!!")
|
||||
var s = new cv.ImageStream();
|
||||
console.log("***");
|
||||
s.on('load', this.callback)
|
||||
fs.open('./examples/mona.jpg').pipe(s);
|
||||
}
|
||||
|
||||
, "loaded" : function(im){
|
||||
assert.ok(im);
|
||||
assert.equal(im.empty(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}).run();
|
||||
Loading…
x
Reference in New Issue
Block a user