LabVIEW Web Development Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Streaming Images Over Websockets Demo

Hi All,

This is a quick example I wrote up after getting asked if this was possible and it caught my intrigue!

Functionality

This code demostrates streaming a webcam image from LabVIEW to a web browser using web sockets. As it is intended as an example it is quite a simple single shot application. To Run it:

  1. Make sure you have all of the dependencies installed (see below).
  2. Open Websockets Webcam Main.vi in the LabVIEW source folder.
  3. Select your camera from the dropdown and press run. Nothing will happen until a client connects.
  4. Open index.html in the JS Source folder. You should now see the same image on both.

Principle of Operation

There are a few steps to the process:

  1. The new image is captured and flattened to a JPEG/Image binary stream.
  2. This is converted to Base64 encoding and sent over the websocket connection.
  3. The JS recieves this and attaches it as the source of an image tag in the html.

LabVIEW Snippet.png

Dependencies

As this was a quick demo I have used a number of external dependencies to make life much easier!

The main one is this does depend on the IMAQdx drivers (or Vision Acquisition Software) which is a licensed add on which provides the image capture and compression functions, however this would take longer to rewrite without it.

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
Comments
samsharp99
Member
Member
on

Cool - will have to remember that in future!

Contributors