Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
3 ratings:
 4.33 out of 5   

Transferring Images with DataSocket

Primary Software: DataSocket
Primary Software Version: 4.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

I am trying to send an image over a DataSocket connection in LabVIEW and the reading (client) VI is not able to display the received image. What can I do to correctly send the image?

One key consideration in sending an image over DataSocket is that it is not really an image being transferred but a pointer to the image. This is why the client program in the transfer is unable to display a received image. A good way of getting around this is to flatten the image using the Flatten to and send the bit string over the DataSocket Write. On the receiving end, the string must be unflattened with the Unflatten from before being displayed in the image indicator. In this way, all the data is sent across the DataSocket connection rather than just a pointer. See the attached DSReader and DSWriter examples which demonstrate this.

A related situation that may pose a limitation is trying to send grabbed images (continuous stream of images) over DataSocket. Sending the flattened data and trying to maintain a good fps (frames per second) rate can be difficult. Another approach is to apply some form of compression to the image. A lot of time can be cut off of the process by compressing the image into JPEG format, sending the data, and then uncompressing the JPEG into the image. Included below is a link that has an example program that demonstrates this. It utilizes a TCP/IP transfer method instead of the DataSocket, but the concept is the same.

Related Links:
Example Program: Compress IMAQ Images to JPEG Streams for Faster Transfer


Report Date: 04/02/2004
Last Updated: 02/19/2014
Document ID: 381DHIWX

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit