0
votes

I am capturing color and depth images from the Kinect for Windows using MATLAB and the official Kinect SDK. I would like both sensors to be synchronized such that the image from each sensor is of the same moment. Unfortunately, my current implementation has a lag between the two sensors (of almost 1 second!). Please help me find a way to synchronize the sensors. Here is my current code:

colorVid = videoinput('kinect',1,'RGB_640x480');
depthVid = videoinput('kinect',2,'Depth_640x480');
triggerconfig([colorVid depthVid],'Manual');
set([colorVid depthVid], 'FramesPerTrigger', 300);
start([colorVid depthVid]);
trigger([colorVid depthVid]);
pause(10);
[imgColor, ts_color, metaData_Color] = getdata(colorVid);
[imgDepth, ts_depth, metaData_Depth] = getdata(depthVid);
stop([colorVid depthVid]);
delete([colorVid depthVid]);
clear colorVid depthVid;
1

1 Answers

1
votes

I've played with this for a while and it seems that adding a pause between the start() and trigger() functions solves this problem!

start([colorVid depthVid],'FramesPerTrigger',300);
pause(1);
trigger([colorVid depthVid]);