Skip to content

bwalker8038/camera

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

status

Information

Packagecamera
Description Create readable streams from connected webcams
Node Version >= 0.4

Dependencies

This library requires that you have OpenCV installed - go to the OpenCV site for instructions.

Usage

createStream([camera])

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). 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

snapshot(stream, callback)

Sugar for s.once 'data', cb - callback receives one image buffer

record(stream, milliseconds, cb)

Returns an array of video frames for the time-span specified in milliseconds

Examples

Take a picture

fs = require 'fs'
camera = require 'camera'

webcam = camera.createStream()

webcam.on 'data', (buffer) ->
  fs.writeFileSync 'cam.jpg', buffer
  webcam.destroy()

LICENSE

(MIT License)

Copyright (c) 2012 Fractal contact@wearefractal.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.

About

Create readable streams from connected webcams

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published