I have kinect for PC and the new microsoft kinect SDK (not the beta). I was able to connect to the kinect from Matlab (using net.addassembly(<microsoft.kinect.dll>), and register an event listener (e.g., to DepthFrameReady event using addlistener). My event handler get called indeed (30 times a sec), but, when I copy the image data in the event handler to a matlab int8 array (using, DepthFrame.CopyPixelDataTo(frameBits)), the resulting matlab array, frameBits, is all zeros.
Any help on how to get the data from kinect sensor using microsft sdk would be highly appriciated.

댓글 수: 1

Laila Kazemi
Laila Kazemi 2013년 6월 13일
hello , im trying to get data from kinect into matlab, i had no luck yet, could you pls post ur code?

댓글을 달려면 로그인하십시오.

 채택된 답변

Amir
Amir 2012년 7월 22일

0 개 추천

OK, found the solution to my problem.I guess there aren't many poeple out there working with the kinect through Matlab...

댓글 수: 5

Walter Roberson
Walter Roberson 2012년 7월 22일
What was the solution?
Star Strider
Star Strider 2012년 7월 23일
Probably this:
since all the TMW pages supporting Kinect seem to no longer exist, even though they're still indexed and appear on the TMW search results.
This is where I went first:
since it looks like fun when time eventually permits.
Amir
Amir 2012년 9월 14일
편집: Walter Roberson 2012년 9월 14일
Actually I don't have Simulink, so I'm using the Kinect from a "barebone" Matlab.
The solution to my original questions (getting the data from the depthImageFrame object to matlab is the following:
netArray=NET.createArray('System.Int16',frame.PixelDataLength);
frame.CopyPixelDataTo(netArray);
frameBits=int16(netArray);
depthBits=int16(ceil(frameBits/8));%first 3 bits are the skelton index
depthFrame=reshape(depthBits,frame.Width,frame.Height)';
Amir
ANDREA JARAMILLO
ANDREA JARAMILLO 2019년 5월 3일
Hi, i have a problem with kinect v1 and matlab 2013, I need to acquire data from the joints when a person is walking but I get very few data because is very slow the sample of the "getdata" to get all the jointscoordinates each second, and thats give me only some angles and looses others that I need. This is the code. I hope someone could help me :(
depthVid = videoinput('kinect',2,'Depth_640x480');
preview(colorVid);
preview(depthVid );
triggerconfig(depthVid,'manual');
depthVid.FramesPerTrigger=1;
depthVid.TriggerRepeat=inf;
set(getselectedsource(depthVid),'TrackingMode','Skeleton')
start(depthVid);
himg = figure;
while ishandle(himg);
trigger(depthVid);
[depthMap, ~, depthMetaData]= getdata(depthVid);
if sum(depthMetaData.IsSkeletonTracked)>0
cont=cont+1;
skeletonJoints= depthMetaData.JointImageIndices(:,:,depthMetaData.IsSkeletonTracked);
jointCoordinates=depthMetaData.JointWorldCoordinates(:,:,depthMetaData.IsSkeletonTracked);
imshow (depthMap, [0 4096]);
hold on;
graficar_esqueleto(skeletonJoints)
hold off;
i=i+1;
%Angulos de articulación de rodillas
jointCoordinates
%der
ang1=Angulo(13,15,jointCoordinates);
ang_rodilla1(i)=(180-ang1)
%izq
ang2=Angulo(17,19,jointCoordinates);
ang_rodilla2(i)=(180-ang2)
else
imshow (depthMap, [0 4096]);
end
drawnow
end
stop(depthVid);
clear depthVid;
hey, I'm having the same issue, did you figure it out?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품

질문:

2012년 5월 13일

댓글:

2023년 2월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by