Small Basic: How to Use Kinect Objects

This article is about Kinect for Small Basic Extension for Microsoft Small Basic programming language.  Kinect Extension is a library for Kinect sensor.


Kinect for Small Basic Extension was developed for Small Basic v1.0.  For Small Basic v1.2, Kinect for Small Basic Extension is bundled in Small Basic.
There are three objects in Kinect for Small Basic Extension.

  • KinectBodyList
  • KinectFaceList
  • KinectWindow

KinectBodyList Object

KintectBodyList mainly has following operations.

  • GetHandState - returns one of "Closed", "Lasso", "NotTracked", "Open", "Unknown" for "left" or "right" hand.
  • GetJointOrientation - returns quaternion pos["X"], pos["Y"], pos["Z"], pos["W"] for each joint.  If the orientation is around vector n and the angle is θ radians, the quaternion is as follows, while |n| = 1:
    pos["X"] = sin (θ / 2) nx
    pos["Y"] = sin (θ / 2) ny
    pos["Z"] = sin (θ / 2) nz
    pos["W"] = cos (θ / 2).
  • GetJointPosition - returns camera space position pos["X"], pos["Y"], pos["Z"] for each joint in meters.
  • GetJointScreenPosition - return screen position pos["X"], pos["Y"] for each joint.
  • GetLean - returns body lean as pos["X"], pos["Y"].  The value pos["X"] is for left (-) or right (+).  The value pos["Y"] is for back (-) or forward (+).

Program ID JTH778 is a code sample for KinectBodyList object.  Hit 1 to 5 keys to change operations above.

KinectFaceList Object

KinectFaceList mainly has following operations.

  • GetBoundingBoxInColorSpace - returns the face bounding box in color space.
  • GetBoundingBoxInInfraredSpace - returns the face bounding box in infrared space.
  • GetFacePointInColorSpace - returns pos["X"] and pos["y"] for each point in face.
  • GetFaceProperty - returns one of "Unknown", "No", "Maybe", or "Yes" for one of  "Happy", "Engaged", "WearingGlasses", "LeftEyeClosed", "RightEyeClosed", "MouthOpen", "MouthMoved", or "LookingAway".
  • GetFeatures - returns an array including face list properties above.
  • GetRotationQuaternion - returns the face rotation quaternion as pos["X"], pos["Y"], pos["Z"], pos["W"].  The meaning of quaternion is described in KinectBodyList Object above.

Program ID LGR919-0 is a code sample for KinectFaceList object.

KinectWindow Object

KinectWindow has following operations.

  • CaptureCroppedImage - to capture cropped image from the Kinect window and get an image list.
  • CaptureImage - to capture image from the Kinect window and get an image list.
  • Hide - to hide the Kinect window.
  • Show - to show one of five types of views by Kinect sensor "Color", "Infrared", "Depth", "BodyIndex", or "Body".

Program ID WBK046 is a sample code for KinectWindow.Show operation.


See Also

Other Resources