Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

passing image data to external C++ analysis

Hello,

I'm using LabView 7.1 and Vision along with a CMOS CameraLink camera and 1428 board.

I would like to to use a custom C++ code to process the images taken by my camera. I know how to make a subVI that will call my dll, and I can pass all my processing parameters (numbers) to the , but I was not able to find any LabView code example that demonstrates how to pass the IMAQ image data to C++ code. I would really appreciate your help. Thanks.

Pavel
0 Kudos
Message 1 of 3
(3,451 Views)
I was thinking originally of doing a similar thing, except that I wanted C++ code to do the acquisition as well. In the end, I gave up because I was never able to find out how to export the interfaceID/sessionID to my DLL so that it can access the card. It looks like LV hides it (good programming practice) to prevent other people from tapping into the board and leaving it in an undefined state.

That said, you can probably pass just a pointer to the raw buffers themselves. They end up having type (void *) and I've found that I can work with them just fine. You just have to know the format (width/height) and the number of bytes per pixel and how they are formatted. LV probably has other routines that can give you more standardized format, but that will come at the expense of processing time.
--
[System info: NI-1429e running in 'Base' CL-mode plugged into an x4 PCI-e slot on a Dell PowerEdge 1800, dual 3.2Ghz Xenon, 6GB RAM, Windows 2003 Server SP1, LV8.0/7.1, IMAQ v3.5, Dell CERC SATA RAID controller card with 4x250GB Seagate HDD, one Seagate 250GB HDD connected to system's primary SATA port for OS.]
Message 2 of 3
(3,448 Views)
Pavel,

Harold is completely right.  It is a little difficult to pass many of the NI Vision functions directly to external modules including the Image structure by design.  We have however provided a way to pass a pointer to the pixel array stored in the Image using the GetImagePixelPointer VI.  This is the best method for passing to C++ functions because you get the actual pixel data without having to pass around the entire Image array.  The other option is to pass the entire pixel array using the ImageToArray VI.

Regards,
S. Arves S.
National Instruments
Applications Engineer
Message 3 of 3
(3,433 Views)