Help me with my kinect

2 次查看(过去 30 天)
bachelor student
bachelor student 2016-8-9
评论: Rik 2021-11-15
I have a kinect Xbox360 and I am trying to use its depth matrix for avoiding obstacles in matlab, I have ran a code but it takes 3 seconds to imply, that's too much for my application, can anybody help me with that here is the code:
I just want to have the minimum distance
clc
clear all
imaqreset
depthVid=videoinput('kinect',2);% kinect recognition
triggerconfig(depthVid,'manual'); % choosing manual setting
depthVid.FramesPerTrigger=1; %frames per each run
depthVid.TriggerRepeat=inf; % maximum of runs we can get from the kinect
start(depthVid);
min=10^3;% initial arbitarary value for finding minimum distance
for i=1:100
trigger(depthVid);
[depthMap,~,depthMetaData]=getdata(depthVid); % getting data from kinect
% filtering the floor and min choosing
for i=1:480
for j=1:640
if i>320
depthMap(i,j)=0;
else if depthMap(i,j) ~= 0 && (depthMap(i,j)<min)
min=depthMap(i,j);
end
end
end
end
imshow(depthMap,[0 4096]);
min;
end
stop(depthVid);
  1 个评论
Rik
Rik 2021-11-15
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2016-8-10
Only Kinect for Windows is supported, not Kinect for XBOX 360. Microsoft deliberately made the Kinect for XBOX data unreadable.
  3 个评论
Walter Roberson
Walter Roberson 2016-8-10
编辑:Walter Roberson 2021-11-13
The answer there is from a Mathworks employee.
Kinect for XBOX 360 is not supported.
Walter Roberson
Walter Roberson 2016-8-10
Your code is inefficient. There is no point (from the point of view of efficiency) of testing a condition that will not be true for a lot of the range. You should break up the "i" range at the very least.
mask = depthmap(1:320, :) ~= 0;
smallest = min(depthmap(mask));
depthmap(321:end, :) = 0;

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by