Introduction to the Kinect for Windows SDK Development (14) Advanced guidelines

Source: Internet
Author: User
Tags image processing library static class

The previous 13 articles described the most basic knowledge of various aspects of the Kinect SDK development. As this series of UBM titles, this knowledge is just a primer for the development of the Kinect for Windows SDK. This article will introduce some knowledge (beyond the basic) that the Kinect advanced development needs to know.

Readers may notice that after learning all aspects of Kinect development in the previous 13 articles, such as image data flow, depth camera, skeleton tracking, microphone array, speech recognition, and so on, Leaving out some of the Kinect apps we see on the web with a good user experience still looks stretched. The Kinect SDK, in a sense, only provides the same or better functionality for some other Kinect libraries. To further improve the application experience of the Kinect for Windows applications, we need to learn about some of the other Kinect-related development technologies and class libraries. The real application potential of Kinect is to integrate with other technologies.

This article will describe how some of the Third-party libraries can help handle the data provided by the Kinect sensor. Using different techniques for Kinect development, you can discover the powerful features of the Kinect application. On the other hand, if you do not use these classes of libraries developed for a specific purpose, and you implement them yourself, your code can be more confusing and unstable. This article simply introduces these third-party libraries and gives them proper guidance. The biggest difficulty with Kinect development is not what technology is, but what technology can be used in the Kinect development. Once you know what technology is available, there is a huge potential for the application that Kinect might develop.

Some of the techniques described in this article may not be broad enough, and it is possible that some of the class libraries are important but this article does not address the fact that the technical changes in Kinect development are very fast, which is also unavoidable, and welcome to be added. But by introducing some basic help libraries, image processing libraries, and so on, I want you to understand the importance of these technologies and their role in the development of Kinect. Perhaps with the development of technology, these class libraries may have some changes, but the relevant technical areas are believed to be the same, this article just played a role.

This article and the next article will cover several useful tools and class libraries, including the Coding4Fun Kinect Toolkit,emgu (C # version of the OPENCV Computer Vision Library) and blender. Just a very simple introduction to the Unity 3D game Framework, faast gesture recognition middleware and Microsoft Robotics Developer Studio. This knowledge, if you are interested, may take a certain amount of energy to understand and grasp, here is simply introduced.

1. Image processing Help class

There are many image processing related libraries that can be used. In the. NET framework alone, There are System.Windows.Media.Drawing abstract classes in PresentationCore.dll, and classes in the System.Drawing namespace in System.Drawing.dll can be used. More complicated, there are separate classes for working with shapes (shape) and colors (color) under the System.Windows and System.Drawing namespaces. Sometimes a method in a class library can do some image processing and there are no similar methods in other class libraries. In order to be convenient, the transformation between various kinds of drawing objects seems very necessary.

When the Kinect is introduced, the situation becomes more complex. Kinect has its own image data stream, such as ImageFrame. In order to enable the Kinect to use these proprietary image objects in conjunction with WPF, the ImageFrame object must be converted to a ImageSource type, which is in the System.Windows.Media.Imaging namespace. The third party image processing library does not know the objects in the System.Windows.Media namespace, but knows System.Drawing namespaces, in order to be able to use EMGU to process the data produced in Kinect, you need to convert some of the data types in Microsoft.kinect to Sy Stem. Drawing type, and then converts the System.Drawing type to the type in EMGU, after processing in EMGU, then converting back to the System.Drawing type and then to the System.Windows.Media type for WPF use.

1.1 Coding4Fun Kinect Tool Class

Coding4Fun Kinect Toolkit provides some convenience for converting some types from one class library to the corresponding types in other class libraries. This toolset can be downloaded from the Open Source Tool Set's website http://c4fkinect.codeplex.com/. It consists of 3 separate DLLs. Coding4Fun.Kinect.Wpf.dll provides a series of extension methods to convert between Microsoft.kinect and System.Windows.Media. Coding4Fun.Kinect.WinForm.dll provides a series of extension methods to convert between Microsoft.kinect and System.Drawing. System.Drawing is a DLL in the. NET graphics library. He contains the elements needed in the WinForm for drawing and presentation, and the required presentation elements in WPF are contained in System.Windows.Media.

Unfortunately, the Coding4Fun Kinect Toolkit does not provide a conversion method for the corresponding object between the System.Drawing namespace and the System.Windows.Media namespace. This is because the original purpose of toolkit is to easily write the Kinect demo program rather than to provide a generic class library that converts between different image types. Therefore, some of the methods that might be used in WPF may exist in WinForm DLLs. Some very useful, complex methods for processing depth image data in depth data streams are encapsulated in simple objects that convert the Kinect image type to WPF ImageSource.

But the Coding4Fun Kinect Toolkit has two better places to remove doubts. One is, he is open source, the source code can download and view. You can see how the Coding4Fun team uses the byte array within the image processing through the source code. You can see the shadow of the code in the previous blog in this code, and some of the little tricks in the class library are very helpful. The second is that these methods are extension methods, can be very convenient to expand.

An extension method is a syntactic sugar that makes a separate method look like it is attached to a type. For example, there is a method AddOne can add the current value to 1. This method can be rewritten as an extension method. Simply set the method to static and add this before the Int32 type. Code as follows, and then call AddOne (3) This method can be simply rewritten to 3. AddOne ()

public int AddOne (int i)
{return
    i + 1;
}
public static class MyExtensions
{public
    static int AddOne (this int i)
    {return
        i + 1;
    }
}

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.