Giter VIP home page Giter VIP logo

camerapi's Introduction

Camerapi

Camera PI is a module that allow to use the Raspberry PI camera from Node.JS

To Install

npm install camerapi

Usage

var Camera = require("camerapi");

var cam = new Camera();

By default if you don't specify any file name,it tries to find a folder called pictures inside the module you can set the directory with :

cam.baseFolder('/YOUR_BASE_DIRECTORY');

cam.prepare({"timeout" : 150, 
		 "width" : 2592,
		 "height" : 1944,
		 "quality" : 85
	   }).takePicture();

If you decided to use this type of implementation you can use any parameter, just add it as a key:value attribute.

cam.prepare({"timeout" : 150, 
		 "width" : 2592,
		 "height" : 1944,
		 "quality" : 85,
		 "vflip" : "",
		 ..,
		 ..,
		 ..
	   }).takePicture();

Or

cam.prepare({"timeout" : 150, 
		 "width" : 2592,
		 "height" : 1944,
		 "quality" : 85
	   }).takePicture("mypicture.jpg");

Or

cam.prepare({"timeout" : 150, 
		 "width" : 2592,
		 "height" : 1944,
		 "quality" : 85,
		 "output" : "mypicture.jpg"
	   }).takePicture();

Or

cam.prepare({"timeout" : 150, 
		 "width" : 2592,
		 "height" : 1944,
		 "quality" : 85
	   }).takePicture("mypicture.jpg",callback);
	   
function callback(file,error){

	//do some fun stuff

}

Or

cam.timeout(150)
.width(1024)
.height(768)
.quality(75)
.opacity(50)
.rotation(180)
.takePicture();

Or

cam.timeout(150)
.width(1024)
.height(768)
.quality(75)
.opacity(50)
.rotation(180)
.takePicture("mypicture.jpg");

Or

cam.timeout(150)
.width(1024)
.height(768)
.quality(75)
.opacity(50)
.rotation(180)
.takePicture("mypicture.jpg", callback);

Or

cam.timeout(150);
cam.width(1024);
cam.height(768);
cam.quality(75);
cam.takePicture();

Resting all settings

cam.reset();

Recording Video

cam.timeout(5000)
.bitrate(3500000)
.framerate(5)
.streamVideo("foo.h264")
.fullscreen()
.recordVideo();

Or

cam.timeout(5000)
.bitrate(3500000)
.framerate(5)
.fullscreen()
.recordVideo("myvideo.h264");

Or

cam.timeout(5000)
.bitrate(3500000)
.framerate(5)
.fullscreen()
.recordVideo("myvideo.h264",callback);

function callback(file,error){

	//do some fun stuff

}

So every time you take a picture without filename it creates a file with the current date in the base folder.

More information

For more information about the raspberry pi camera module, see the official documentation

License

(The MIT License)

Copyright (c) 2014 Leandro Salas

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.

camerapi's People

Contributors

lordvlad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jxcjxcjzx

camerapi's Issues

directory

the default directory is misspelled, it has to be "diretory"

and I could not get
cam.baseFolder('/YOUR_BASE_DIRECTORY');
to work

Working?

I see no output anywhere. I've tried all examples. Camera activates for a while then dies.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.