Kinect to Small Basic

Testerday on the Coding4Fun blog I highlighted the new version of Small Basic, Simulations, Emulators, Virtual Reality and Small Basic v1.2. One thing I glossed over was the awesome new support for the Kinect in Small Basic, saving that for here.. :)

Small Basic 1.2 Released with Kinect Support and Bug Fixes

Michael Scherotter is a Media Experience Evangelist at Microsoft who works with media companies to help them build apps, works with 3D printer manufacturers to help them write drivers, and is part of the Small Basic development team who brought Kinect objects to Small Basic 1.2.

We are excited to announce that a new version of Small Basic is now available with some cool new Kinect objects, language improvements, and bug fixes.  If you don’t know, Small Basic is Microsoft’s free BASIC programming environment for kids and is part of a family of easy-to-use free coding tools for kids that includes Kodu Game Lab and Touch Develop

Kinect for Windows

If you are running Windows 8, Windows 8.1, or Windows 10, and have a Kinect 2 Sensor or Kinect for Xbox One Sensor attached to your PC, you will see three new objects available to you in Small Basic: KinectWindow, KinectBodyList and KinectFaceList.  You can use these objects separately, with each other, or with any of the other Small Basic objects.  Think of them as three new objects to program with that enable your body to become an input device for Small Basic.  Each of the new objects are fully documented with code samples in the Intellisense window that you can copy/paste to the code window:

image

...

KinectWindow Object

KinectWindow is like GraphicsWindow or TextWindow in that it represents a window on the screen.  It’s main use is to let you see what the visual sensors in the Kinect are detecting.  

KinectWindow.Show(“Color”)

image

KinectWindow.Show(“Depth”)

 

...

KinectBodyList Object

Use the KinectBodyList to track the position and orientation of the bodies of up to 6 people (not dogs, I’ve tried).  You can track the position of “joints” throughout the bodies being tracked, from the hands, to ankles, to heads.  You get the position in 3D space using KinectBodyList.GetJointOrientation() and in 2D space on the screen using KinectBodyList.GetJointScreenPosition().  In addition to the joint positions, you can hand open/closed state with KinectBodyList.GetHandState() and the lean of the body using KinectBodyList.GetLean().

KinectFaceList Object

Use the KinectFaceList to track the orientation, expression, and position of up to 6 human faces.  You use KinectFaceList.GetFaceProperty() to get aspects of faces like Happy, Engaged, WearingGlasses, LeftEyeClosed, RightEyeClosed, MouthOpen, MouthMoved, or LookingAway.  Using the KinectFaceList.GetBoundingBoxInColorSpace() in conjunction with KinectWindow.CaptureCroppedImage(), you can detect where faces are in the scene and grab their images to use in your Small Basic program.

Give It a Try!

We are sure that you will think of something cool to do with Kinect and Small Basic as we’ve tried to make it as easy as possible to start programming with a Kinect sensor.  If you have used the Kinect sensor already, you will probably realize that only a portion of its capabilities are exposed today in Small Basic 1.2.  You can do even more with the Kinect for Windows SDK 2.0, like define visual gestures and use the microphones built into the Kinect sensor.  We would love your input if you have any suggestions for enhancing the new Kinect objects or any other part of Small Basic.

KinectWindow.Show("Color")
TextWindow.WriteLine("What does a coder look like?")
TextWindow.Pause()
width = KinectWindow.SensorSize["Width"] / 4
height = KinectWindow.SensorSize["Height"] / 4
image = KinectWindow.CaptureImage(width, height)
GraphicsWindow.DrawImage(image, 0, 0)

Project Information URL: http://blogs.msdn.com/b/smallbasic/archive/2015/10/01/small-basic-1-2-released-with-kinect-support-and-bug-fixes.aspx

Project Download URL: Small Basic 1.2

NUI Grab - Kinect for Small Basic Sample Program

I made a sample program using KinectBodyList object in Small Basic programming language.

The program has been uploaded as TCG608.  NUI stands for Natural User Interface.  You can drag and drop the circle (ellipse) in this program with your right hand.  KinectBodyList.GetHandState operation can return that your hand is "Closed", "Lasso" or "Open".  When your right hand is "Closed" on the circle, you can grab the circle.

Project Information URL: http://blogs.msdn.com/b/smallbasic/archive/2015/10/19/nui-grab-kinect-for-small-basic-sample-program.aspx

Project Download URL: TCG608




Tags:

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
    Unsubscribing
    Subscribing

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.