Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the IMAQ rval = imgGrab(SESSION_ID sid, void** bufAddr, uInt32 syncOnVB)function?

How to use the IMAQ rval = imgGrab(SESSION_ID sid, void** bufAddr, uInt32 syncOnVB)function?
Please explain the format of "bufAddr" variable?
And how to convert this data to *.bmp format?
0 Kudos
Message 1 of 3
(3,916 Views)
Hi arm2arm;

First, are you sure the function prototype says that the variable "bufAddr" is a handle? In the documentation the function prototype looks like:

imgGrab(SESSION_ID sid, void* bufAddr, uInt32 syncOnVB)

Declare a variable as:

Int8* bufAddr = NULL;

When set to NULL, IMAQ will allocate the necessary memory. Then, when using the function, just cast the variable as void.

Use the function imgSessionSaveBufferEx() to save the image as a .bmp file.

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 2 of 3
(3,916 Views)
Hi again;

I did some tests and, for some reason, my program do not want to compile because the function is actually asking for a void** handle instead of a pointer. In order to work, you may want to declare a variable as in the previous answer:

Int8* bufAddr = NULL;

and cast it in the function as:

(void **)&bufAddr

Enrique
www.vartortech.com
0 Kudos
Message 3 of 3
(3,916 Views)