LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to synchronize image refreshing and camera? (stroboscopic setup)

Hello everyone,

 

I have an experimental setup, which consists of a projector and a camera. I control the camera snapshot timing with LabVIEW VIs from the manufacturer. The projector is installed as an additional screen, so I can use WindDraw VIs from Vision to update the outputted projector image.

 

During one cycle of my program (duration: 2seconds) I want to take an image with the camera of a default projector image (0.4s) and then set a different image (for 1.6s).

 

My problem is that the camera does not take the snapshot immediately when issued (apparently there is some overhead, so I need to include wait times) and during the exposure, the projector image changes.  I could increase the cycle length, but I would prefer to keep the measurement frequency high. Especially I would not like to increase the cycle length due to slow VIs.

In addition the output image is refreshed later than I anticipated. I read up on that and found that the LV GUI is not updated in real time.

 

So I wonder:

1) Is there an example VI that illustrates how control a stroboscopic setup?

2) Can I use LabVIEW for image refreshing or should I reprogram the image output with OpenGL?

 

Previously I have used Matlab for a similar purpose and did not encounter such problems. I would really like to stick with LabVIEW though, as the interface is more intuitive for users.

 

Kind regards,

Jan

0 Kudos
Message 1 of 4
(2,944 Views)

I'm sorry, but I don't quite understand what you are trying to do.  Let me rephrase what I think it is, and you correct me if I am wrong.

 

  • You are running this program on a Windows system, not a LabVIEW RT setup.
  • Your program gets a "projector" (is this a piece of hardware?) to output an image to a screen (monitor?  connected and managed by the same LabVIEW program?) every 2 seconds.
  • You want a camera to capture an image once every 2 seconds, taking care that the camera acquires the image while it is "stable", say 0.4 seconds after it has been updated from the projector.

I'm assuming that the Projector hardware outputs an image that is not, itself, readily available to LabVIEW, but must be acquired/captured by the Camera.  I'm also assuming that LabVIEW "triggers" both the Projector and the Camera, and that the real question is how to synchronize the Output (Projector) and Input (Camera) so that all of the images are captured properly.

 

If this is the question and experimental situation, it seems to me that you want a 2-second loop that starts the Projector.  Within this loop, you wait some amount of time and then Snap a picture.  If you use something like a Timed Loop or a Notifier to run the main loop, you should (Famous Last Words) be able to put an appropriate Delay between Output and Input inside the loop to keep O and I "in synch".

 

Bob Schor

 

 

0 Kudos
Message 2 of 4
(2,919 Views)

I'm sorry my description was ambiguous.  Thank you for trying to make sense of it.

 

  • I am running the setup on a Win7 machine with the latest LabVIEW version.
  • The projector is a video projector (http://www.casio-projectors.eu/euro/products/xja140/). It is connected via VGA to a graphics card output of the computer. It appears as an additional screen in resolution options dialogue in Windows. The screen content is given by a LabVIEW Vision Image Draw window.
  • The projectot output over time is as follows:
  1. 0.0s-0.4s: uniform image of the same grayscale value (=100) (for the camera to take a picture)
  2. 0.4s-2.0s: a gradient grayscale image with varying grayscale values
  3. then the cycle repeats
  • I would like to take the image during part 1 of every cycle.

Right now I can do the above steps. However, part 1 is not 0.4s but 1.5s (due to safety "waits" before and after the camera takes a picture).

 

This has two reasons:

  1. The camera takes time to initiate the capture (0.2s).
  2. The LabVIEW image update is not initiated when it should be, based on the code (GUI update delay).

So, is there a way to update the LabVIEW output image window faster? For example by not using LabVIEW output window but an OpenGL window?

Also is there some way to synchronize camera and projector tbetter? Including wait times prolongs the cycle length, where I ideally would like the cycle length to be as short as possible.

 

Thank you very much for your time 🙂

 

0 Kudos
Message 3 of 4
(2,884 Views)

I think this should be doable, but because it (I think) shouuld be two parallel tasks.  I think if we can get the "Display" part working properly, getting the (synchronized) images will be relatively straight-forward.

 

So here is the question -- can you write a VI that runs your Projector to make the picture, repeating every 2 seconds, that you need?  It should be easy (using Picture controls and functions) to make at least the Uniform Image of a Gray Scale, and might not be so hard to make the gradient gray scale (but I'm not sure what you want).

 

Concentrate on making an image that looks like the (two) image(s) that you want.  Even if it is way too slow, if we have a better idea of what you want, we might be able to suggest ways to get it "faster".

 

Once we've got dis Production cycle working properly, it should be relatively simple to write a Consumer that simply does a "Snap" and takes a single image once per cycle.

 

Post some stuff here (attach a zipped VI or a full snippet) and we'll go from there.

 

Bob Schor

0 Kudos
Message 4 of 4
(2,870 Views)