Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

'Requested attribute is invalid' error

Solved!
Go to solution

I'm attempting to programmatically get (and ultimately set) camera attributes with CVI. I can get some attribute values, such as ROI_WIDTH using the imgGetAttribute function, but not all, and not the ones that I really need to access, which are 'Exposure Time' and 'Gain Value'. I can see and set these exposure time and gain value camera attributes in MAX. However, when I attempt to use the imgGetCameraAttributeString function in IMAQ to get these attributes, I get the error 'The requested attribute in invalid'. My camera is the Basler acA2040-180km. In all other respects - snapping, grabbing, etc. the camera interface works fine.

 

I cannot see what I am doing wrong or what piece I am missing, but it is obviously something. I took the NI example 'Analog attributes' as a starting point but that yields the same errors. How can MAX manipulate these camera attributes but I cannot in CVI? Is there some setup piece that is missing? 

 

I'm kinda new to this environment, but would much appreciate any help anyone has.

 

Thanks in advance,

Wayne Showalter

0 Kudos
Message 1 of 3
(3,623 Views)
Solution
Accepted by topic author wshowalter

Hi Wayne,

 

IMAQ differerentiates in behavior and API with respect to 'IMAQ attributes' (defined by the IMAQ driver) and 'Camera Attributes' (defined by the camera file). All the ones with fixed constants (like ROI_WIDTH) are IMAQ attributes while the ones that specifically set something in the camera are camera attributes. You'll need to use the Get/SetCameraAttribute API for those. There are different functions for String vs Numeric attributes. I suspect if you call it with imgSetCameraAttributeNumeric() it will work.


Eric

Message 2 of 3
(3,610 Views)

It worked! Thanks so much. 

 

Wayne

0 Kudos
Message 3 of 3
(3,606 Views)