using kinect xbox one camera
2 ビュー (過去 30 日間)
古いコメントを表示
Hi All I am trying to do right now is to capture frames from the kinect color camera and preview them. for some reasons my code only show the last frame. _____________________________________________________--
vid = videoinput('kinect',1,'BGR_1920x1080');
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb')
vid.FrameGrabInterval = 5;
start(vid)
% Set a loop that stop after 100 frames of aquisition
while(vid.FramesAcquired<=500)
% Get the snapshot of the current fram
R=1+vid.FramesAcquired
data = getsnapshot(vid);
imshow(data)
hold on
z=0;
e=text(480,40, strcat('Between Angle: ', num2str((z))));
set(e, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color', 'yellow');
hold off
end
stop(vid);
flushdata(vid);
_________________________________________________--
I am able to see the video(imshow) only at the last frame. I can't see the whole preview for soem reasons
0 件のコメント
回答 (2 件)
Don Zheng
2017 年 7 月 17 日
First of all, "vid.FramesAcquired<=500" stops when 500 frames are acquired, not 100. FrameGrabInterval only controls how many frames to skip before acquiring the next frame. You might want to use vid.FramesAvailable instead to approximate 100 acquired frames.
Please refer to the property list for detailed definitions of each parameter:
Also, it says "The frame of data returned is independent of the video input object FramesPerTrigger property and has no effect on the value of the FramesAvailable or FramesAcquired property."
This means that 'getsnapshot' is not controlling the loop because it is not controlling vid.FramesAcquired (or vid.FramesAvailable). Frame acquisition may happen any time during the script execution and there might be more than 1 frames being acquired during the execution of a loop. So the loop may be executed for (if not far) fewer than the expected number of times.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Kinect For Windows Sensor についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!