Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to bypass MAX to configure camera?

Hi everyone, I am desiging a vision application that would among other features automatically recognizes what camera (area scan only) is plugged in and the acquisition type (Camera Link/Frame grabber or Firewire) so user doens't have to open MAX, play with settings and most likely screw everything up. In other words is it possible to design some sort of camera configuration VI that would replace MAX? Any help is gladly appreciated. Thanks
0 Kudos
Message 1 of 4
(3,588 Views)
Dear raph.yyz,

You won't be able to fully emulate the functionality of MAX in LabVIEW, but it is possible to do some camera enumeration and configuration in LabVIEW. Writing a VI that will use both Camera Link and FireWire cameras will require the use of 2 different drivers: NI-IMAQ to interface with the Camera Link Framegrabber/camera, and NI-IMAQdx or NI-IMAQ for IEEE 1394 to interface with the FireWire camera.

1) FireWire

Both the NI-IMAQ for IEEE 1394 and the NI-IMAQdx drivers contain a VI to enumerate cameras. In NI-IMAQdx this VI is called IMAQdx Enumerate Cameras and in NI-IMAQ for IEEE 1394 this VI is called IMAQ1394 Get Interface Files. These two VIs have a significant difference in functionality which is explained here:

Programmatically Finding Attached IEEE-1394 Cameras
http://digital.ni.com/public.nsf/allkb/AD1041C9B4B27240862570DD0068605B?OpenDocument

Though you can use these VIs and the methods contained in the above KnowledgeBase articles and it's related links, you still must configure a camera in the Measurement & Automation Explorer (MAX) before calling these VIs.
Configuration in MAX creates an interface file on the system, and this file is read by the enumeration VIs. Also, By default, the driver is not associated with an IEEE 1394 camera the first time it is plugged in. The camera will show up as a "Generic IEEE 1394 Camera", and you will need to right click on the camera and manually assign the NI-IMAQ for IEEE 1394 driver or the NI-IMAQdx driver in MAX. You cannot, as far as I know, programatically associate a driver with a camera. Unless you manually delete a camera file, you will need to repeat this procedure only one time for each unique camera connected to your system.

Once you enumerate the FireWire cameras connected to your system, you can use the functionality of the NI-IMAQdx or the NI-IMAQ for IEEE 1394 driver to enumerate and set camera attributes. With the IMAQdx driver, you can save a set of attributes to file using the Write Attributes VI and then read this file at the start of your VI using the Read Attributes VI to load a set of pre-configured camera settings.

2) Camera Link

You must use the NI-IMAQ driver with the Camera Link framegrabber and camera. The NI-IMAQ driver does not contain a way directly query the camera name programmatically, but there are ways to do so by parsing the iid and icd files used by the driver:

Programmatically Changing the Camera File for an IMAQ Interface
http://digital.ni.com/public.nsf/allkb/CCC5BB5990AA416786256C23006E687C?OpenDocument

How Can I Programmatically Query the Name of My Camera?
http://digital.ni.com/public.nsf/allkb/A3C14737B1A08C7786256B98006DCB5E?OpenDocument

You may be able to define a preset list of possible cameras, and the ports on your framegrabber that they must be connected to, and then create a session in LabVIEW based on this information. If that is possible, then you can use the functionality included in the NI-IMAQ driver to change and set camera attributes.

So in summary, I don't believe that you could completely emulate the functionality of MAX in your LabVIEW VI, but you can take care of most of the camera configuration and all of the camera attribute settings.

Best Regards,

~Nate


Message 2 of 4
(3,566 Views)
Thanks Nate, I very much appreciate the pertinence of your response. I managed to change the iid and icd files on the fly and programmatically call different Dalsa cameras. That worked great. The only problem is I need to know in advance what camera is going to be hooked up to the CPU. I can't just plug in a camera and call a routine that queries for the right camera. As for the firewire camera (I have both IMAQ and IMAQ dx drivers) like you said I can't emulate MAX to its full extend, I still need to right click on the right type of camera using MAX.
0 Kudos
Message 3 of 4
(3,512 Views)

Hi,

I found an easy way to set all my firewire camera params from within LabVIEW. I used an express VI and then converted it to a regular VI. The result was a VI that had all the parameters (read from MAX I assume) specified in a string constant. Sorry I can't remember all the details.

 Not sure is this will help you but I thought It worth mentioning.

 

-Martin

Certified LabVIEW Architect
Message 4 of 4
(3,497 Views)