Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I access an image reference from outside an executable?

I have a Labview 8.2-built executable "A" that a Labview program "B" on the same machine communicates with via DataSocket.  I occasionally need to read variables in A from outside, including an image.  B is not available at the build time of the executable, so using shared or global variables does not seem to be an option.  DataSocket works fine for transmitting many data types, but if I try to transmit a Vision 8.2 image reference, the reference becomes invalid in the process.  I can send the image by converting it into a 2D array and passing that, but the process is too slow for my application.  I feel the slowness is actually coming from the DataSocket process itself rather than the conversion, but at any rate it would be much more efficient to just pass a reference to the image in memory.  IMAQ GetImagePixelPtr is the kind of thing I'm looking for, but I'm not working in C at all and there doesn't seem to be a way to create a proper image reference once one has such a pointer.  Is there a way to recreate the reference and not have to pass the whole image content through DataSocket?

 
The attached example code is my attempt to pass an image reference through DataSocket, but it doesn't return a valid reference even from within the same VI.
0 Kudos
Message 1 of 2
(3,013 Views)
Hello ETanner,

Thank you for using National Instruments discussion forums.  When you are trying to send an image over Data Socket you can not simply send the pointer to the image.  Each executable runs in its own thread and when memory is allocated it is allocated according to that thread so you will not be able to access it by simply sending the reference over data socket.  Instead of converting it to a 2D array you can try to flatten the image to a string and send it over data socket, this should be faster.  An example and better explanation of how to do this is located HERE.  It also has some good information about using compression on images to achieve faster frame rates if you are acquiring images from a camera.  I hope this information helps.  Let me know if this is unclear.  Thanks and have a great day. 

Regards,
Mark T
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,001 Views)