Real time skeleton tracking using kinect v2
조회 수: 14 (최근 30일)
이전 댓글 표시
I'm trying to use this code using kinect v2 to get real time skeleton tracking. I'm using matlab R2018a.
clear; close all;clc
imaqreset;
depthVid = videoinput('kinect',2);
triggerconfig (depthVid,'manual');
framesPerTrig = 1;
depthVid.FramesPerTrigger = framesPerTrig;
depthVid.TriggerRepeat = inf;
prop = getselectedsource(depthVid);
prop.EnableBodyTracking = 'on';
start(depthVid)
himg = figure;
while ishandle(himg);
trigger(depthVid)
[frameDataDepth, timeDataDepth, metaDataDepth] = getdata(depthVid)
if sum(metaDataDepth.IsBodyTracked) > 0
skeletonJoints = metaDataDepth.JointPositions(:,:,metaDataDepth.IsBodyTracked)
try
delete(h)
end
h = plot(skeletonJoints(:,1), skeletonJoints(:,2),'.','MarkerSize',15); % Plota no imshow as juntas
axis([-2.1 2.1 -2.1 2.1])
end
end
This code does work, but it has a big delay, when i used:
tic
trigger(depthVid)
toc
The elapsed time is 1.002209 seconds
The trigger made my code runing slow, how can i fix it? Is there a way to reduce trigger time? The FPS are very slow.
Notice that the elapsed time to trigger is big (1sec) just when i enable body tracking (i need to use it, since i want to get real time skeleton tracking). When i tried without using body tracking property the trigger time was arround 0.003 seconds, the idial for the application.
Thank you!
댓글 수: 4
Alessandra Martinez
2023년 1월 19일
I don't have a saved input video. I'm trying to make it real time, however the RGB image isn't synched with the plotted skeleton. I'm using imshow() though.
I could attach the code I'm working with.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Acquisition Using Kinect for Windows Hardware에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!