Kinect Development Note v using PowerShell to control Kinect

Source: Internet
Author: User

This is the first time to use the Markdown Editor to write a blog, like this without any form of comfortable editor, free and easy to read, to leave an unnatural natural section of the memorial to find a comfortable editor.

This time, record the use of WIN7/WIN8 built-in PowerShell to control the Kinect and change the tilt angle of the Kinect.

After we installed the Kinect SDK, all the drivers and related libraries that were used to control Kinect were loaded into Windows. So we can use the Windows built-in PowerShell directly to get the most basic control over the Kinect that we've connected successfully.

First we open PowerShell, press WINDOWS+R, bring up the running window, and enter PowerShell, return!

We will find that ... There is a command prompt like things, appear some low-end ... Here in order to look good, some high-end, convenient, we bring up PowerShell's integrated scripting environment, we entered the command prompt in Ise, enter, we can see the interface is more mature ise, and when we write code, there will be automatic prompt.

After the integration scripting environment is paged out, we start typing the script in the Ise. What we're going to do is: Load assembly--start kinect--control the Kinect tilt--turn off Kinect.

[Reflection.Assembly]::LoadWithPartialName("Microsoft.Kinect")[Microsoft.Kinect.KinectSensor]::KinectSensors[0].Start()[Microsoft.Kinect.KinectSensor]::KinectSensors[0].ElevationAngle=13[Microsoft.Kinect.KinectSensor]::KinectSensors[0].Stop()

Every line we enter, we need to press ENTER, and Kinect will make the appropriate adjustments according to our script. The results of the execution in the ISE are as follows:

When you execute the first line of the script, you will see that the system response has loaded the GAC (Global Assembly Cache, which holds the system share. NET components) inside the. NET components.

Executing the second line of the script, the Kinect sensor starts, and we can notice that the most left-hand infrared projector on the Kinect starts and glows red.

When you execute the third line of scripting, Kinect will clearly look up 13 degrees.

Executes the fourth line of script, corresponding to the second line of scripts, to turn off Kinect after use, to avoid the extra waste of system resources, and to ensure that the program paradigm runs smoothly.

We can also use PowerShell to switch the function of the Kinect for Windows Infrared projector, as we mentioned earlier, that Kinect for Xbox does not have this feature.
Here I post the code and no longer executes it in the ISE.

[Microsoft.Kinect.KinectSensor]::KinectSensors[0].ForceInfraredEmitterOff=1[Microsoft.Kinect.KinectSensor]::KinectSensors[0].ForceInfraredEmitterOff=0

When Forceinfraredemitteroff=1, it is forced to close, equal to 0 when the infrared is turned on, of course, this code is also placed between the start () and the Stop () method to execute.

Of course the use of PowerShell can do far more than that, but he can not be a tool for us to develop, only when debugging and familiarity with the Kinect is a great help to us.

Note: This series of blog entries refer to the Kinect Body Sense programming Primer

2015.3.21 10:23
by Mr.losers

Kinect Development Note v using PowerShell to control Kinect

Related Article

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.