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

조회 수: 4 (최근 30일)
Yuhan Yang
Yuhan Yang 2021년 1월 21일
답변: Sanjana 2024년 10월 8일
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.

답변 (1개)

Sanjana
Sanjana 2024년 10월 8일
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!

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by