Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

imaq1394SetAttribute for absolute shutter?

What's the trick for getting this function call to work?!?!?:
 
"int errorCode = imaq1394SetAttribute(sessionID, IMG1394_ATTR_ABSOLUTE_SHUTTER, val);"
 
Produces: "errorCode = -1074364378" i.e. bad pointer. But function call requires no pointer parameters! Documentation is terrible. Please help!
 
P.S. Someone else posted this exact same problem, but no working solutions have been posited. Help!
0 Kudos
Message 1 of 8
(4,422 Views)

Hi LKeene,

I don't have a solution for your specific problem, but i know that when using absolute shutter value, you must give a value that is accepted by your camera.

 

Did you try to set the same value in Max to your camera?

Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
0 Kudos
Message 2 of 8
(4,413 Views)

Hi Doc-doc,

I'm going to switch over to relative shutter mode instead. It seems to be easier to use and I've confirmed it works. Thanks for the help!

0 Kudos
Message 3 of 8
(4,402 Views)
Id on't like working in relative mode (at least for shutter operations) so I've gone back to absolute shutter and therefore am still running into this problem. Neither the gain nor the shutter attributes funtion in absolute modes, only relative modes. These are the only two I've tested.  Running the camera in MAX shows both modes to be working fine. Anyone have any suggestions?
0 Kudos
Message 4 of 8
(4,383 Views)

Why don't you like relative mode ? do you need to change camera types for the same software ?

If so, the user can understand that the settings require to be different fot each brand of camera...

 

Cheers

Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
0 Kudos
Message 5 of 8
(4,371 Views)

LKeene

The trick to setting absolute values is passing the double value by reference.

NI-IMAQ for IEEE 1394 Example

double myShutterSpeed = 0.04;   // 40 ms shutter speed

// change from relative to absolute mode
imaq1394SetAttribute(session, IMG1394_ATTR_SHUTTER, IMG1394_ABSOLUTEMODE);

// set absolute value
imaq1394SetAttribute(session, IMG1394_ATTR_ABSOLUTE_SHUTTER, (uInt32)&myShutterSpeed);

Assuming the camera supports absolute shutter, you should now be using it.

Please note that setting absolute values have been improved with NI-IMAQdx 3.0. NI-IMAQdx is part of Vision Acquisition Software 8.2.1. NI-IMAQdx introduce variable argument list with type specifiers to remove the confusion. With variable arguments, you may pass parameters by value with type casting.

NI-IMAQdx Example:

// change mode from relative to absolute
IMAQdxSetAttribute(session, "Shutter::Mode", IMAQdxValueTypeString, "Absolute");  

// set absolute value
IMAQdxSetAttribute(session, "Shutter::Value", IMAQdxValueTypeF64, 0.04);   // note that double value is passed by value as part of variable argument list

Hope this helps,

Johann S

0 Kudos
Message 6 of 8
(4,359 Views)
Hi Johann,
 
using "niimaq1394(sesionID, IMG1394_ATTR_ABSOLUTE_SHUTTER, (uInt32)&myShutterSpeed);" returns an error code = 0, indicating that it is now at least functioning (it thinks), but there is no response from the camera. Absolute mode DOES work in MAX. Any ideas? Is there a function to switch the camera from relative to absolute, and then call the absolute shutter function?
 
Thanks,
Lionel
0 Kudos
Message 7 of 8
(4,325 Views)

Here's how to make it work:

 

double shutterTime = 2.0;      //Seconds, for example.
int errorCode;                         //To check error code returned.

//Change camera mode to absolute shutter:
errorCode = imaq1394SetAttribute(sessionID, IMG1394_ATTR_SHUTTER, IMG1394_ABSOLUTEMODE);

//Change absolute shutter time:
errorCode = imaq1394SetAttribute(sessionID, IMG1394_ATTR_ABSOLUTE_SHUTTER, (unsigned long)&shutterTime);

 

 

0 Kudos
Message 8 of 8
(4,316 Views)