How to detect floor with Kinect?

1,151 views
Skip to first unread message

Teng Han

unread,
Jul 6, 2011, 7:43:32 AM7/6/11
to OpenNI
Hi group,

I am trying to develop some app with collecting the value of x, y and
z of user's foot while he is standing on the floor. The thing is the
values are actually from the camera's coordinate system, which means
the y value is 0 if the height of the obj is the same to the height of
the camera. Is this correct?

I was wondering whether it's possible to detect the floor's
coordinates and try to make some transformations so that I could make
the value of y equal to 0 while the objs are staying on the floor?

thx!

Christophe

unread,
Jul 6, 2011, 9:43:42 AM7/6/11
to OpenNI
Yes you can.

You have an API called GetFloor() which gives floor point and floor
normal.
I use it to detect the height, this is surprisingly quite precise
(~2-3 cm).

Teng Han

unread,
Jul 6, 2011, 9:59:47 AM7/6/11
to OpenNI
Hi, thx for reply.

Would you like to post a piece of code showing how to use this? I've
got no clue about that so far.

Thx.

Christophe

unread,
Jul 6, 2011, 10:41:35 AM7/6/11
to OpenNI
XnPlane3D plane;
XnStatus st = g_SceneAnalyzer.GetFloor(plane);
printf("Plane point=(%f,%f,%f), vector=(%f,%f,%f)\n", plane.ptPoint.X,
plane.ptPoint.Y, plane.ptPoint.Z, plane.vNormal.X, plane.vNormal.Y,
plane.vNormal.Z);

Teng Han

unread,
Jul 6, 2011, 12:25:06 PM7/6/11
to OpenNI
thx.

Seems like it doesn't work quite well.

I've got "Find scence analyzer failed: No match found" with the code
like
[code]
nRetVal = gcontext.FindExistingNode(XN_NODE_TYPE_SCENE,
g_SceneAnalyzer);
CHECK_RC(nRetVal, "Find scence analyzer");
XnStatus st = g_SceneAnalyzer.GetFloor(plane);
printf("Plane point=(%f,%f,%f), vector=(%f,%f,%f)\n",
plane.ptPoint.X,
plane.ptPoint.Y, plane.ptPoint.Z, plane.vNormal.X, plane.vNormal.Y,
plane.vNormal.Z);

[/code]

And I've put the code in the initialization function of the camera.

Artium

unread,
Jul 7, 2011, 5:38:38 AM7/7/11
to OpenNI
What are the limitations of GetFloor()?
Does it requires a skeleton tracking? Or that the real floor is in
field of view of the device?


Thank you

Teng Han

unread,
Jul 7, 2011, 8:56:00 AM7/7/11
to OpenNI
Yes, I've got the solution.

Just make sure the function is called right after the depth image is
obtained(before the camera refresh the data), which is what I did to
make it work.

Another thing is the function might need to be called continuously for
the first few frames to get the data stable.

YOUNG

unread,
Jul 7, 2011, 10:52:38 PM7/7/11
to OpenNI
Could you be more specific or share your code?
Thanks in advance.

Campi

unread,
Jul 19, 2011, 1:58:17 PM7/19/11
to OpenNI
Yes please share you code because i have not clue about your solution,

Ronsper

unread,
Mar 4, 2012, 7:46:45 PM3/4/12
to openn...@googlegroups.com
Does anyone have any examples of this?
Reply all
Reply to author
Forward
0 new messages