2
votes

I'm having trouble to synchronize the color and depth image with Image acquisition ToolBox.

Currently, I'm just trying to log both streams into binary files without frame drop or losing the synchronization.

I don't try to render during my recording.

The code for the start button :

colorVid = videoinput('kinect',1); depthVid = videoinput('kinect',2);
colorVid.FramesPerTrigger = inf; depthVid.FramesPerTrigger = inf;
triggerconfig([colorVid depthVid],'manual');

iatconfigLogging(colorVid,'Video/Color.bin');
iatconfigLogging(depthVid,'Video/Depth.bin');

start([colorVid depthVid]);

pause(2); % this is to be sure both sensor are start before the trigger

trigger([colorVid depthVid]);

where the iatconfigureLogging() is from here

and the stop button just doing

stop([colorVid depthVid]);

Since the frames rate of the Kinect is 30FPS and we can't change this, I'm using FrameGrabInterval to emulate it.

But when I over like 5FPS, I can't log depth and color and keep the frames synchronized for more then 20-25 seconds. And except 1 FPS, the sync is over after 2-3 minutes and I'm looking for at least a 10-15 minutes acquisition.

I'm looking on something with like flushdata(obj,'triggers'); right now, but I don't figure it out how to keep the 30 FPS with the logging.

Thanks in advance for any one who will give something.

1

1 Answers

0
votes

As far as I know you cannot synchronize the streams by triggering because they are not synchronized in hardware. I tried it and the best I could come up with was timestamping each stream and throwing away frame pairs that were too far apart in time. I noticed the classic frequency offset effect whereby the streams move in and out of synch with inverse frequency of the difference between the periods of each. The obvious disadvantage of throwing away frames this is that you get a non-continuous stream. You can get timestamp information using

[data time] = getdata(vid,1);