Public Lab Research note


Revamping infragram.js to to the job on the client side

by ghk | April 05, 2014 12:33 | 64 views | 7 comments | #10270 | 64 views | 7 comments | #10270 05 Apr 12:33

Read more: publiclab.org/n/10270


What I want to do

Run infrablue transform on the client (aka Javascript) so that I dont overload the infragram site.

My attempt and results

It works, folk, in less than 100 line of basic code

Questions and next steps

No questions, so far. One must use the infragram camera.

Why I'm interested

Shhht...

ndvi.html


7 Comments

Hi, ghk - this looks pretty cool -- but Infragram.org is already client-side! https://github.com/Pioneer-Valley-Open-Science/infragram-js/

It's open source, so maybe we can combine efforts... infragram.org needs a lot of improvements!

Reply to this comment...


Hello Warren. You're right. I wasn't aware. My goal was to build the minimal JS code able to NDVIze the images of the modified webcam: just basic JScript, no rings and bells (tho HTML5). The idea is to create a generator on a Rasp PI server sending frames captured via V4L2 + jpeglib, and let the client do the image processing. Again, with the hope to build the minimal engine (avoiding mpegtools, ffxxx, etc) in a tentative to increase the performance, minimize the footprint as well as the maintenance. Should be a naive LAmP (lower case m, not sure if it is required).

Reply to this comment...


Pretty neat. You might be able to transmit via PeerConnect, the HTML5 video streaming API. There's some code here that I think implements a server-side version of it: https://github.com/rhinobird

I wonder if you could splice that into infragram-js as a video source?

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


Finally, I chose the Websockets way. Briefly:

A Server runs on the RaspberryPI, grabbing the frames in shared memory using V4L2 ( ioctl). The Server accepts connections on a specific port (5001), does the WS shakehand and broadcasts the video frames (inside WS frames.) [This is all C/C++, mainly written from scratch (WS), < 32K!]

The Client is an HTML5 WebBrowser (Chrome, Firefox Nightly, dunno for Safari). It does createObjectURL from the data received and assign the URL as the src of an <img>. NDVIzation is done the same as it is now.

So far, so good, at about 30fps. I probably will git it publicly but I would like to give a few more tests before. Warren: feel free to contact me offline if you want to play the guinea pig role.

Reply to this comment...


Sorry i was traveling last week! My bad.

Whoa, cool - were you able to integrate it at all with the existing infragram-js code, like in a button that says "connect to remote camera"? Do you have a demo online and running?

You should join the plots-dev list if you haven't already and maybe the plots-infrared list ... lots of folks would be excited to see this there. http://publiclab.org/lists

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


If it provides the data as the src of an it should be pretty easy to connect to the existing Infragram.org software, but how would you do "discovery" of available cameras? Is there any way to auto-detect those available on the local network?

Is this a question? Click here to post it to the Questions page.

Reply to this comment...


Yes, I do have a demo running online, but you understand that I won't publish the magic numbers on a post which almost reached 600 readers, or my poor bandpass would be ruined.

Feel free to contact me offline, Jeff. For the others: please wait and stay tuned. We will make this code available probably soon.

Reply to this comment...


Login to comment.

Public Lab is open for anyone and will always be free. By signing up you'll join a diverse group of community researchers and tap into a lot of grassroots expertise.

Sign up