This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Acquiring from Color and Depth Devices Simultaneously

You can synchronize the data from the Kinect® for Windows® color stream and the depth stream using software manual triggering.

This synchronization method example triggers both objects manually.

  1. Create the objects for the color and depth sensors. Device 1 is the color sensor and Device 2 is the depth sensor.

    vid = videoinput('kinect',1);
    vid2 = videoinput('kinect',2);
  2. Get the source properties for the depth device.

    srcDepth = getselectedsource(vid2);
  3. Set the frames per trigger for both devices to 1.

    vid.FramesPerTrigger = 1;
    vid2.FramesPerTrigger = 1;
  4. Set the trigger repeat for both devices to 200, in order to acquire 201 frames from both the color sensor and the depth sensor.

    vid.TriggerRepeat = 200;
    vid2.TriggerRepeat = 200;
  5. Configure the camera for manual triggering for both sensors.

    triggerconfig([vid vid2],'manual');
  6. Start both video objects.

    start([vid vid2]);
  7. Trigger the devices, then get the acquired data.

    % Trigger 200 times to get the frames.
    for i = 1:201
        % Trigger both objects.
        trigger([vid vid2])
        % Get the acquired frames and metadata.
        [imgColor, ts_color, metaData_Color] = getdata(vid);
        [imgDepth, ts_depth, metaData_Depth] = getdata(vid2);
Was this topic helpful?