0.0.0 • Published 8 years ago
raspberry-pi-camera-native v0.0.0
node-raspberry-pi-camera-native
Use your Raspberry Pi Camera Module with Node.js
NOTE: Currently only supports still image capture.
Prerequisites
Hardware
- Raspberry Pi
- Raspberry Pi Camera module
Software
- Raspberry Pi camera enabled
- Node.js 8 or later installed
Install
npm install raspberry-pi-camera-nativeUsage
// require module
const raspberryPiCamera = require('raspberry-pi-camera-native');
// add frame data event listener
raspberryPiCamera.on('frame', (frameData) => {
// frameData is a Node.js Buffer
// ...
});
// start capture
raspberryPiCamera.start();Events
Data
Listen for raw data events (partial frame data), data is a Node.js Buffer
raspberryPiCamera.on('data', callback(data));Frame
Listen for frame events (full frame data), frameData is a Node.js Buffer
raspberryPiCamera.on('frame', callback(frameData));Actions
Start Capture
raspberryPiCamera.start(options, callback);Options is a object, with the following defaults:
{
width: 1280,
height: 720,
fps: 30,
encoding: 'JPEG',
quality: 75
}Supported values:
width:32to2592(v1 camera) or3280(v2 camera)height:16to1944(v1 camera) or2464(v2 camera)fps:1to90encoding:'JPEG'(hardware accelerated),'GIF','PNG','PPM','TGA','BMP'(see mmal_encodings.h for others)quality: 1 - 100 (JPEG encoding quality)
Pause Capture
raspberryPiCamera.pause(callback);Resume Capture
raspberryPiCamera.resume(callback);Stop Capture
raspberryPiCamera.stop(callback);0.0.0
8 years ago