【发布时间】:2019-06-04 08:36:09
【问题描述】:
我的教育项目是关于使用 Kinect 进行手势识别。我正在将 kinect 用于 XBox One 和适配器。
我使用以下代码从 kinect 录制了彩色和深度视频:(类似于所说的 here)
clc
clear all
close all
imaqreset
%Call up dicertory containing utility functions
utilpath = fullfile(matlabroot, 'toolbox', 'imaq', 'imaqdemos', 'html', 'KinectForWindows');
addpath(utilpath);
%Create the videoinput objects for the colour and depth streams
colourVid = videoinput('kinect', 1, 'BGR_1920x1080');
depthVid = videoinput('kinect', 2, 'Depth_512x424');
depthSource = getselectedsource(depthVid);
depthSource.EnableBodyTracking = 'on';
%------------------------------------------------
%setting up record
%------------------------------------------------
% set the data streams to logging mode and to disk
set(colourVid, 'LoggingMode', 'Disk&Memory');
set(depthVid, 'LoggingMode', 'Disk&Memory');
%Set a video timeout property limit to 50 seconds
set(colourVid, 'Timeout',50);
set(depthVid, 'Timeout',50);
%Creat a VideoReader object
colourLogfile = VideoWriter('colourTrial5.avi', 'Uncompressed AVI');
depthLogfile = VideoWriter('depthTrial5.mj2', 'Archival');
%configure the video input object to use the VideoWriter object
colourVid.DiskLogger = colourLogfile;
depthVid.DiskLogger = depthLogfile;
%set the triggering mode to 'manual'
triggerconfig([colourVid depthVid], 'manual');
%set the FramePerTrigger property of the VIDEOINPUT objects to 100 to
%acquire 100 frames per trigger.
set([colourVid depthVid], 'FramesPerTrigger', 100);
%------------------------------------------------
%Initiating the aquisition
%------------------------------------------------
%Start the colour and depth device. This begins acquisition, but does not
%start logging of acquired data
start([colourVid depthVid]);
pause(20); %allow time for both streams to start
%Trigger the devices to start logging of data.
trigger([colourVid depthVid]);
%Retrieve the acquired data
[colourFrameData, colourTimeData, colourMetaData] = getdata(colourVid);
[depthFrameData, depthTimeData, depthMetaData] = getdata(depthVid);
skeletonData = depthMetaData; %making copy of data
save('skeletonData.mat','skeletonData')
stop([colourVid depthVid])
但是当我播放视频时,很明显这两个彩色和深度视频并不是同时录制的。我当前的实现在两个传感器之间存在延迟(几乎 1 秒!) 看来颜色传感器已经开始工作了,在深度传感器之前,然后,在拍摄了100帧之后,它在深度传感器之前停止了工作。 我希望两个传感器同步,以便每个传感器的视频在同一时刻。
为什么会这样?? 任何人都可以提出解决方案吗?
任何解决方案将不胜感激。 谢谢。
【问题讨论】:
-
我没有使用此硬件的经验,但是录制的视频元数据是否没有时间戳或 fps 数据?这将有助于同步它们
标签: matlab triggers synchronization kinect video-recording