07-11-2012 06:05 PM - edited 07-11-2012 06:07 PM
Hello,
I'm fairly inexperienced and working on a project in which a camera is attached to a moving X-Y stage. The goal is for the camera to track worms moving below in real-time, then follow them. The camera is a Basler A601f with an IEEE1394 interface. I think this would work with IMAQ, but the software that controls the motors is Linux-only, so that's not an option. It seems my only choice is to use the functions of a C library (libdc1394) to read the camera. Here's my question:
The library creates a "camera session," initializing a bunch of stuff, then starts a video feed to a buffer. The easy solution would be to write a C program that initializes the camera, takes one picture and outputs it, then cleans up the camera session. I could call this program repeatedly in LabVIEW. However, I feel like the repeated initializations would have a bunch of overhead. I would prefer to have a C program running in the background, so I could periodically poll the buffer from LabVIEW to get the latest picture. I can't really think of a way to do this with just the "Call Library Node." Is this possible, and how would I do it?
I tried to keep the post pretty simple, so if you need any more information, please ask. Thanks!
07-11-2012 07:15 PM
Thanks for trying to keep the post short, but there's not enough information to answer your question. What functions does the library provide? Is the session a parameter that you pass to each call to the library? There's no reason you should need to open a new session for every image, but it depends on how the library is structured.
07-11-2012 08:13 PM
As I was writing this post, I realized that this might be a dumb question. For some reason, I was under the impression that LabVIEW couldn't handle C pointers, so I would have to make a wrapper function around the library. But I didn't know how to keep this wrapper function in memory - you'll see later in the post how this would be a problem, since you need to get a handle for the camera in order to take pictures, so if the program closed, you would lose the handle. But turns out LabVIEW can use pointers, so I probably won't need a wrapper function at all! So hopefully this won't be a problem.
OK, here's the basic form for running the camera:
Library initialization: d = dc1394_new ();
Get list of cameras: dc1394_camera_enumerate (d, &list);
Initialize camera: camera = dc1394_camera_new (d, list->ids[0].guid);
Release list of cameras: dc1394_camera_free_list (list);
Get list of video modes: dc1394_video_get_supported_modes(camera,&video_modes);
Pick a mode: dc1394_video_get_supported_modes(camera,&video_modes);
(Similar to get framerate and other parameters)
Set camera speed: dc1394_video_set_iso_speed(camera, DC1394_ISO_SPEED_400);
(Similar to set mode and framerate)
Tell camera to start transmission: dc1394_video_set_transmission(camera, DC1394_ON);
Take a frame from camera buffer: dc1394_capture_dequeue(camera, DC1394_CAPTURE_POLICY_WAIT, &frame);
This is the step that actually grabs the picture, so it would be in a loop. After that, data transmission is stopped, the session is closed, etc.
I'll bump the thread if I have more trouble. Thanks.