Directory:
Research on Somatosensory interaction and Kinect-Basic
Study on Somatosensory interaction airkinect-Case study 1
Study on Somatosensory interaction airkinect-Case 2
Case 1:
Objective: To implement the interaction between air production and control by Using Kinect. When the Mobile Virtual Control moves to "play a video" and "sandbox Experience", water waves appear. When the water waves are full, the corresponding page is displayed.
Preliminary completion: the source code will be provided later, and the Kinect gesture Control Sandbox will be updated later.
package { import flash.display.Sprite; import flash.events.Event; import flash.ui.Mouse; import flash.display.StageDisplayState; import com.as3nui.nativeExtensions.air.kinect.Kinect; import com.as3nui.nativeExtensions.air.kinect.KinectSettings; import com.as3nui.nativeExtensions.air.kinect.events.CameraImageEvent; import com.as3nui.nativeExtensions.air.kinect.constants.CameraResolution; import flash.display.Bitmap; import com.as3nui.nativeExtensions.air.kinect.data.User; import com.as3nui.nativeExtensions.air.kinect.data.SkeletonJoint; import com.as3nui.nativeExtensions.air.kinect.events.UserEvent; public class Main extends Sprite { private var device:Kinect; private var bmp:Bitmap; private var skeletonContainer:Sprite; private var circle:Circle; public function Main() { if (Kinect.isSupported()) { bmp = new Bitmap ; addChild(bmp); skeletonContainer = new Sprite ; addChild(skeletonContainer); /*circle = new Circle ; circle.x = -100; circle.y = -100; skeletonContainer.addChild(circle);*/ device = Kinect.getDevice(); device.addEventListener(CameraImageEvent.DEPTH_IMAGE_UPDATE, rgbImageUpdateHandler); device.addEventListener(UserEvent.USERS_WITH_SKELETON_ADDED, skeletonsAddedHandler, false, 0, true); device.addEventListener(UserEvent.USERS_WITH_SKELETON_REMOVED, skeletonsRemovedHandler, false, 0, true); var settings:KinectSettings = new KinectSettings(); settings.depthEnabled = true; settings.skeletonEnabled = true; addEventListener(Event.ENTER_FRAME,loop); device.start(settings); } } public function skeletonsAddedHandler(event:UserEvent):void { circle = new Circle ; circle.x = -100; circle.y = -100; skeletonContainer.addChild(circle); } public function skeletonsRemovedHandler(event:UserEvent):void { clearContainer(); } public function loop(e:Event):void { //clearContainer(); for each (var user:User in device.usersWithSkeleton) { var head:SkeletonJoint = user.getJointByName("right_hand"); circle.x = head.position.depthRelative.x * stage.stageWidth; circle.y = head.position.depthRelative.y * stage.stageHeight; /*for each (var joint:SkeletonJoint in user.skeletonJoints) { skeletonContainer.graphics.beginFill(0xff0000) skeletonContainer.graphics.drawCircle(joint.position.depth.x,joint.position.depth.y,3) skeletonContainer.graphics.endFill() var circle:Circle = new Circle ; circle.x = joint.position.depth.x; circle.y = joint.position.depth.y; skeletonContainer.addChild(circle); }*/ } } public function rgbImageUpdateHandler(event:CameraImageEvent):void { bmp.bitmapData = event.imageData; } public function clearContainer():void { while (skeletonContainer.numChildren != 0) { skeletonContainer.removeChildAt(0); } } }}
The rest is only the collision detection to determine whether or not to select.