diff --git a/lib/opencv.js b/lib/opencv.js index 48a4284..edd51ec 100755 --- a/lib/opencv.js +++ b/lib/opencv.js @@ -50,14 +50,14 @@ util.inherits(cv.ImageDataStream, Stream); var imagedatastream = cv.ImageDataStream.prototype; imagedatastream.write = function(buf){ - this.data.push(buf) + this.data.push(buf) return true; } imagedatastream.end = function(b){ var self = this; - + if (b) imagestream.write.call(this,b); @@ -98,7 +98,7 @@ var ods = cv.ObjectDetectionStream.prototype; ods.write = function(m){ var self = this; - this.classifier.detectMultiScale(m, + this.classifier.detectMultiScale(m, function(e, objs){ if (e) { throw e } self.emit('data', objs, m); @@ -111,7 +111,7 @@ ods.write = function(m){ cv.VideoStream = function(src){ if (src instanceof cv.VideoCapture){ this.video = src - } else { + } else { this.video = new cv.VideoCapture(src); } this.readable = true; @@ -128,7 +128,7 @@ videostream.read = function(){ var self = this; var frame = function(){ - self.video.read(function(mat){ + self.video.read(function(err, mat){ self.emit('data', mat) if (!self.paused){ process.nextTick(frame)