Research on Somatosensory interaction and Kinect-Basic

Source: Internet
Author: User

Directory:

Research on Somatosensory interaction and Kinect-Basic

Study on Somatosensory interaction airkinect-Case study 1

Study on Somatosensory interaction airkinect-Case 2

 

 

Here we will briefly record the basics of airkinect.

 

Airkinect is very easy to use. For example, as3 uses the camera and accelerator accelerometer. First, determine whether the system supports Kinect.

if(Kinect.isSupported()){}

If

if (Kinect.isSupported())            {                device = Kinect.getDevice();                rgbBitmap = new Bitmap();                addChild(rgbBitmap);                device.addEventListener(CameraImageEvent.RGB_IMAGE_UPDATE, rgbImageUpdateHandler);                var settings:KinectSettings = new KinectSettings();                settings.rgbEnabled = true;                settings.rgbResolution = CameraResolution.RESOLUTION_160_120;                device.start(settings);            }

Device is defined here: if the Kinect supports this function, obtain the Kinect device (Kinect. getdevice ),

We can set the screen size through kinectsettings, And the Kinect provides several screen sizes:

160*120, 320*240, 640*480, 1280*960

These settings are all set under resolution under kinectsettings, and you must set ** enabled to true for the corresponding images obtained under settings.

 var settings:KinectSettings = new KinectSettings();     settings.rgbEnabled = true;     settings.rgbResolution = CameraResolution.RESOLUTION_160_120;

 

If you want to set a gesture tracking

        settings.handTrackingEnabled = true;

Finally, remember to set the device to run.

 device.start(settings);

This can be obtained through Kinect.RGB Images, deep images, and infrared images.

 

RGB image

if (Kinect.isSupported()) {            device = Kinect.getDevice();            rgbBitmap = new Bitmap();            addChild(rgbBitmap);            device.addEventListener(CameraImageEvent.RGB_IMAGE_UPDATE, rgbImageUpdateHandler, false, 0, true);            device.addEventListener(DeviceInfoEvent.INFO, deviceInfoHandler, false, 0, true);            device.addEventListener(DeviceErrorEvent.ERROR, deviceErrorHandler, false, 0, true);            device.addEventListener(DeviceEvent.STARTED, kinectStartedHandler, false, 0, true);            device.addEventListener(DeviceEvent.STOPPED, kinectStoppedHandler, false, 0, true);            var settings:KinectSettings = new KinectSettings();            settings.rgbEnabled = true;            settings.rgbResolution = CameraResolution.RESOLUTION_1280_960;            device.start(settings);        }

 

protected function rgbImageUpdateHandler(event:CameraImageEvent):void 
{ rgbBitmap.bitmapData = event.imageData;}

 

Deep Screen

 

 if (Kinect.isSupported()) {            device = Kinect.getDevice();            depthBitmap = new Bitmap();            addChild(depthBitmap);            device.addEventListener(CameraImageEvent.DEPTH_IMAGE_UPDATE, depthImageUpdateHandler, false, 0, true);            device.addEventListener(DeviceEvent.STARTED, kinectStartedHandler, false, 0, true);            device.addEventListener(DeviceEvent.STOPPED, kinectStoppedHandler, false, 0, true);            var settings:KinectSettings = new KinectSettings();            settings.depthEnabled = true;            settings.depthResolution = CameraResolution.RESOLUTION_640_480;            settings.depthShowUserColors = true;            device.start(settings);        }

Infrared Image (if it is infrared, You need to determine whether infrared is supported)

 if (Kinect.isSupported()) {            device = Kinect.getDevice();            if (device.capabilities.hasInfraredSupport) {                infraredBitmap = new Bitmap();                addChild(infraredBitmap);                device.addEventListener(CameraImageEvent.INFRARED_IMAGE_UPDATE, infraredImageUpdateHandler, false, 0, true);                device.addEventListener(DeviceEvent.STARTED, kinectStartedHandler, false, 0, true);                device.addEventListener(DeviceEvent.STOPPED, kinectStoppedHandler, false, 0, true);                var config:OpenNIKinectSettings = new OpenNIKinectSettings();                config.infraredEnabled = true;                config.infraredResolution = CameraResolution.RESOLUTION_640_480;                device.start(config);            }        }

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.