Clear Filters
Clear Filters

Help me with my kinect

2 views (last 30 days)
bachelor student
bachelor student on 9 Aug 2016
Commented: Rik on 15 Nov 2021
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 Comment
Rik
Rik on 15 Nov 2021
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.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 10 Aug 2016
Only Kinect for Windows is supported, not Kinect for XBOX 360. Microsoft deliberately made the Kinect for XBOX data unreadable.
  3 Comments
Walter Roberson
Walter Roberson on 10 Aug 2016
Edited: Walter Roberson on 13 Nov 2021
The answer there is from a Mathworks employee.
Kinect for XBOX 360 is not supported.
Walter Roberson
Walter Roberson on 10 Aug 2016
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;

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!