Problems recording from two cameras using hardware trigger (master-slave cable)?
19 次查看(过去 30 天)
显示 更早的评论
I have tried to record from two identical cameras simultaneously (I need them to start recording at exactly the same time) using hardware trigger between the two cameras through a master-slave cable. It seems that Matlab doesn't wait for this hardware trigger and thus the slave camera doesn't start recording after the master camera starts. The slave camera starts with the command but not with the trigger from the master camera, this gives a delay of about 300 ms between the start of the slave and master camera. Below the code that I have been using:
FRAMES_PER_TRIGGER = 10; %Create video object 1 (master camera) masterVid = videoinput ('gige', 1, 'mono8'); %Create video object 2 (slave camera) slaveVid = videoinput ('gige', 2, 'mono8'); masterSrc = getselectedsource (masterVid); slaveSrc= getselectedsource (slaveVid); % configure parameters for the master camera %set(masterSrc, 'SyncOut1SyncOutPolarity', 'RisingEdge') triggerconfig(masterVid, 'immediate'); set(masterVid, 'FramesPerTrigger', FRAMES_PER_TRIGGER); set(masterSrc, 'SyncOut1SyncOutSource', 'Exposing');
% configure parameters for the slave configs = triggerinfo(slaveVid); triggerconfig(slaveVid, 'hardware'); set(slaveSrc, 'AcquisitionStartTriggerMode', 'on'); %set(slaveSrc, 'AcquisitionStartTriggerActivation', 'RisingEdge'); set(slaveSrc, 'AcquisitionStartTriggerSource', 'Line1'); set(slaveSrc, 'AcquisitionRecordTriggerMode', 'on'); set(slaveSrc, 'AcquisitionRecordTriggerActivation', 'RisingEdge'); set(slaveSrc, 'AcquisitionRecordTriggerSource', 'Line1');
% Start Acquistion start(slaveVid) isrunning(slaveVid) islogging(slaveVid) start(masterVid) isrunning(masterVid) islogging(masterVid) islogging(slaveVid)
wait(masterVid) wait(slaveVid)
fprintf('Master Frames Available: %d \n', masterVid.FramesAvailable); fprintf('Slave Frames Available: %d \n', slaveVid.FramesAvailable); masterData = getdata(masterVid, FRAMES_PER_TRIGGER); slaveData = getdata(slaveVid, FRAMES_PER_TRIGGER);
firstMasterFrame = masterData(:,:,:,1); firstSlaveFrame = slaveData(:,:,:,1); subplot(1,2,1), subimage(firstMasterFrame) subplot(1,2,2), subimage(firstSlaveFrame)
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GigE Vision Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!