06-04-2012 04:49 PM
We have a system that has the following peripherals connected to it:
1 - firewire camera
2 - serial port devices
2 - emulated serial port devices (on VCP USB drivers)
1 - Ethernet device
We have developed an application using CVI 8.1, NI Vision 8.6, and NI-IMAQdx 3.2 (it's an older cam). I would like to make this system accessible remotely (not remote desktop) and was looking for a way to program a server/client setup. Although it will be a lot of work, we can easily take care of a protocol for the Ethernet and serial devices. Where I'm getting stuck is the camera.
I've searched the forums and it seems that people can use the RT software module on specific host hardware to do just that. We don't want to invest in purchasing a separate software module or another piece of hardware, so I was wondering if it was possible to configure MAX or the NI vision server somehow to connect to a remote win7 PC to grab frames and configure the camera OR is there an easy way that I can transfer the stream over TCP/IP?
The only solution I can come up with is the grab a frame, save to .PNG, transmit it, and then load it on the client side. This seems very wasteful (and slow considering the harddrive will constantly buffer the data) and I would need to do a lot of encapsulation for changing camera settings, etc. Further, I'm not sure how well this would work for when we try to calibrate the camera with the IMAQ drivers. Is there a way to get the size and all relevant data structures in memory of the vision server so I can transfer them?
Finally, if there is a simple way of configuring and doing all of this for the camera that I'm missing (through MAX), then is there a similarly easy way of mapping the remote serial ports and of bridging the Ethernet data? I know there are a few pieces of existing software for the serial ports, but was looking to make a single software solution.
Thanks for taking the time!
-Stan
06-05-2012 10:18 PM - last edited on 07-01-2024 04:01 PM by Content Cleaner
Hi Stan,
Welcome to the NI Discussion forums! Thanks for posting your application here. There certainly are more efficient ways of streaming IMAQ images over a network. One such method would be to convert the IMAQ image type to a 2D array and then pass the data through TCP/IP, as you eluded to. Do you have access to LabVIEW? If you don't have access to the LabVIEW development system, the overall code structure for the server system is as follows:
- Open IMAQdx reference, initiate a TCP connection, Create IMAQ image buffer
- Initialize an IMAQdx grab
- Loop:
- Call IMAQdx grab
- Use the IMAQ Flatten Image to String to convert the IMAQ image to a string
- Call TCP Write to send the string length first, then again to send the actual string data
- Dispose of the IMAQ image buffer, close the IMAQdx reference, close the TCP connection
On the client end, you just need to open the TCP connection and call TCP read to read the string size and then the string data. Then, you can use the unflatten from string function to convert the string back to an IMAQ image data type. After this, it is up to you how you want to process the data (display it on the screen, write to an AVI file, etc).
If you have more in-depth questions about implementing the TCP/IP side of the program in CVI, you may wish to post that specific question on the CVI board.
With regards to mapping the serial ports remotely, if you are already using NI-VISA for COM port communication, take a look at this document on Remote Instrument Control with NI-VISA. Essentially, you should be able to access the VISA resource (e.g. a COM port) remotely by enabling the remote NI-VISA server on the client machine. For more specific help with this aspect of your code, please post to the GPIB/VISA board.
Feel free to post again here if you have more IMAQ and vision-related questions. Hope this helps!