Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

time between snaps

Hi,
 
I am new to using labview and I am trying to write a .vi file that can accomplish the following:
 
I need to be able to take pictures and know the time each picture was taken relative to each other.  I am currently limited by the fact that whenever I "snap" a picture, it results in a white image output, and whenever I use the sequence command, I have no way of recording the time that each picture was taken.
 
If there is anyone who has experience with this sort of scenario I would really appreciate the help.
 
I'm working with:
 
Sony xcd-v50 camera
LabVIEW 8.0
NI-IMAQdx 3.0 drivers
 
One of my colleagues has also experienced trouble with the Sony camera taking snapshots, and was told that it is better to use sequence.vi and ignore the first image, however in my case, unless I can find a way to get an exact time for each image, I cannot ignore the first image.  I have attached one of the .vi files that I am using that is close to what I need, but not complete, and I am sure with a little help this file could be useful to me and to others with a similar situation.
 
Thanks,
Thomas
0 Kudos
Message 1 of 5
(3,932 Views)

I had a similar application acquiring images every 2 seconds and saving them to a hard drive.  I used a vision acquisition vi , imaq write file , build path, and build text. You can build a path using the build text vi to enter the current time into the path as a file name for each image. To do this you will  need to enter the time into the build text vi. This was also my first attempt at programming an application in labview, probably not where I would choose to start learning to program if I had a choice. If you have access to Vision Builder for Automated Inspection it makes programming a lot easier. In VBAI there is a function to do exactly what you want.

Good Luck

 

0 Kudos
Message 2 of 5
(3,905 Views)

If your timing requirements only apply to short intervals, you can use the frame numbers of a grab sequence to measure your time interval.  If you use a fixed frame rate on the camera, you can easily calculate the time interval.

Acquire your images using the grab function, and record the frame number for each image.  As long as you keep the grab going, you will be able to measure the intervals between images.  You can even request specific images if you want an image every 2 seconds, etc.as long as you request them before they are taken.  If you use a sequence, you can request them shortly before or after they are taken.

If you need to stop the acquisition and measure longer intervals, you won't be able to get split second resolution.  Your best option would be to read the computer time immediately after acquiring each image.  Once again, a grab function will be a better choice since you won't have to worry about the first image.

I believe there is an option in MAX to ignore the first image.  This makes it automatically take a second image in snap mode so you don't get white images.

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 3 of 5
(3,897 Views)
Hi Bruce,
 
I am not sure how to save images that I grab or how to set up a timer to measure the intervals between images when using the grab function.  Is this easy to do?
 
Thanks to both of you who responded to my post.  I think I was able to solve this problem this morning.  If you consider the .vi file I attached, I modified it to have two consecutive sequence functions (one now appearing in the frame previous to the existing sequence function), and by doing so the first sequence has the blank (all white) first image, and then the images in the second sequence all appear properly, with none being whited out.  I use a millisecond timer to record the time when the first sequence starts, the second sequence starts, and then after the second sequence ends to find the time interval for the range of images.  Does anyone know how to reset the millisecond timer so it always starts at zero?  From the description I have provided, does it sound as if there are any potential problems I could run into?
 
Many thanks to all for your help,
 
Tom
0 Kudos
Message 4 of 5
(3,891 Views)

Most cameras have fixed frame rates available as an option in MAX.  If not, you can run a continuous grab acquisition and read the current frame number and the millisecond timer, then wait a few seconds and read the frame number and timer again.  The change in frame number divided by change in second (milliseconds/1000) will give you a pretty accurate frame rate.  The bigger the gap between readings, the more accurate your frame rate will be.

Once you have the frame rate, you can measure the elapsed time between frames by subtracting the frame numbers and dividing by frames per second.  For example, if the difference of your frame numbers is 40, and the frame rate is 60 fps, the elapsed time is 40/60 or 2/3 of a second.

I still think checking the "ignore first frame" box in MAX is the best solution to your first white frame.

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 5 of 5
(3,886 Views)