Created
January 26, 2012 04:08
-
-
Save peterbraden/1680920 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = new cv.ImageStream(); | |
fs.createReadStream('./examples/mona.jpg').pipe(s); | |
// --- | |
cv.ImageStream = function(){ | |
this.data = Buffers([]) | |
} | |
util.inherits(cv.ImageStream, Stream); | |
var imagestream = cv.ImageStream.prototype; | |
imagestream.write = function(buf){ | |
console.log(">>>>>>>>>>", buf); | |
this.data.push(buf) | |
return true; | |
} | |
imagestream.writeable = true; | |
imagestream.end = function(b){ | |
if (b) | |
imagestream.write.call(this,b); | |
var buf = this.data.toBuffer(); | |
console.log(this.data, arguments, ">>>", buf.length); | |
//var im = cv.readImage(buf); | |
//this.emit('load', im); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment