Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to validate Acquisition Window settings via C API?

Hi,

I am controlling a Basler CameraLink camers connected to an NI PCIe-1429 framegrabber. I'm acquiring frames, settings ROIs etc just fine via the NI-IMAQ C API. However, I need to set the Acquisition Window programmatically and it appears the API does not validate the attributes I send it. Nor does there seem to be a straightforward way of validating this programmatically.

 

Here's what I do:

I use imgSetAttribute2() to define IMG_ATTR_ACQWINDOW_LEFT/TOP/WIDTH & HEIGHT.

 

It doesn't seem to matter what numbers I pass this function. If the values are valid (i.e. does not exceed the max resolution of the camera) all is well. If I use values, say width, that exceeds the camera resolution no error occurs.

 

When I use imgGetAttribute() on these attributes, I can retrieve also invalid values as set.

 

When I attempt to do anything else, like setting an ROI, it of course fails with the error:

"The requested acquisition window is invalid."

 

Now, I do see in MAX that it is capable of reading the max resolution of the camera (under the Acquisition Parameters tab).

 

So, my question is:

How can I programmatically read the maximum image size through NI-IMAQ? How does MAX do it? 

 

Thanks,

Per

 

0 Kudos
Message 1 of 2
(4,783 Views)

Hi Peka,

 

I know that MAX accesses the properties of a camera through the camera files. The camera files are located in a folder similar to:

C:\Users\Public\Documents\National Instruments\NI-IMAQ\Data

 

You should be able to see certain attributes of your camera in these files.

Paolo F.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 2
(4,741 Views)