This is a key part of ease of use with Raspberry Pi based spectrometers, and also Infragram use with Raspberry Pi cameras:
Read more at:
- https://publiclab.org/wiki/raspberry-pi-spectrometer
- https://publiclab.org/wiki/raspberry-pi-infragram
Would love to modify both these pieces of software to be able to stream from a Rasberry Pi on a local network, or even on the same device. The relevant code sections are:
- SpectralWorkbench's "capture.js" file - https://github.com/publiclab/spectral-workbench/blob/master/app/assets/javascripts/capture.js#L44
- Infragram.org's camera.coffee - https://github.com/publiclab/infragram-js/blob/master/public/camera.coffee#L19
There's some really good starting code here: https://www.sitepoint.com/streaming-a-raspberry-pi-camera-into-vr-with-javascript/
Please help out if you can!
Reply to this comment...
Log in to comment
Looks like you can just load it as an image using this code, and insert it:
var piImage = new Image(); piImage.onload = function() { context.drawImage(piImage, 0, 0, canvas.width, canvas.height); } piImage.src = "http://raspberry.local/cam_pic.php?time=" + new Date().getTime();
But we'll need to set up CORS permissions on the Pi to do this from SpectralWorkbench.org or Infragram.org, unless we run a version of that code on the Pi itself: https://enable-cors.org
Is this a question? Click here to post it to the Questions page.
Reply to this comment...
Log in to comment