Acquisition Toolbox. How can I acquired photo at specific frequency 1 Hz at camera time exposure 1 ms

Hi. I'm actually facing a problem with acquired image with the Image Acquisition Toolbox. I need to acquired image at a specific frequency of 10 Hz and 12 Hz on a moving object. In order to have a clear image the camera time exposure need to be at 1 ms. I've try a bunch of things (TriggerFcn, FrameAcquiredFcn, while loop) to realize that as soon you start(vid) the acquisition the process start acquired image as fast as posiible and I do not know how to specify the acquisition frequency. Anybody have faced this problem? Any solutin in mind?
Thanks for the help.
Denis

回答(2 个)

Hi Dilip.
I'm using Basler Ace acA4112-30um camera. My videoinput adapter is 'gentl'. I was able to solve my problem by writing my codes to acquired frames outside the vid.FramesAcquiredFct and using cell variable instead of using a 4th dimension matrice, Frame(:,:,1,i). One of my problems was that the execution time to put the frames into the variable was to long, around 600 ms.
However I'm still open to learn if there are other ways to accomplish this task.
Thanks,
Denis
Walter,
Here are what is showing:
frameRates = get(src, 'AcquisitionFrameRate')
frameRates =
28.9998
frameRates = get(src, 'ResultingFrameRate')
frameRates =
29.4638

7 个评论

I was hoping to see the output of
% Determine the device specific frame rates (frames per second) available.
frameRates = set(src, 'FrameRate')
Note: you can click on "Comment on this Answer" instead of creating a new Answer.
Walter.
Thanks for the note. It is the first time I'm using this community help.
I forgot to give this information because it has none. Here is the answer:
frameRates = set(src, 'AcquisitionFrameRate')
frameRates =
0×0 empty cell array
It is look like it doesn't have preset frame rate but the frame rate adjust itself accordingly.
I think I see where you are going with this. That probably I can fix the frame rate at the frequency acquisition that I need. Per exemple 12 Hz ou 10 Hz.
Denis
'AcquisitionFrameRate' is still not 'FrameRate' . It looks like 'FrameRate' is intended to be a list of frame rates that the device is willing to run at. It is common for cameras to have several supported frame rates, generally being willing to run faster for smaller frames.
I have sometimes seen 10 fps listed for some cameras, but I do not recall ever having seen 12 fps listed for anything.
Hmmm, looking at the product page for that specific camera, it looks like only 30 fps is supported.
I see that the device supports software trigger and hardware trigger. In theory you could run a timer object with appropriate period that triggered one frame at a time. I would worry about whether the timing jitter would be small enough for your purposes.
What you might possibly need to do is add a small hardware timing circuit that activated hardware triggers. An inexpensive arduino or raspberry pi could probably be used for that purpose.
Walter,
Actually I was able to achieved a precise frame frequency acquisition of 16 Hz and smaller with a time exposure of 0.8 ms by starting the video while having the trigger set on manual using peekdata inside a while loop where I put a pause. Here is part of my code that show the while loop for an acquisition frame frequencey of 12 Hz.
start(vid)
Pho = 1;
while Pho <= NbrPhoto
tic
FrameG{1,Pho} = peekdata(vid,1);
Pho = Pho+1;
Fin = toc;
pause(0.083 - Fin)
end
However if this way was not going to work the next step was what you suggested, having an hardware trigger generated by a wave generator.
Thanks
Ah. This does have the risk of leaving frames in the buffer, as peekdata() is always to fetch the latest buffer (and so can end up copying frames if you are peeking faster than frames are captured.)
After you run that loop (and maybe every once in a while) you should check FramesAvailable and if it is non-zero then getdata() of all of them to clear out the buffer. (At the moment I do not see a direct way to simply clear out the buffer... I thought I had found one before, but it has been a while since I looked and I could be misremembering.)
Thanks Walter. Very pertinent comments. I'll have to look to my code in order to make sure that there are any frames accumulating in the buffer. Regarding peeking faster then captured frames I made sure to not go faster than 16 Hz since my camera maximum frames rates is 30 frames/s. Do you think I can use flushdata(vid) onces a while to clear the buffer?
Denis

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by