I have to acquire image sequences from two webcams at the same time.
Synch is very important since I am dealing with stereo vision applied to a moving target.
By using preview I can see two synchronized video streaming. I have checked the synch by filming a chronometer.
When I use ‘start’ and ‘getdata’ to retrieve the two videos I experience about two seconds delay between the two sequences as if they have been acquired one after the other.
How can I manage to have two synchronized video?
Code attached.
Thank you in advance!
camera=setup_webcamRcam=camera(1);Lcam=camera(2);Rcam.FramesPerTrigger = 30;Lcam.FramesPerTrigger = 30;preview(camera)start(camera)stoppreview(camera);diskLoggerR = VideoWriter('Rvvvvvv, 'Uncompressed AVI');open(diskLoggerR);dataR = getdata(camera(1), camera(1).FramesAvailable);numFrames = size(dataR, 4);for ii = 1:numFrames writeVideo(diskLoggerR, dataR(:,:,:,ii));endclose(diskLoggerR);diskLoggerL = VideoWriter(‘Lvvvv’, 'Uncompressed AVI');open(diskLoggerL);dataL = getdata(camera(2), camera(2).FramesAvailable);numFrames = size(dataL, 4);for ii = 1:numFrames writeVideo(diskLoggerL, dataL(:,:,:,ii));endclose(diskLoggerL);
Best Answer