Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LabVIEW, C++ DLL, and IMAQ Images

Tags:

c++

dll

labview

I'm familiar with writing DLLs that can be called from LabVIEW, but I'm curious as to what the correct way to pass IMAQ Images to a DLL might be. Here's one way I've found to do it -- I also use a similar mechanism to post IMAQ Image instances from my DLL to an Event Structure.

Example Diagram

Note that the nodes that convert the image instances to/from clusters are located at ${LABVIEW_INSTALL_DIR}/vi.lib/vision/DatatypeConversion.llb, and are named IMAQ Image Datatype to Image Cluster.vi and IMAQ Image Cluster to Image Datatype.vi, respectively. The cluster that is created consists of the image name and an integer value that represents the pointer address to an Image* type in C/C++.

Is this the best way to do this, or is there a better way?

like image 687
hatboyzero Avatar asked Oct 09 '22 15:10

hatboyzero


1 Answers

I use a different approach, putting all the image info (pointer, sizes, etc) in a cluster using the following code:

enter image description here

The cluster is then passed to the DLL function, making operations on pixels (no changing the size, of course) and afterward call IMAQ's unmap pixel pointer.


EDIT after discussion:

Your solution relies on having NI Vision, and in this case it's better than mine. However when not having NI Vision mine is the only way to work with IMAQ's pixel data.

like image 108
CharlesB Avatar answered Oct 12 '22 12:10

CharlesB