Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How does labview link to NiMAX when taking an image

I have an unsupported camera link camera (build by Rockwell Scientific). I have constructed a camera file for the camera which seems to work ok (at least I am getting images). I have set attributes in the camera file that allow a user to set exposure time and frame rate and they seem to work as expected when I set them in NiMAX. The problem comes when I try to run the IMAQ vi's in LabView. When I write a simple snap program where I enter exposure time and frame rate, I can see (using an O Scope which lets me monitor the exposure time that is set in the camera registers) I can see the exposure time switch from the one I have set in the vi to the one set by default in the camera file. It seems that the IMAQ snap vi is fi
rst running whatever it finds in the camera file first, then setting my new attributes. Is this true? What exactly is the sequence of events in an IMAQ image snap and how is NiMAX involved?

My camera is currently set to run in free run mode, I have done no triggering yet as I am trying to understand how my camera file is interacting with LabView. There is still a good amount of instability in my system as I repeatedly get memory exceptions both from NiMAX and LabView.
0 Kudos
Message 1 of 4
(3,342 Views)
Here's my current understanding of camera config files. Hopefully somebody from NI will correct me if I am wrong.

Your LabVIEW program does not interact directly with MAX. It does load the config file (icd) created by MAX. When you use Init to initialize the camera, the default settings (set in MAX) are transmitted to the camera. At this point, you can make changes in the configuration by selecting non-default settings. As you change each one, it will issue the commands within that section of the config file.

Make sure you are doing your Init and Close outside the snap routine, and wire the session ID into the snap routine. You only need to Init and Close once outside a loop, then you can use Snap as many times as you want within the loop. When you d
o it this way, any changes you make to the settings will be maintained until you use Close.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4
(3,342 Views)
Thanks for the response Bruce. Unfortunately, I don't think that's quite the way things happen. I tried a program with just the snap vi in a loop and the init and close outside the loop and I got the same behavior. I am operating a camera that has a BNC output that allows me to monitor the exposure setting in the camera registers and I can watch this change as I set new exposure times. What happens (whether or not the snap is in a loop) is each time snap is called, the exposure time sets to whatever the default is in the camera file, then it changes to the value I have set in the SetCameraAttribute vi. It then alternates back and forth if I put the snap in a loop. It's almost like the camera file is loaded each time snap is called, not each time init i
s called. This results in pretty slow response from the camera. I realize there are low level routines I can call, and I'll used them when it comes time to trigger the camera, but I need to understand how the camera file is used in labview before I go any further.

Also, are you sure that MAX isn't involved in LabView camera control? I was under the impression that MAX controlled all the drivers for labview and as such was loaded when labview needed to control an interface. They seem to be inseparably linked and it's this dependence I'm trying to understand.

Thanks so much for your time and help!

Tony Darnell
0 Kudos
Message 3 of 4
(3,342 Views)
MAX is just a utility to configure and test all your NI drivers and hardware. It is not used within LabVIEW or any of the other programming environments. The settings from MAX are all that are used.

This is a curious behavior each time you run Snap. It does sound like it is going through the entire config file each time you Snap. I am wondering if at the beginning of the config file, the camera is set to its default values, then these values are modified later in the config file (to whatever you selected). I would try changing the selected value in MAX, and see if the first value changes with it. I suspect that first value will always be the camera default value.

If possible, use Grab instead of Snap. It will do a continuous acquisi
tion without reconfiguring the camera every time. You may be able to change camera parameters during an acquisition, but will probably need to stop the acquisition, change the parameter, then restart it. When you aren't changing parameters, it will operate much faster.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 4
(3,342 Views)