Example Code

IMAQdx Video Transfer Using Simple TCP/IP Messaging Protocol (STM)

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Driver

  • IMAQ Vision

Code and Documents

Attachment

Description

 

Introduction

This example shows how to use the STM protocol to transmit video captured using the IMAQdx driver.  The images are compressed prior to transmission in order to use less bandwidth.

 

Video Server:

video_server.png

 

Video Client:

video_client.png

 

Additional Notes

The VI was tested using the IMAQdx driver and a USB Webcam.

 

The Simple TCP/IP Messaging Protocol can be found here

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
bk90
Member
Member
on

thank you, this exemple was helpful....but please could you give some extrat explanations about the way it work and its main functions . thanks

Smootastic
NI Employee (retired)
on

bk90,

I'm not quite sure what you're asking.  Is there a particular function that you have questions on?

The idea is to grab an image, compress it for network transfer, and use STM (which is built on TCP/IP) to transfer the data to a client VI.  I would recommend using Context Help (Ctrl+H) and highlight any functions you want to learn more about.  Within each Context Help page, there should be a link to more Detailed information on each VI.

premisra@yahoo.co.in
Member
Member
on

I've tried to transfer video between two pc's using the above example code.I can receive string data when i'm transmitting from one PC.but i cant unflatten that data into image data.Any other modifications needed?

Prems
Smootastic
NI Employee (retired)
on

Can you post your example?  You can do this by clicking the HTML in the right corner of the reply editor and then selecting Show Full Editor.

premisra@yahoo.co.in
Member
Member
on

client.jpgserver.jpg

Prems
Smootastic
NI Employee (retired)
on

Can you try compressing the image?  Your server example is missing the IMAQ Flatten Image VI; it's designed to work with the Flatten to String function.

premisra@yahoo.co.in
Member
Member
on

Ya I compressed the image before sending it..but its not works.then only i've modified the code as above. (its working for localhost, not for other pc(192.100.x.xxx).

Prems
Vision_Armenia
Member
Member
on

Change the Snap function with Grab, then put while loop. Do as it is shown in the example and it will work. Usually the first frame of the camera is black. Check also Subnet Masks, they should be the same to see each other. And if after all that thing your program will again not work, then please expain here what you mean saying "not works". Does the VI give you any kind of error?

premisra@yahoo.co.in
Member
Member
on

not works means there is no image received at the client vi. But the string data which is sent from the server can be received.when i try to unflatten this string data into image data,the image display is blank.

Prems
pikasa1991
Member
Member
on

in 2011 labview STM is not there !!!what can i do now

crossrulz
Knight of NI Knight of NI
Knight of NI
on

STM has always been a seperate install.  Look in VIPM and you can get the latest version.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
pikasa1991
Member
Member
on

hi crossrulz,

Thank you so much for your replay,now i am downloding VIPM

pikasa1991
Member
Member
on

STM is not there in VIPM

crossrulz
Knight of NI Knight of NI
Knight of NI
on

It should be in the list once all of the packages from the LabVIEW Tools Network is downloaded.

Capture.PNG


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
rockyData
Member
Member
on

How to stream video from labview to HTML ? I mean i need to stream video from a USB webcam connected to myRIO to web browser via web sockets or web service ?

Is it possible ?

Please help !

Smootastic
NI Employee (retired)
on

You'll probably need this driver to read the USB webcam (http://www.ni.com/example/30030/en/), I can't guarantee it'll work with the myRIO.  At that point, instead of using STM to send your data, you will need to create a Web Service in LabVIEW to read the USB webcam data using the IMAQ for USB driver and provide the data to your thin client (web page).

I recommend starting here to learn about building a web service: https://decibel.ni.com/content/docs/DOC-41151.  Note that not only do you need to build a web service in LabVIEW, but you'll need to create some kind of page (with HTML5, or JavaScript, or whatever web language you prefer) that accesses the web service.

You should be able to get plenty of help with the LabVIEW web service if you go to forums.ni.com and post your questions there; I can't guarantee they'll be able to help with the thin client.  Generally, stackoverflow.com is a good resource for the web development.

basilalias
Member
Member
on

Hi
Is it possible to stream using sjcam sj4000, my ip is 192.168.1.254.
it is well working with vlc player. can u pls help me out..

kuirs@126.com
Member
Member
on

how about  multi-client?