Create readable streams from connected webcams
|Description||Create readable streams from connected webcams|
|Node Version||>= 0.4|
Use node-opencv's VideoStream
This library requires that you have OpenCV installed - go to the OpenCV site for instructions.
The object returned from createStream is a full readable Stream - you can pause, resume, destroy, pipe, etc.
createStream optionally takes a camera number and defaults to 0 for the main camera
Each data event is a full image buffer from the camera - the framerate is variable on your CPU (should be an option in the future). Image buffers are PNGs. To convert the buffer to a base64 data uri (for the browser) just do
"data:image/png;base64," + buffer.toString('base64')
camera = require 'camera'webcam = camera.createStream()webcam.on 'data', (buffer) -># do something with image buffer
Returns an error and one image buffer to the given callback.
Returns an array of video frames for the time-span specified in milliseconds
fs = require 'fs'camera = require 'camera'webcam = camera.createStream()webcam.on 'error', (err) ->console.log 'error reading data', errwebcam.on 'data', (buffer) ->fs.writeFileSync 'cam.png', bufferwebcam.destroy()webcam.snapshot (err, buffer) ->webcam.record 1000, (buffers) ->
Copyright (c) 2012 Fractal email@example.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.