googlecreativelab / coder

A simple way to make web stuff on Raspberry Pi
http://goo.gl/coder
Apache License 2.0
2.42k stars 276 forks source link

Accessing a camera connected to Raspberry Pi #53

Open shanepisko opened 10 years ago

shanepisko commented 10 years ago

How would one connect to a camera attached to the pi? would this be done via javascript codes that add webcam support to your projects? Also could the Processing.js libraries be used with coder?

jmstriegel commented 10 years ago

Not out of the box, but....

Take a look at this project: https://github.com/troyth/node-raspicam/

I think you could add that module to the package.json, then make a CameraLib project that surfaces that into a simple api that you can use to pull jpgs from in your other apps.

shanepisko commented 10 years ago

Awesome, thanks! Ill try this out

shanepisko commented 10 years ago

So if I install raspicam via npm I will still have to add it to package.json? How do I got about doing that? Sorry I'm very new to all of this stuff. I just received my camera module, got it hooked up and taking photos via command line. I tried installing raspicam but it did not work and said that I might have the wrong version of node.js

Any help is greatly appreciated

macb commented 10 years ago

Hi @shanepisko, any success?

miniBloq commented 9 years ago

Hi! This may help. You need to install the following (please do a backup of your SD card first):

Then: sudo apt-get update sudo apt-get install uv4l uv4l-raspicam sudo apt-get install uv4l-raspicam-extras

npm install raspicam

I don't remember if I had to do more changes.

To make a test from Coder, create a new app and add the following code at the end of Coder's NODE tab. It seems to be working just find:


var RaspiCam = require("/home/pi/node_modules/raspicam");

var camera = new RaspiCam({ mode: "video", output: "/tmp/video.h264", framerate: 15, timeout: 5000 // take a 5 second video });

camera.on("started", function( err, timestamp ){ console.log("video started at " + timestamp ); });

camera.on("read", function( err, timestamp, filename ){ console.log("video captured with filename: " + filename + " at " + timestamp ); });

camera.on("exit", function( timestamp ){ console.log("video child process has exited at " + timestamp ); });

camera.start();


Cheers! Julián