How to receive hardware triggers multiple times using Image Acquisition Toolbox?

6 vues (au cours des 30 derniers jours)
Yuhan Yang
Yuhan Yang le 21 Jan 2021
Hi,
I'm using an aliend vision camera. The camera is triggered by an external source. I want the camera to capture 30 frames per trigger. The trigger will repeate 200 times. And the data can be automatically logged into disk.
Here's my script:
vid = videoinput('gentl', 1, 'Mono8');
src = getselectedsource(vid);
src.ExposureTime = 8000;
src.AcquisitionFrameRateMode = 'Basic';
src.AcquisitionFrameRate = 7.6;
src.TriggerSelector = 'AcquisitionStart';
src.TriggerMode = 'on';
src.TriggerSource = 'Line0';
vid.FramesPerTrigger = 30;
triggerconfig(vid, 'hardware', 'DeviceSpecific', 'DeviceSpecific');
vid.TriggerRepeat = 200-1;
% log
vid.LoggingMode = 'disk';
diskLogger = VideoWriter('TEST.avi', 'Grayscale AVI');
vid.DiskLogger = diskLogger;
diskLogger.FrameRate = fr;
% start
start(vid);
wait(vid, inf);
stop(vid)
delete(vid)
clear
However, this script doesn't work as my expectation. The hardware can recognize the first trigger, but then it looks like the acquistion is executed continously until it collectes 200*30 frames.
I tried to change vid.TriggerRepeat to 0 and loop the acquistion 200 times. This method works normally most of time. However, it sometimes produce an error when executing start(vid): can not set ROI. It doesn't happen every time. It just happens sometimes in the middle of the acqusition. That's why I want to use a non-zero vid.TriggerRepeat for multiple triggers, so that I only need to start(vid) once.

Réponses (1)

Sanjana
Sanjana le 8 Oct 2024
Hi,
To resolve the issue, kindly try the following troubleshooting steps:
  • Use the triggerInfo function to determine if your image acquisition device supports hardware triggers.
  • If it does, verify if you are using valid supported configurations for the TriggerSource and TriggerCondition properties.
  • Also, when external camera is configured to use AcquisitionStart hardware triggering mode and continuous acquistion mode, it is required to specify an acquisition frame count property value(AcquisitionFrameCount).
Hope this helps!

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by