RayR Posted June 29, 2017 Report Share Posted June 29, 2017 (edited) Hi everyone, Is it possible to read the memory contents directly from the camera's memory? In other words, If the Invoke Node can provide the pointer to the active memory, can we access the memory location directly from the camera instead of using the CopyToArray function? The reason for asking is because a client needs to read the image faster than 4ms/MB that it takes the function to read the image data and write it to an array. Below is an image of what is implemented and what is desired. The first image is what is desired. The 2nd image is what is currently implemented. (I did not have the Vision toolkit installed on this PC). Edited June 29, 2017 by RayR Quote Link to comment
Tim_S Posted June 29, 2017 Report Share Posted June 29, 2017 I'm not clear what camera, communication bus, etc., that you are using. However... 4 msec/MB would be 250 MB/sec, so my initial reaction is that could be the practical limit of the communication bus. Quote Link to comment
RayR Posted June 29, 2017 Author Report Share Posted June 29, 2017 The camera is connected via GigE Ethernet network. Quote Link to comment
infinitenothing Posted June 29, 2017 Report Share Posted June 29, 2017 GigE=125MB/s. Out of curiousity is there a reason you don't want to use IMAQdx? I've never used activeX/dotNet for image acquisition. Quote Link to comment
ensegre Posted June 29, 2017 Report Share Posted June 29, 2017 [collided in air with infinitenothing] single port GigE is ~120MBytes/sec. you're not talking of bits/sec? Or of a dual GigE (I ran into one once)? GigE (at least Genicam compliant) is supported by IMAQdx. Normally I just use high level IMAQdx blocks (e.g. GetImage2) and get good throughput, whatever is under the hood. But a camera driver might be in the way for a less efficient than ideal transfer. Quote Link to comment
ned Posted June 29, 2017 Report Share Posted June 29, 2017 Have you checked what methods and properties are available for the .NET class that's returned by GetActive? Are you sure that the ToInt64 method returns a memory address? How did you configure the MoveBlock call? Make sure that you configured the src parameter as a pointer-sized integer passed by value. If ToInt64 does what you indicate it should do, then the value on the wire is the memory address and should be passed directly (by value); if you instead pass a pointer to that pointer, you'll get garbage. Quote Link to comment
smithd Posted June 30, 2017 Report Share Posted June 30, 2017 (edited) Depending on what you're wanting to do with the image in imaq, it could be easier to compile a little c# or vb module using opencv/http://www.emgu.com/wiki/index.php/Main_Page Its also not crazy difficult to make a 10 line class which take the ptr reference in c# and calls the imaq dll directly or calls the tdms api directly (http://digital.ni.com/public.nsf/allkb/A3663DE39D6A2C5A86257204005C11CA) or if you have measurement studio (http://www.ni.com/white-paper/8032/en/) Getting one managed to allow a language without pointers to directly manipulate its memory in order to generate a image structure in a c++ dll seems more challenging than its worth Edited June 30, 2017 by smithd Quote Link to comment
Rolf Kalbermatter Posted June 30, 2017 Report Share Posted June 30, 2017 (edited) Without documentation of the .Net interface for this component, there is no way to say if that would work. This refnum that is returned could be just a .Net object wrapping an IntPtr memory pointer as you hope, but it could be also a real object that is not just a memory pointer. Without seeing the actual underlaying object class name it's impossible to say anything about it. It is to me not clear if that Memory object is just the description of the image buffer in the camera with methods to transfer the data to the computer or if it is only managing the memory buffer on the local computer AFTER the driver has moved everything over the wire. If it is the first, your IntPtr conversion has absolutely no chance to work, since the "address" that refnum contains is not a locally mapped virtual memory address on your computer but rather a description of the remote buffer in the camera, and the CopyToArray method does a lot more than just shuffling data between two memory locations on your local computer. If it is indeed just a local memory pointer as you hope, I would not even try to copy anything into an intermediate array buffer but rather use the Advanced IMAQ function "IMAQ Map Memory Pointer.vi" to retrieve the internal memory buffer of the IMAQ image and then copy the data directly in there. However you can usually not do that with a single memcpy() call for the entire image since IMAQ images have extra border pixels which make the memory layout have several more bytes per image line than your source image would contain. So without a possibility to see the documentation for your .Net component we really can't say anything more about this. Edited June 30, 2017 by rolfk Quote Link to comment
Rolf Kalbermatter Posted June 30, 2017 Report Share Posted June 30, 2017 (edited) Duplicate post Edited June 30, 2017 by rolfk Quote Link to comment
hatef Posted January 20, 2018 Report Share Posted January 20, 2018 access to camera in labview is based on xml file that any camera create to use as interface and this connection will be happen with imaq if you do not want use imaq you have to use active x your write your own method but at the end the thing that you done is re- writing code as imaq code and nothing change in speed so it is not so rational Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.